mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-27 15:54:29 +02:00
2009-04-17 Ramon Novoa <rnovoa@artica.es>
* lib/PandoraFMS/Core.pm, lib/PandoraFMS/DataServer.pm: Properly set module interval when auto-creating modules. * lib/PandoraFMS/NetworkServer.pm: Disabled error messages from snmpget. The logs where flooded with timeout messages. * util/pandora_db.pl: Updated to work with the new code. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1626 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
b9305f698b
commit
c53b323c9c
@ -1,3 +1,13 @@
|
|||||||
|
2009-04-17 Ramon Novoa <rnovoa@artica.es>
|
||||||
|
|
||||||
|
* lib/PandoraFMS/Core.pm, lib/PandoraFMS/DataServer.pm: Properly set
|
||||||
|
module interval when auto-creating modules.
|
||||||
|
|
||||||
|
* lib/PandoraFMS/NetworkServer.pm: Disabled error messages from
|
||||||
|
snmpget. The logs where flooded with timeout messages.
|
||||||
|
|
||||||
|
* util/pandora_db.pl: Updated to work with the new code.
|
||||||
|
|
||||||
2009-04-17 Ramon Novoa <rnovoa@artica.es>
|
2009-04-17 Ramon Novoa <rnovoa@artica.es>
|
||||||
|
|
||||||
* lib/PandoraFMS/PluginServer.pm, lib/PandoraFMS/PredictionServer.pm,
|
* lib/PandoraFMS/PluginServer.pm, lib/PandoraFMS/PredictionServer.pm,
|
||||||
|
@ -705,17 +705,17 @@ sub pandora_audit ($$$$$) {
|
|||||||
#Create a new entry in tagente_modulo and the corresponding entry in
|
#Create a new entry in tagente_modulo and the corresponding entry in
|
||||||
#tagente_estado.
|
#tagente_estado.
|
||||||
##########################################################################
|
##########################################################################
|
||||||
sub pandora_create_module ($$$$$$$) {
|
sub pandora_create_module ($$$$$$$$) {
|
||||||
my ($agent_id, $module_type_id, $module_name, $max,
|
my ($agent_id, $module_type_id, $module_name, $max,
|
||||||
$min, $description, $dbh) = @_;
|
$min, $description, $interval, $dbh) = @_;
|
||||||
|
|
||||||
# Provide some default values
|
# Provide some default values
|
||||||
$max = 0 if ($max eq '');
|
$max = 0 if ($max eq '');
|
||||||
$min = 0 if ($min eq '');
|
$min = 0 if ($min eq '');
|
||||||
$description = 'N/A' if ($description eq '');
|
$description = 'N/A' if ($description eq '');
|
||||||
|
|
||||||
my $module_id = db_insert($dbh, 'INSERT INTO tagente_modulo (`id_agente`, `id_tipo_modulo`, `nombre`, `max`, `min`, `descripcion`, `id_modulo`)
|
my $module_id = db_insert($dbh, 'INSERT INTO tagente_modulo (`id_agente`, `id_tipo_modulo`, `nombre`, `max`, `min`, `descripcion`, `module_interval`, `id_modulo`)
|
||||||
VALUES (?, ?, ?, ?, ?, ?, 1)', $agent_id, $module_type_id, $module_name, $max, $min, $description);
|
VALUES (?, ?, ?, ?, ?, ?, ?, 1)', $agent_id, $module_type_id, $module_name, $max, $min, $description, $interval);
|
||||||
db_do ($dbh, 'INSERT INTO tagente_estado (`id_agente_modulo`) VALUES (?)', $module_id);
|
db_do ($dbh, 'INSERT INTO tagente_estado (`id_agente_modulo`) VALUES (?)', $module_id);
|
||||||
return $module_id;
|
return $module_id;
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ sub process_xml_data {
|
|||||||
# Single data
|
# Single data
|
||||||
if (! defined ($module_data->{'datalist'})) {
|
if (! defined ($module_data->{'datalist'})) {
|
||||||
my $data_timestamp = (defined ($module_data->{'timestamp'})) ? $module_data->{'timestamp'}->[0] : $timestamp;
|
my $data_timestamp = (defined ($module_data->{'timestamp'})) ? $module_data->{'timestamp'}->[0] : $timestamp;
|
||||||
process_module_data ($pa_config, $module_data, $agent_name, $module_name, $module_type, $data_timestamp, $dbh);
|
process_module_data ($pa_config, $module_data, $agent_name, $module_name, $module_type, $interval, $data_timestamp, $dbh);
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,8 +213,9 @@ sub process_xml_data {
|
|||||||
##########################################################################
|
##########################################################################
|
||||||
# Process module data, creating module if necessary.
|
# Process module data, creating module if necessary.
|
||||||
##########################################################################
|
##########################################################################
|
||||||
sub process_module_data ($$$$$$$) {
|
sub process_module_data ($$$$$$$$) {
|
||||||
my ($pa_config, $data, $agent_name, $module_name, $module_type, $timestamp, $dbh) = @_;
|
my ($pa_config, $data, $agent_name, $module_name,
|
||||||
|
$module_type, $interval, $timestamp, $dbh) = @_;
|
||||||
|
|
||||||
my $agent = get_db_single_row ($dbh, 'SELECT * FROM tagente WHERE nombre = ?', $agent_name);
|
my $agent = get_db_single_row ($dbh, 'SELECT * FROM tagente WHERE nombre = ?', $agent_name);
|
||||||
return unless defined ($agent);
|
return unless defined ($agent);
|
||||||
@ -229,7 +230,7 @@ sub process_module_data ($$$$$$$) {
|
|||||||
$min = $data->{'min'}->[0] if (defined ($data->{'min'}));
|
$min = $data->{'min'}->[0] if (defined ($data->{'min'}));
|
||||||
$description = $data->{'description'}->[0] if (defined ($data->{'description'}));
|
$description = $data->{'description'}->[0] if (defined ($data->{'description'}));
|
||||||
pandora_create_module ($agent->{'id_agente'}, $module_id, $module_name,
|
pandora_create_module ($agent->{'id_agente'}, $module_id, $module_name,
|
||||||
$max, $min, $description, $dbh);
|
$max, $min, $description, $interval, $dbh);
|
||||||
$module = get_db_single_row ($dbh, 'SELECT * FROM tagente_modulo WHERE id_agente = ? AND nombre = ?', $agent->{'id_agente'}, $module_name);
|
$module = get_db_single_row ($dbh, 'SELECT * FROM tagente_modulo WHERE id_agente = ? AND nombre = ?', $agent->{'id_agente'}, $module_name);
|
||||||
return unless defined $module;
|
return unless defined $module;
|
||||||
}
|
}
|
||||||
|
@ -335,7 +335,7 @@ sub pandora_query_snmp (%$$$$$) {
|
|||||||
|
|
||||||
$_[5] = 0;
|
$_[5] = 0;
|
||||||
my $snmpget_cmd = $pa_config->{"snmpget"};
|
my $snmpget_cmd = $pa_config->{"snmpget"};
|
||||||
my $output = `$snmpget_cmd -v $snmp_version -r $snmp_retries -t $snmp_timeout -OUevqt -c $snmp_community $snmp_target $snmp_oid`;
|
my $output = `$snmpget_cmd -v $snmp_version -r $snmp_retries -t $snmp_timeout -OUevqt -c $snmp_community $snmp_target $snmp_oid 2>/dev/null`;
|
||||||
if ($output eq ""){
|
if ($output eq ""){
|
||||||
$_[5] = 1;
|
$_[5] = 1;
|
||||||
}
|
}
|
||||||
|
@ -117,10 +117,10 @@ sub pandora_purgedb {
|
|||||||
$dbh->do ("DELETE FROM tagente_modulo WHERE delete_pending = 1");
|
$dbh->do ("DELETE FROM tagente_modulo WHERE delete_pending = 1");
|
||||||
|
|
||||||
print "[PURGE] Delete old session data \n";
|
print "[PURGE] Delete old session data \n";
|
||||||
db_do ("DELETE FROM tsesion WHERE utimestamp < $ulimit_timestamp", $dbh);
|
$dbh->do ("DELETE FROM tsesion WHERE utimestamp < $ulimit_timestamp");
|
||||||
|
|
||||||
print "[PURGE] Delete old data from SNMP Traps \n";
|
print "[PURGE] Delete old data from SNMP Traps \n";
|
||||||
db_do ("DELETE FROM ttrap WHERE timestamp < '$limit_timestamp'", $dbh);
|
$dbh->do ("DELETE FROM ttrap WHERE timestamp < '$limit_timestamp'");
|
||||||
|
|
||||||
$dbh->disconnect();
|
$dbh->disconnect();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user