2006-03-27 05:37:27 +02:00
|
|
|
#!/usr/bin/perl
|
2007-02-22 20:44:06 +01:00
|
|
|
################################################################################
|
2006-03-27 05:37:27 +02:00
|
|
|
# Pandora DB Stress tool
|
2007-02-22 20:44:06 +01:00
|
|
|
################################################################################
|
2009-12-18 14:46:32 +01:00
|
|
|
# Copyright (c) 2005-2009 Artica Soluciones Tecnologicas S.L
|
2007-02-22 20:44:06 +01:00
|
|
|
#
|
2007-06-07 12:30:03 +02:00
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; version 2
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2007-02-22 20:44:06 +01:00
|
|
|
################################################################################
|
|
|
|
|
2009-04-14 Ramon Novoa <rnovoa@artica.es>
* pandora_ctl, pandora_network, pandora_wmi, pandora_plugin,
pandora_prediction, bin/pandora_wmi, bin/pandora_plugin,
bin/pandora_prediction, bin/pandora_snmpconsole, bin/pandora_recon,
bin/pandora_network, pandora_recon, pandora_snmpconsole: Deleted
from repository. Old server code and startup scripts.
* Makefile.PL, pandora_server_installer, lib/PandoraFMS/Config.pm
lib/PandoraFMS/DB.pm, lib/PandoraFMS/Tools.pm, bin/pandora_server,
pandora_package_installer, pandora_server: Updated to work with the
new code, removed unneeded dependencies, fixed some bugs etc.
* lib/PandoraFMS/SNMPServer.pm, lib/PandoraFMS/PluginServer.pm,
lib/PandoraFMS/ProducerConsumerServer.pm, lib/PandoraFMS/Server.pm,
lib/PandoraFMS/PredictionServer.pm, lib/PandoraFMS/Core.pm,
lib/PandoraFMS/ReconServer.pm, lib/PandoraFMS/DataServer.pm,
lib/PandoraFMS/NetworkServer.pm, lib/PandoraFMS/WMIServer.pm: Added
to repository. New server code.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1620 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-04-14 21:13:16 +02:00
|
|
|
use POSIX qw(strftime);
|
|
|
|
|
2007-05-03 04:15:42 +02:00
|
|
|
# Configure here target (AGENT_ID for Stress)
|
2007-06-07 12:30:03 +02:00
|
|
|
|
|
|
|
my $target_module = -1; # -1 for all modules of that agent
|
|
|
|
my $target_agent = -1;
|
2008-03-13 19:33:44 +01:00
|
|
|
my $target_interval = 300;
|
|
|
|
my $target_days = 30;
|
2007-02-22 20:44:06 +01:00
|
|
|
|
|
|
|
################################################################################
|
|
|
|
################################################################################
|
2006-03-27 05:37:27 +02:00
|
|
|
|
|
|
|
# Includes list
|
|
|
|
use strict;
|
|
|
|
use DBI; # DB interface with MySQL
|
|
|
|
use Math::Trig; # Math functions
|
|
|
|
|
|
|
|
# Pandora Modules
|
2007-06-07 12:30:03 +02:00
|
|
|
use PandoraFMS::Config;
|
|
|
|
use PandoraFMS::Tools;
|
|
|
|
use PandoraFMS::DB;
|
2009-04-14 Ramon Novoa <rnovoa@artica.es>
* pandora_ctl, pandora_network, pandora_wmi, pandora_plugin,
pandora_prediction, bin/pandora_wmi, bin/pandora_plugin,
bin/pandora_prediction, bin/pandora_snmpconsole, bin/pandora_recon,
bin/pandora_network, pandora_recon, pandora_snmpconsole: Deleted
from repository. Old server code and startup scripts.
* Makefile.PL, pandora_server_installer, lib/PandoraFMS/Config.pm
lib/PandoraFMS/DB.pm, lib/PandoraFMS/Tools.pm, bin/pandora_server,
pandora_package_installer, pandora_server: Updated to work with the
new code, removed unneeded dependencies, fixed some bugs etc.
* lib/PandoraFMS/SNMPServer.pm, lib/PandoraFMS/PluginServer.pm,
lib/PandoraFMS/ProducerConsumerServer.pm, lib/PandoraFMS/Server.pm,
lib/PandoraFMS/PredictionServer.pm, lib/PandoraFMS/Core.pm,
lib/PandoraFMS/ReconServer.pm, lib/PandoraFMS/DataServer.pm,
lib/PandoraFMS/NetworkServer.pm, lib/PandoraFMS/WMIServer.pm: Added
to repository. New server code.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1620 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-04-14 21:13:16 +02:00
|
|
|
use PandoraFMS::Core;
|
2006-03-27 05:37:27 +02:00
|
|
|
|
2007-02-22 20:44:06 +01:00
|
|
|
################################################################################
|
|
|
|
################################################################################
|
2006-03-27 05:37:27 +02:00
|
|
|
|
2009-12-18 14:43:02 +01:00
|
|
|
my $version = "3.0 PS091214";
|
2006-03-27 05:37:27 +02:00
|
|
|
|
|
|
|
# FLUSH in each IO (only for debug, very slooow)
|
|
|
|
# ENABLED in DEBUGMODE
|
|
|
|
# DISABLE FOR PRODUCTION
|
2007-02-22 20:44:06 +01:00
|
|
|
$| = 0;
|
2006-03-27 05:37:27 +02:00
|
|
|
|
|
|
|
my %pa_config;
|
|
|
|
|
|
|
|
# Inicio del bucle principal de programa
|
|
|
|
pandora_init(\%pa_config,"Pandora DB Stress tool");
|
|
|
|
|
|
|
|
# Read config file for Global variables
|
2009-04-14 Ramon Novoa <rnovoa@artica.es>
* pandora_ctl, pandora_network, pandora_wmi, pandora_plugin,
pandora_prediction, bin/pandora_wmi, bin/pandora_plugin,
bin/pandora_prediction, bin/pandora_snmpconsole, bin/pandora_recon,
bin/pandora_network, pandora_recon, pandora_snmpconsole: Deleted
from repository. Old server code and startup scripts.
* Makefile.PL, pandora_server_installer, lib/PandoraFMS/Config.pm
lib/PandoraFMS/DB.pm, lib/PandoraFMS/Tools.pm, bin/pandora_server,
pandora_package_installer, pandora_server: Updated to work with the
new code, removed unneeded dependencies, fixed some bugs etc.
* lib/PandoraFMS/SNMPServer.pm, lib/PandoraFMS/PluginServer.pm,
lib/PandoraFMS/ProducerConsumerServer.pm, lib/PandoraFMS/Server.pm,
lib/PandoraFMS/PredictionServer.pm, lib/PandoraFMS/Core.pm,
lib/PandoraFMS/ReconServer.pm, lib/PandoraFMS/DataServer.pm,
lib/PandoraFMS/NetworkServer.pm, lib/PandoraFMS/WMIServer.pm: Added
to repository. New server code.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1620 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-04-14 21:13:16 +02:00
|
|
|
pandora_load_config (\%pa_config,0); #Start like a data server
|
2006-03-27 05:37:27 +02:00
|
|
|
|
|
|
|
# open database, only ONCE. We pass reference to DBI handler ($dbh) to all subprocess
|
2007-06-07 12:30:03 +02:00
|
|
|
my $dbh = DBI->connect("DBI:mysql:$pa_config{'dbname'}:$pa_config{'dbhost'}:3306",$pa_config{'dbuser'}, $pa_config{'dbpass'}, { RaiseError => 1, AutoCommit => 1 });
|
2006-03-27 05:37:27 +02:00
|
|
|
|
2007-06-07 12:30:03 +02:00
|
|
|
print " [*] Working for agent ID $target_agent \n";
|
2006-03-27 05:37:27 +02:00
|
|
|
print " [*] Generating data of $target_days days ago \n";
|
|
|
|
print " [*] Interval for this workload is $target_interval \n";
|
|
|
|
|
2007-05-03 04:15:42 +02:00
|
|
|
# For each module of $target_agent_id
|
2007-03-12 18:41:58 +01:00
|
|
|
my $query_idag;
|
|
|
|
|
|
|
|
if ($target_agent ne -1){
|
2009-12-18 14:43:02 +01:00
|
|
|
if ($target_module ne -1){
|
|
|
|
$query_idag = "select * from tagente_modulo where id_agente = $target_agent AND id_agente_modulo = $target_module";
|
|
|
|
} else {
|
|
|
|
$query_idag = "select * from tagente_modulo where id_agente = $target_agent";
|
|
|
|
}
|
2007-03-12 18:41:58 +01:00
|
|
|
} else {
|
|
|
|
$query_idag = "select * from tagente_modulo";
|
|
|
|
}
|
|
|
|
|
2006-03-27 05:37:27 +02:00
|
|
|
my $s_idag = $dbh->prepare($query_idag);
|
|
|
|
$s_idag ->execute;
|
|
|
|
if ($s_idag->rows != 0) {
|
2009-04-14 Ramon Novoa <rnovoa@artica.es>
* pandora_ctl, pandora_network, pandora_wmi, pandora_plugin,
pandora_prediction, bin/pandora_wmi, bin/pandora_plugin,
bin/pandora_prediction, bin/pandora_snmpconsole, bin/pandora_recon,
bin/pandora_network, pandora_recon, pandora_snmpconsole: Deleted
from repository. Old server code and startup scripts.
* Makefile.PL, pandora_server_installer, lib/PandoraFMS/Config.pm
lib/PandoraFMS/DB.pm, lib/PandoraFMS/Tools.pm, bin/pandora_server,
pandora_package_installer, pandora_server: Updated to work with the
new code, removed unneeded dependencies, fixed some bugs etc.
* lib/PandoraFMS/SNMPServer.pm, lib/PandoraFMS/PluginServer.pm,
lib/PandoraFMS/ProducerConsumerServer.pm, lib/PandoraFMS/Server.pm,
lib/PandoraFMS/PredictionServer.pm, lib/PandoraFMS/Core.pm,
lib/PandoraFMS/ReconServer.pm, lib/PandoraFMS/DataServer.pm,
lib/PandoraFMS/NetworkServer.pm, lib/PandoraFMS/WMIServer.pm: Added
to repository. New server code.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1620 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-04-14 21:13:16 +02:00
|
|
|
while (my $module = $s_idag->fetchrow_hashref()) {
|
2006-03-27 05:37:27 +02:00
|
|
|
# Fill this module with data !
|
2009-04-14 Ramon Novoa <rnovoa@artica.es>
* pandora_ctl, pandora_network, pandora_wmi, pandora_plugin,
pandora_prediction, bin/pandora_wmi, bin/pandora_plugin,
bin/pandora_prediction, bin/pandora_snmpconsole, bin/pandora_recon,
bin/pandora_network, pandora_recon, pandora_snmpconsole: Deleted
from repository. Old server code and startup scripts.
* Makefile.PL, pandora_server_installer, lib/PandoraFMS/Config.pm
lib/PandoraFMS/DB.pm, lib/PandoraFMS/Tools.pm, bin/pandora_server,
pandora_package_installer, pandora_server: Updated to work with the
new code, removed unneeded dependencies, fixed some bugs etc.
* lib/PandoraFMS/SNMPServer.pm, lib/PandoraFMS/PluginServer.pm,
lib/PandoraFMS/ProducerConsumerServer.pm, lib/PandoraFMS/Server.pm,
lib/PandoraFMS/PredictionServer.pm, lib/PandoraFMS/Core.pm,
lib/PandoraFMS/ReconServer.pm, lib/PandoraFMS/DataServer.pm,
lib/PandoraFMS/NetworkServer.pm, lib/PandoraFMS/WMIServer.pm: Added
to repository. New server code.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1620 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-04-14 21:13:16 +02:00
|
|
|
process_module (\%pa_config, $module, $target_interval, $target_days, $dbh);
|
2006-03-27 05:37:27 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
$s_idag->finish();
|
|
|
|
$dbh->disconnect();
|
|
|
|
print " [*] All work done\n\n";
|
|
|
|
# END of main proc
|
|
|
|
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
# SUB process_module ()
|
|
|
|
# Create a full range set of Pseudo random data for id_agente_modulo passed
|
|
|
|
# as second parameter. Depends on module_name to generate a random value
|
|
|
|
# (random) or periodic curve (cuve) values.
|
|
|
|
##############################################################################
|
|
|
|
|
2009-04-14 Ramon Novoa <rnovoa@artica.es>
* pandora_ctl, pandora_network, pandora_wmi, pandora_plugin,
pandora_prediction, bin/pandora_wmi, bin/pandora_plugin,
bin/pandora_prediction, bin/pandora_snmpconsole, bin/pandora_recon,
bin/pandora_network, pandora_recon, pandora_snmpconsole: Deleted
from repository. Old server code and startup scripts.
* Makefile.PL, pandora_server_installer, lib/PandoraFMS/Config.pm
lib/PandoraFMS/DB.pm, lib/PandoraFMS/Tools.pm, bin/pandora_server,
pandora_package_installer, pandora_server: Updated to work with the
new code, removed unneeded dependencies, fixed some bugs etc.
* lib/PandoraFMS/SNMPServer.pm, lib/PandoraFMS/PluginServer.pm,
lib/PandoraFMS/ProducerConsumerServer.pm, lib/PandoraFMS/Server.pm,
lib/PandoraFMS/PredictionServer.pm, lib/PandoraFMS/Core.pm,
lib/PandoraFMS/ReconServer.pm, lib/PandoraFMS/DataServer.pm,
lib/PandoraFMS/NetworkServer.pm, lib/PandoraFMS/WMIServer.pm: Added
to repository. New server code.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1620 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-04-14 21:13:16 +02:00
|
|
|
sub process_module($$$$$){
|
|
|
|
my ($pa_config, $module, $target_interval, $target_days, $dbh) = @_;
|
|
|
|
|
|
|
|
my $id_agentemodulo = $module->{'id_agente_modulo'};
|
|
|
|
my $target_name = $module->{'nombre'};
|
|
|
|
my $target_agent = $module->{'id_agente'};
|
2006-03-27 05:37:27 +02:00
|
|
|
|
|
|
|
my $factor;
|
2009-04-14 Ramon Novoa <rnovoa@artica.es>
* pandora_ctl, pandora_network, pandora_wmi, pandora_plugin,
pandora_prediction, bin/pandora_wmi, bin/pandora_plugin,
bin/pandora_prediction, bin/pandora_snmpconsole, bin/pandora_recon,
bin/pandora_network, pandora_recon, pandora_snmpconsole: Deleted
from repository. Old server code and startup scripts.
* Makefile.PL, pandora_server_installer, lib/PandoraFMS/Config.pm
lib/PandoraFMS/DB.pm, lib/PandoraFMS/Tools.pm, bin/pandora_server,
pandora_package_installer, pandora_server: Updated to work with the
new code, removed unneeded dependencies, fixed some bugs etc.
* lib/PandoraFMS/SNMPServer.pm, lib/PandoraFMS/PluginServer.pm,
lib/PandoraFMS/ProducerConsumerServer.pm, lib/PandoraFMS/Server.pm,
lib/PandoraFMS/PredictionServer.pm, lib/PandoraFMS/Core.pm,
lib/PandoraFMS/ReconServer.pm, lib/PandoraFMS/DataServer.pm,
lib/PandoraFMS/NetworkServer.pm, lib/PandoraFMS/WMIServer.pm: Added
to repository. New server code.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1620 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-04-14 21:13:16 +02:00
|
|
|
|
2006-03-27 05:37:27 +02:00
|
|
|
my $valor = 0; # value storage for data generation
|
|
|
|
my $a; # loopcounter
|
|
|
|
my $b; # counter
|
|
|
|
print " [*] Processing module $target_name \n";
|
2009-04-14 Ramon Novoa <rnovoa@artica.es>
* pandora_ctl, pandora_network, pandora_wmi, pandora_plugin,
pandora_prediction, bin/pandora_wmi, bin/pandora_plugin,
bin/pandora_prediction, bin/pandora_snmpconsole, bin/pandora_recon,
bin/pandora_network, pandora_recon, pandora_snmpconsole: Deleted
from repository. Old server code and startup scripts.
* Makefile.PL, pandora_server_installer, lib/PandoraFMS/Config.pm
lib/PandoraFMS/DB.pm, lib/PandoraFMS/Tools.pm, bin/pandora_server,
pandora_package_installer, pandora_server: Updated to work with the
new code, removed unneeded dependencies, fixed some bugs etc.
* lib/PandoraFMS/SNMPServer.pm, lib/PandoraFMS/PluginServer.pm,
lib/PandoraFMS/ProducerConsumerServer.pm, lib/PandoraFMS/Server.pm,
lib/PandoraFMS/PredictionServer.pm, lib/PandoraFMS/Core.pm,
lib/PandoraFMS/ReconServer.pm, lib/PandoraFMS/DataServer.pm,
lib/PandoraFMS/NetworkServer.pm, lib/PandoraFMS/WMIServer.pm: Added
to repository. New server code.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1620 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-04-14 21:13:16 +02:00
|
|
|
my $agent_name = get_agent_name ($dbh, $target_agent);
|
2006-03-27 05:37:27 +02:00
|
|
|
my $err; # not used
|
|
|
|
# Init start time to now - target_days
|
2009-04-14 Ramon Novoa <rnovoa@artica.es>
* pandora_ctl, pandora_network, pandora_wmi, pandora_plugin,
pandora_prediction, bin/pandora_wmi, bin/pandora_plugin,
bin/pandora_prediction, bin/pandora_snmpconsole, bin/pandora_recon,
bin/pandora_network, pandora_recon, pandora_snmpconsole: Deleted
from repository. Old server code and startup scripts.
* Makefile.PL, pandora_server_installer, lib/PandoraFMS/Config.pm
lib/PandoraFMS/DB.pm, lib/PandoraFMS/Tools.pm, bin/pandora_server,
pandora_package_installer, pandora_server: Updated to work with the
new code, removed unneeded dependencies, fixed some bugs etc.
* lib/PandoraFMS/SNMPServer.pm, lib/PandoraFMS/PluginServer.pm,
lib/PandoraFMS/ProducerConsumerServer.pm, lib/PandoraFMS/Server.pm,
lib/PandoraFMS/PredictionServer.pm, lib/PandoraFMS/Core.pm,
lib/PandoraFMS/ReconServer.pm, lib/PandoraFMS/DataServer.pm,
lib/PandoraFMS/NetworkServer.pm, lib/PandoraFMS/WMIServer.pm: Added
to repository. New server code.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1620 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-04-14 21:13:16 +02:00
|
|
|
my $utimestamp = time () - (86400 * $target_days);
|
|
|
|
my $timestamp = strftime ("%Y-%m-%d %H:%M:%S", localtime($utimestamp));
|
|
|
|
|
2006-03-27 05:37:27 +02:00
|
|
|
# Calculate how many iterations need to fill data range
|
|
|
|
# $target_days*min*sec / $target_interval
|
|
|
|
|
|
|
|
my $iterations = ($target_days * 24 * 60 * 60) / $target_interval;
|
|
|
|
|
2009-04-14 Ramon Novoa <rnovoa@artica.es>
* pandora_ctl, pandora_network, pandora_wmi, pandora_plugin,
pandora_prediction, bin/pandora_wmi, bin/pandora_plugin,
bin/pandora_prediction, bin/pandora_snmpconsole, bin/pandora_recon,
bin/pandora_network, pandora_recon, pandora_snmpconsole: Deleted
from repository. Old server code and startup scripts.
* Makefile.PL, pandora_server_installer, lib/PandoraFMS/Config.pm
lib/PandoraFMS/DB.pm, lib/PandoraFMS/Tools.pm, bin/pandora_server,
pandora_package_installer, pandora_server: Updated to work with the
new code, removed unneeded dependencies, fixed some bugs etc.
* lib/PandoraFMS/SNMPServer.pm, lib/PandoraFMS/PluginServer.pm,
lib/PandoraFMS/ProducerConsumerServer.pm, lib/PandoraFMS/Server.pm,
lib/PandoraFMS/PredictionServer.pm, lib/PandoraFMS/Core.pm,
lib/PandoraFMS/ReconServer.pm, lib/PandoraFMS/DataServer.pm,
lib/PandoraFMS/NetworkServer.pm, lib/PandoraFMS/WMIServer.pm: Added
to repository. New server code.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1620 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-04-14 21:13:16 +02:00
|
|
|
print " [D] ID_AgenteMoludo $id_agentemodulo Interval $target_interval ModuleName $target_name Days $target_days Agent $target_agent \n";
|
2006-03-27 05:37:27 +02:00
|
|
|
|
|
|
|
open (LOG,">> pandora_dbstress.log");
|
|
|
|
# Generate MATH/Curve data for beautiful Drawings
|
|
|
|
if ( $target_name =~ /curve/i ){
|
|
|
|
# COS function to draw curves in a regular way
|
|
|
|
$b = 0;
|
|
|
|
$factor=rand(20);
|
|
|
|
for ($a=1;$a<$iterations;$a++){
|
2009-12-18 14:43:02 +01:00
|
|
|
$valor = 1 + cos(deg2rad($b));
|
2006-03-27 05:37:27 +02:00
|
|
|
$b = $b + $factor/10;
|
|
|
|
if ($b > 180){
|
|
|
|
$b =0;
|
|
|
|
}
|
2009-04-14 Ramon Novoa <rnovoa@artica.es>
* pandora_ctl, pandora_network, pandora_wmi, pandora_plugin,
pandora_prediction, bin/pandora_wmi, bin/pandora_plugin,
bin/pandora_prediction, bin/pandora_snmpconsole, bin/pandora_recon,
bin/pandora_network, pandora_recon, pandora_snmpconsole: Deleted
from repository. Old server code and startup scripts.
* Makefile.PL, pandora_server_installer, lib/PandoraFMS/Config.pm
lib/PandoraFMS/DB.pm, lib/PandoraFMS/Tools.pm, bin/pandora_server,
pandora_package_installer, pandora_server: Updated to work with the
new code, removed unneeded dependencies, fixed some bugs etc.
* lib/PandoraFMS/SNMPServer.pm, lib/PandoraFMS/PluginServer.pm,
lib/PandoraFMS/ProducerConsumerServer.pm, lib/PandoraFMS/Server.pm,
lib/PandoraFMS/PredictionServer.pm, lib/PandoraFMS/Core.pm,
lib/PandoraFMS/ReconServer.pm, lib/PandoraFMS/DataServer.pm,
lib/PandoraFMS/NetworkServer.pm, lib/PandoraFMS/WMIServer.pm: Added
to repository. New server code.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1620 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-04-14 21:13:16 +02:00
|
|
|
$utimestamp += $target_interval;
|
|
|
|
my $timestamp = strftime ("%Y-%m-%d %H:%M:%S", localtime($utimestamp));
|
2006-03-27 05:37:27 +02:00
|
|
|
$valor = $valor * $b * 10;
|
|
|
|
$valor = sprintf("%.2f", $valor);
|
2009-04-14 Ramon Novoa <rnovoa@artica.es>
* pandora_ctl, pandora_network, pandora_wmi, pandora_plugin,
pandora_prediction, bin/pandora_wmi, bin/pandora_plugin,
bin/pandora_prediction, bin/pandora_snmpconsole, bin/pandora_recon,
bin/pandora_network, pandora_recon, pandora_snmpconsole: Deleted
from repository. Old server code and startup scripts.
* Makefile.PL, pandora_server_installer, lib/PandoraFMS/Config.pm
lib/PandoraFMS/DB.pm, lib/PandoraFMS/Tools.pm, bin/pandora_server,
pandora_package_installer, pandora_server: Updated to work with the
new code, removed unneeded dependencies, fixed some bugs etc.
* lib/PandoraFMS/SNMPServer.pm, lib/PandoraFMS/PluginServer.pm,
lib/PandoraFMS/ProducerConsumerServer.pm, lib/PandoraFMS/Server.pm,
lib/PandoraFMS/PredictionServer.pm, lib/PandoraFMS/Core.pm,
lib/PandoraFMS/ReconServer.pm, lib/PandoraFMS/DataServer.pm,
lib/PandoraFMS/NetworkServer.pm, lib/PandoraFMS/WMIServer.pm: Added
to repository. New server code.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1620 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-04-14 21:13:16 +02:00
|
|
|
$valor =~ s/\,/\./g;
|
2009-12-18 14:43:02 +01:00
|
|
|
if (($a % 20) == 0) {
|
|
|
|
print "\r -> ".int($a / ($iterations / 100))."% generated for ($target_name) ";
|
2006-03-27 05:37:27 +02:00
|
|
|
}
|
2009-04-14 Ramon Novoa <rnovoa@artica.es>
* pandora_ctl, pandora_network, pandora_wmi, pandora_plugin,
pandora_prediction, bin/pandora_wmi, bin/pandora_plugin,
bin/pandora_prediction, bin/pandora_snmpconsole, bin/pandora_recon,
bin/pandora_network, pandora_recon, pandora_snmpconsole: Deleted
from repository. Old server code and startup scripts.
* Makefile.PL, pandora_server_installer, lib/PandoraFMS/Config.pm
lib/PandoraFMS/DB.pm, lib/PandoraFMS/Tools.pm, bin/pandora_server,
pandora_package_installer, pandora_server: Updated to work with the
new code, removed unneeded dependencies, fixed some bugs etc.
* lib/PandoraFMS/SNMPServer.pm, lib/PandoraFMS/PluginServer.pm,
lib/PandoraFMS/ProducerConsumerServer.pm, lib/PandoraFMS/Server.pm,
lib/PandoraFMS/PredictionServer.pm, lib/PandoraFMS/Core.pm,
lib/PandoraFMS/ReconServer.pm, lib/PandoraFMS/DataServer.pm,
lib/PandoraFMS/NetworkServer.pm, lib/PandoraFMS/WMIServer.pm: Added
to repository. New server code.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1620 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-04-14 21:13:16 +02:00
|
|
|
pandora_update_agent($pa_config, $timestamp, $target_agent, "none","1.2", $target_interval, $dbh);
|
2006-03-27 05:37:27 +02:00
|
|
|
# print LOG $mysql_date, $target_name, $valor, "\n";
|
2009-04-14 Ramon Novoa <rnovoa@artica.es>
* pandora_ctl, pandora_network, pandora_wmi, pandora_plugin,
pandora_prediction, bin/pandora_wmi, bin/pandora_plugin,
bin/pandora_prediction, bin/pandora_snmpconsole, bin/pandora_recon,
bin/pandora_network, pandora_recon, pandora_snmpconsole: Deleted
from repository. Old server code and startup scripts.
* Makefile.PL, pandora_server_installer, lib/PandoraFMS/Config.pm
lib/PandoraFMS/DB.pm, lib/PandoraFMS/Tools.pm, bin/pandora_server,
pandora_package_installer, pandora_server: Updated to work with the
new code, removed unneeded dependencies, fixed some bugs etc.
* lib/PandoraFMS/SNMPServer.pm, lib/PandoraFMS/PluginServer.pm,
lib/PandoraFMS/ProducerConsumerServer.pm, lib/PandoraFMS/Server.pm,
lib/PandoraFMS/PredictionServer.pm, lib/PandoraFMS/Core.pm,
lib/PandoraFMS/ReconServer.pm, lib/PandoraFMS/DataServer.pm,
lib/PandoraFMS/NetworkServer.pm, lib/PandoraFMS/WMIServer.pm: Added
to repository. New server code.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1620 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-04-14 21:13:16 +02:00
|
|
|
pandora_process_module ($pa_config, $valor, '', $module, '', '', $utimestamp, $dbh);
|
|
|
|
#pandora_writedata($pa_config,$mysql_date,$agent_name,$target_type,$target_name,$valor,0,0,"",$dbh,\$bUpdateDatos);
|
|
|
|
#pandora_writestate ($pa_config,$agent_name,$target_type,$target_name,$valor,100,$dbh,$bUpdateDatos);
|
2006-03-27 05:37:27 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# Generate pseudo-random data for changing drawings
|
|
|
|
if ( $target_name =~ /random/i ){
|
|
|
|
# Random values over line a static line
|
|
|
|
for ($a=1;$a<$iterations;$a++){
|
2009-12-18 14:43:02 +01:00
|
|
|
$valor = rand(15) + rand(15) + rand(15) + rand(15) + rand(15) + rand(15);
|
2006-03-27 05:37:27 +02:00
|
|
|
$valor = sprintf("%.2f", $valor);
|
|
|
|
$valor =~ s/\,/\./g;
|
2009-04-14 Ramon Novoa <rnovoa@artica.es>
* pandora_ctl, pandora_network, pandora_wmi, pandora_plugin,
pandora_prediction, bin/pandora_wmi, bin/pandora_plugin,
bin/pandora_prediction, bin/pandora_snmpconsole, bin/pandora_recon,
bin/pandora_network, pandora_recon, pandora_snmpconsole: Deleted
from repository. Old server code and startup scripts.
* Makefile.PL, pandora_server_installer, lib/PandoraFMS/Config.pm
lib/PandoraFMS/DB.pm, lib/PandoraFMS/Tools.pm, bin/pandora_server,
pandora_package_installer, pandora_server: Updated to work with the
new code, removed unneeded dependencies, fixed some bugs etc.
* lib/PandoraFMS/SNMPServer.pm, lib/PandoraFMS/PluginServer.pm,
lib/PandoraFMS/ProducerConsumerServer.pm, lib/PandoraFMS/Server.pm,
lib/PandoraFMS/PredictionServer.pm, lib/PandoraFMS/Core.pm,
lib/PandoraFMS/ReconServer.pm, lib/PandoraFMS/DataServer.pm,
lib/PandoraFMS/NetworkServer.pm, lib/PandoraFMS/WMIServer.pm: Added
to repository. New server code.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1620 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-04-14 21:13:16 +02:00
|
|
|
$utimestamp += $target_interval;
|
|
|
|
my $timestamp = strftime ("%Y-%m-%d %H:%M:%S", localtime($utimestamp));
|
2006-03-27 05:37:27 +02:00
|
|
|
if ($a % 20 == 0) {
|
2009-12-18 14:43:02 +01:00
|
|
|
print "\r -> ".int($a / ($iterations / 100))."% generated for ($target_name) ";
|
2006-03-27 05:37:27 +02:00
|
|
|
}
|
2009-04-14 Ramon Novoa <rnovoa@artica.es>
* pandora_ctl, pandora_network, pandora_wmi, pandora_plugin,
pandora_prediction, bin/pandora_wmi, bin/pandora_plugin,
bin/pandora_prediction, bin/pandora_snmpconsole, bin/pandora_recon,
bin/pandora_network, pandora_recon, pandora_snmpconsole: Deleted
from repository. Old server code and startup scripts.
* Makefile.PL, pandora_server_installer, lib/PandoraFMS/Config.pm
lib/PandoraFMS/DB.pm, lib/PandoraFMS/Tools.pm, bin/pandora_server,
pandora_package_installer, pandora_server: Updated to work with the
new code, removed unneeded dependencies, fixed some bugs etc.
* lib/PandoraFMS/SNMPServer.pm, lib/PandoraFMS/PluginServer.pm,
lib/PandoraFMS/ProducerConsumerServer.pm, lib/PandoraFMS/Server.pm,
lib/PandoraFMS/PredictionServer.pm, lib/PandoraFMS/Core.pm,
lib/PandoraFMS/ReconServer.pm, lib/PandoraFMS/DataServer.pm,
lib/PandoraFMS/NetworkServer.pm, lib/PandoraFMS/WMIServer.pm: Added
to repository. New server code.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1620 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-04-14 21:13:16 +02:00
|
|
|
pandora_update_agent($pa_config, $timestamp, $target_agent, "none","1.2", $target_interval, $dbh);
|
2006-03-27 05:37:27 +02:00
|
|
|
#print LOG $mysql_date, $target_name, $valor, "\n";
|
2009-04-14 Ramon Novoa <rnovoa@artica.es>
* pandora_ctl, pandora_network, pandora_wmi, pandora_plugin,
pandora_prediction, bin/pandora_wmi, bin/pandora_plugin,
bin/pandora_prediction, bin/pandora_snmpconsole, bin/pandora_recon,
bin/pandora_network, pandora_recon, pandora_snmpconsole: Deleted
from repository. Old server code and startup scripts.
* Makefile.PL, pandora_server_installer, lib/PandoraFMS/Config.pm
lib/PandoraFMS/DB.pm, lib/PandoraFMS/Tools.pm, bin/pandora_server,
pandora_package_installer, pandora_server: Updated to work with the
new code, removed unneeded dependencies, fixed some bugs etc.
* lib/PandoraFMS/SNMPServer.pm, lib/PandoraFMS/PluginServer.pm,
lib/PandoraFMS/ProducerConsumerServer.pm, lib/PandoraFMS/Server.pm,
lib/PandoraFMS/PredictionServer.pm, lib/PandoraFMS/Core.pm,
lib/PandoraFMS/ReconServer.pm, lib/PandoraFMS/DataServer.pm,
lib/PandoraFMS/NetworkServer.pm, lib/PandoraFMS/WMIServer.pm: Added
to repository. New server code.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1620 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-04-14 21:13:16 +02:00
|
|
|
pandora_process_module ($pa_config, $valor, '', $module, '', '', $utimestamp, $dbh);
|
|
|
|
#pandora_writedata($pa_config,$mysql_date,$agent_name,$target_type,$target_name,$valor,0,0,"",$dbh,\$bUpdateDatos);
|
|
|
|
#pandora_writestate ($pa_config,$agent_name,$target_type,$target_name,$valor,100,$dbh,$bUpdateDatos);
|
2006-03-27 05:37:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
# Generate pseudo-random data for boolean data
|
|
|
|
if ( $target_name =~ /boolean/i ){
|
|
|
|
for ($a=1;$a<$iterations;$a++){
|
2009-12-18 14:43:02 +01:00
|
|
|
$valor = rand(50);
|
2006-03-27 05:37:27 +02:00
|
|
|
if ($valor > 2){
|
|
|
|
$valor = 1;
|
|
|
|
} else {
|
|
|
|
$valor = 0;
|
|
|
|
}
|
2009-04-14 Ramon Novoa <rnovoa@artica.es>
* pandora_ctl, pandora_network, pandora_wmi, pandora_plugin,
pandora_prediction, bin/pandora_wmi, bin/pandora_plugin,
bin/pandora_prediction, bin/pandora_snmpconsole, bin/pandora_recon,
bin/pandora_network, pandora_recon, pandora_snmpconsole: Deleted
from repository. Old server code and startup scripts.
* Makefile.PL, pandora_server_installer, lib/PandoraFMS/Config.pm
lib/PandoraFMS/DB.pm, lib/PandoraFMS/Tools.pm, bin/pandora_server,
pandora_package_installer, pandora_server: Updated to work with the
new code, removed unneeded dependencies, fixed some bugs etc.
* lib/PandoraFMS/SNMPServer.pm, lib/PandoraFMS/PluginServer.pm,
lib/PandoraFMS/ProducerConsumerServer.pm, lib/PandoraFMS/Server.pm,
lib/PandoraFMS/PredictionServer.pm, lib/PandoraFMS/Core.pm,
lib/PandoraFMS/ReconServer.pm, lib/PandoraFMS/DataServer.pm,
lib/PandoraFMS/NetworkServer.pm, lib/PandoraFMS/WMIServer.pm: Added
to repository. New server code.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1620 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-04-14 21:13:16 +02:00
|
|
|
$utimestamp += $target_interval;
|
|
|
|
my $timestamp = strftime ("%Y-%m-%d %H:%M:%S", localtime($utimestamp));
|
2006-03-27 05:37:27 +02:00
|
|
|
if ($a % 20 eq 0) {
|
2009-12-18 14:43:02 +01:00
|
|
|
print "\r -> ".int($a / ($iterations / 100))."% generated for ($target_name) ";
|
2006-03-27 05:37:27 +02:00
|
|
|
}
|
2009-04-14 Ramon Novoa <rnovoa@artica.es>
* pandora_ctl, pandora_network, pandora_wmi, pandora_plugin,
pandora_prediction, bin/pandora_wmi, bin/pandora_plugin,
bin/pandora_prediction, bin/pandora_snmpconsole, bin/pandora_recon,
bin/pandora_network, pandora_recon, pandora_snmpconsole: Deleted
from repository. Old server code and startup scripts.
* Makefile.PL, pandora_server_installer, lib/PandoraFMS/Config.pm
lib/PandoraFMS/DB.pm, lib/PandoraFMS/Tools.pm, bin/pandora_server,
pandora_package_installer, pandora_server: Updated to work with the
new code, removed unneeded dependencies, fixed some bugs etc.
* lib/PandoraFMS/SNMPServer.pm, lib/PandoraFMS/PluginServer.pm,
lib/PandoraFMS/ProducerConsumerServer.pm, lib/PandoraFMS/Server.pm,
lib/PandoraFMS/PredictionServer.pm, lib/PandoraFMS/Core.pm,
lib/PandoraFMS/ReconServer.pm, lib/PandoraFMS/DataServer.pm,
lib/PandoraFMS/NetworkServer.pm, lib/PandoraFMS/WMIServer.pm: Added
to repository. New server code.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1620 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-04-14 21:13:16 +02:00
|
|
|
pandora_update_agent($pa_config, $timestamp, $target_agent, "none","1.2", $target_interval, $dbh);
|
2006-03-27 05:37:27 +02:00
|
|
|
#print LOG $mysql_date, $target_name, $valor, "\n";
|
2009-04-14 Ramon Novoa <rnovoa@artica.es>
* pandora_ctl, pandora_network, pandora_wmi, pandora_plugin,
pandora_prediction, bin/pandora_wmi, bin/pandora_plugin,
bin/pandora_prediction, bin/pandora_snmpconsole, bin/pandora_recon,
bin/pandora_network, pandora_recon, pandora_snmpconsole: Deleted
from repository. Old server code and startup scripts.
* Makefile.PL, pandora_server_installer, lib/PandoraFMS/Config.pm
lib/PandoraFMS/DB.pm, lib/PandoraFMS/Tools.pm, bin/pandora_server,
pandora_package_installer, pandora_server: Updated to work with the
new code, removed unneeded dependencies, fixed some bugs etc.
* lib/PandoraFMS/SNMPServer.pm, lib/PandoraFMS/PluginServer.pm,
lib/PandoraFMS/ProducerConsumerServer.pm, lib/PandoraFMS/Server.pm,
lib/PandoraFMS/PredictionServer.pm, lib/PandoraFMS/Core.pm,
lib/PandoraFMS/ReconServer.pm, lib/PandoraFMS/DataServer.pm,
lib/PandoraFMS/NetworkServer.pm, lib/PandoraFMS/WMIServer.pm: Added
to repository. New server code.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1620 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-04-14 21:13:16 +02:00
|
|
|
pandora_process_module ($pa_config, $valor, '', $module, '', '', $utimestamp, $dbh);
|
|
|
|
#pandora_writedata($pa_config,$mysql_date,$agent_name,$target_type,$target_name,$valor,0,0,"",$dbh,\$bUpdateDatos);
|
|
|
|
#pandora_writestate ($pa_config,$agent_name,$target_type,$target_name,$valor,$valor,$dbh,$bUpdateDatos);
|
2006-03-27 05:37:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2008-06-19 02:14:17 +02:00
|
|
|
|
|
|
|
# Generate pseudo-random data for boolean data
|
|
|
|
if ( $target_name =~ /text/i ){
|
|
|
|
for ($a=1;$a<$iterations;$a++){
|
|
|
|
$valor = pandora_trash_ascii (rand(100)+50);
|
2009-04-14 Ramon Novoa <rnovoa@artica.es>
* pandora_ctl, pandora_network, pandora_wmi, pandora_plugin,
pandora_prediction, bin/pandora_wmi, bin/pandora_plugin,
bin/pandora_prediction, bin/pandora_snmpconsole, bin/pandora_recon,
bin/pandora_network, pandora_recon, pandora_snmpconsole: Deleted
from repository. Old server code and startup scripts.
* Makefile.PL, pandora_server_installer, lib/PandoraFMS/Config.pm
lib/PandoraFMS/DB.pm, lib/PandoraFMS/Tools.pm, bin/pandora_server,
pandora_package_installer, pandora_server: Updated to work with the
new code, removed unneeded dependencies, fixed some bugs etc.
* lib/PandoraFMS/SNMPServer.pm, lib/PandoraFMS/PluginServer.pm,
lib/PandoraFMS/ProducerConsumerServer.pm, lib/PandoraFMS/Server.pm,
lib/PandoraFMS/PredictionServer.pm, lib/PandoraFMS/Core.pm,
lib/PandoraFMS/ReconServer.pm, lib/PandoraFMS/DataServer.pm,
lib/PandoraFMS/NetworkServer.pm, lib/PandoraFMS/WMIServer.pm: Added
to repository. New server code.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1620 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-04-14 21:13:16 +02:00
|
|
|
$utimestamp += $target_interval;
|
|
|
|
my $timestamp = strftime ("%Y-%m-%d %H:%M:%S", localtime($utimestamp));
|
2008-06-19 02:14:17 +02:00
|
|
|
if ($a % 20 eq 0) {
|
2009-12-18 14:43:02 +01:00
|
|
|
print "\r -> ".int($a / ($iterations / 100))."% generated for ($target_name) ";
|
2008-06-19 02:14:17 +02:00
|
|
|
}
|
2009-04-14 Ramon Novoa <rnovoa@artica.es>
* pandora_ctl, pandora_network, pandora_wmi, pandora_plugin,
pandora_prediction, bin/pandora_wmi, bin/pandora_plugin,
bin/pandora_prediction, bin/pandora_snmpconsole, bin/pandora_recon,
bin/pandora_network, pandora_recon, pandora_snmpconsole: Deleted
from repository. Old server code and startup scripts.
* Makefile.PL, pandora_server_installer, lib/PandoraFMS/Config.pm
lib/PandoraFMS/DB.pm, lib/PandoraFMS/Tools.pm, bin/pandora_server,
pandora_package_installer, pandora_server: Updated to work with the
new code, removed unneeded dependencies, fixed some bugs etc.
* lib/PandoraFMS/SNMPServer.pm, lib/PandoraFMS/PluginServer.pm,
lib/PandoraFMS/ProducerConsumerServer.pm, lib/PandoraFMS/Server.pm,
lib/PandoraFMS/PredictionServer.pm, lib/PandoraFMS/Core.pm,
lib/PandoraFMS/ReconServer.pm, lib/PandoraFMS/DataServer.pm,
lib/PandoraFMS/NetworkServer.pm, lib/PandoraFMS/WMIServer.pm: Added
to repository. New server code.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1620 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-04-14 21:13:16 +02:00
|
|
|
pandora_update_agent($pa_config, $timestamp, $target_agent, "none","1.2", $target_interval, $dbh);
|
2008-06-19 02:14:17 +02:00
|
|
|
#print LOG $mysql_date, $target_name, $valor, "\n";
|
2009-04-14 Ramon Novoa <rnovoa@artica.es>
* pandora_ctl, pandora_network, pandora_wmi, pandora_plugin,
pandora_prediction, bin/pandora_wmi, bin/pandora_plugin,
bin/pandora_prediction, bin/pandora_snmpconsole, bin/pandora_recon,
bin/pandora_network, pandora_recon, pandora_snmpconsole: Deleted
from repository. Old server code and startup scripts.
* Makefile.PL, pandora_server_installer, lib/PandoraFMS/Config.pm
lib/PandoraFMS/DB.pm, lib/PandoraFMS/Tools.pm, bin/pandora_server,
pandora_package_installer, pandora_server: Updated to work with the
new code, removed unneeded dependencies, fixed some bugs etc.
* lib/PandoraFMS/SNMPServer.pm, lib/PandoraFMS/PluginServer.pm,
lib/PandoraFMS/ProducerConsumerServer.pm, lib/PandoraFMS/Server.pm,
lib/PandoraFMS/PredictionServer.pm, lib/PandoraFMS/Core.pm,
lib/PandoraFMS/ReconServer.pm, lib/PandoraFMS/DataServer.pm,
lib/PandoraFMS/NetworkServer.pm, lib/PandoraFMS/WMIServer.pm: Added
to repository. New server code.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1620 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-04-14 21:13:16 +02:00
|
|
|
pandora_process_module ($pa_config, $valor, '', $module, '', '', $utimestamp, $dbh);
|
|
|
|
#pandora_writedata($pa_config,$mysql_date,$agent_name,$target_type,$target_name,$valor,0,0,"",$dbh,\$bUpdateDatos);
|
|
|
|
#pandora_writestate ($pa_config,$agent_name,$target_type,$target_name,$valor,100,$dbh,$bUpdateDatos);
|
2008-06-19 02:14:17 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-03-27 05:37:27 +02:00
|
|
|
close (LOG);
|
|
|
|
print "\n";
|
|
|
|
}
|