mirror of
https://github.com/librenms/librenms.git
synced 2024-09-21 10:28:13 +00:00
poller overhaul. system/os split into modules. each device is wrapped in poll_device(). this probably breaks everything for you. adios, little datums.
git-svn-id: http://www.observium.org/svn/observer/trunk@2231 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
parent
c5bac776db
commit
b11ad816aa
@ -252,11 +252,11 @@ function set_dev_attrib($device, $attrib_type, $attrib_value)
|
||||
function get_dev_attribs($device)
|
||||
{
|
||||
$attribs = array();
|
||||
$sql = "SELECT attrib_type, attrib_value FROM devices_attribs WHERE `device_id` = '" . mres($device['device_id']) . "'";
|
||||
$data = mysql_query($sql);
|
||||
while($entry = mysql_fetch_array($data))
|
||||
$sql = "SELECT * FROM devices_attribs WHERE `device_id` = '" . mres($device) . "'";
|
||||
$query = mysql_query($sql);
|
||||
while($entry = mysql_fetch_assoc($query))
|
||||
{
|
||||
$attribs[$entry['attrib_type']] = $attribs['attrib_value'];
|
||||
$attribs[$entry['attrib_type']] = $entry['attrib_value'];
|
||||
}
|
||||
return $attribs;
|
||||
}
|
||||
|
19
includes/polling/os.inc.php
Normal file
19
includes/polling/os.inc.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
if (is_file($config['install_dir'] . "/includes/polling/os/".$device['os'].".inc.php"))
|
||||
{
|
||||
/// OS Specific
|
||||
include($config['install_dir'] . "/includes/polling/os/".$device['os'].".inc.php");
|
||||
}
|
||||
elseif ($device['os_group'] && is_file($config['install_dir'] . "/includes/polling/os/".$device['os_group'].".inc.php"))
|
||||
{
|
||||
/// OS Group Specific
|
||||
include($config['install_dir'] . "/includes/polling/os/".$device['os_group'].".inc.php");
|
||||
}
|
||||
else
|
||||
{
|
||||
echo("Generic :(\n");
|
||||
}
|
||||
|
||||
|
||||
?>
|
@ -9,7 +9,7 @@ if ($port_stats[$port['ifIndex']] && $port['ifType'] == "ethernetCsmacd"
|
||||
$old_rrdfile = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("etherlike-".$port['ifIndex'].".rrd");
|
||||
$rrdfile = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("port-".$port['ifIndex']."-dot3.rrd");
|
||||
|
||||
$rrd_create .= "RRA:AVERAGE:0.5:1:600 RRA:AVERAGE:0.5:6:700 RRA:AVERAGE:0.5:24:775 RRA:AVERAGE:0.5:288:797 RRA:MAX:0.5:1:600 \
|
||||
$rrd_create = "RRA:AVERAGE:0.5:1:600 RRA:AVERAGE:0.5:6:700 RRA:AVERAGE:0.5:24:775 RRA:AVERAGE:0.5:288:797 RRA:MAX:0.5:1:600 \
|
||||
RRA:MAX:0.5:6:700 RRA:MAX:0.5:24:775 RRA:MAX:0.5:288:797";
|
||||
|
||||
if (!file_exists($rrdfile))
|
||||
@ -40,4 +40,4 @@ if ($port_stats[$port['ifIndex']] && $port['ifType'] == "ethernetCsmacd"
|
||||
echo("EtherLike ");
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
131
includes/polling/system.inc.php
Executable file
131
includes/polling/system.inc.php
Executable file
@ -0,0 +1,131 @@
|
||||
<?php
|
||||
|
||||
/* Observium Network Management and Monitoring System
|
||||
* Copyright (C) 2006-2011, Observium Developers - http://www.observium.org
|
||||
*
|
||||
* 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, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* See COPYING for more details.
|
||||
*/
|
||||
|
||||
unset($poll_device);
|
||||
|
||||
$snmpdata = snmp_get_multi($device, "sysUpTime.0 sysLocation.0 sysContact.0 sysName.0", "-OQUs", "SNMPv2-MIB");
|
||||
foreach (array_keys($snmpdata[0]) as $key) { $poll_device[$key] = $snmpdata[0][$key]; }
|
||||
|
||||
$poll_device['sysDescr'] = snmp_get($device, "sysDescr.0", "-Oqv", "SNMPv2-MIB");
|
||||
|
||||
$poll_device['sysName'] = strtolower($poll_device['sysName']);
|
||||
|
||||
$hrSystemUptime = snmp_get($device, "hrSystemUptime.0", "-Oqv", "HOST-RESOURCES-MIB");
|
||||
$sysObjectID = snmp_get($device, "sysObjectID.0", "-Oqvn");
|
||||
|
||||
if ($hrSystemUptime != "" && !strpos($hrSystemUptime, "No") && ($device['os'] != "windows"))
|
||||
{
|
||||
echo("Using hrSystemUptime\n");
|
||||
$agent_uptime = $poll_device['uptime']; ## Move uptime into agent_uptime
|
||||
#HOST-RESOURCES-MIB::hrSystemUptime.0 = Timeticks: (63050465) 7 days, 7:08:24.65
|
||||
$hrSystemUptime = str_replace("(", "", $hrSystemUptime);
|
||||
$hrSystemUptime = str_replace(")", "", $hrSystemUptime);
|
||||
list($days,$hours, $mins, $secs) = explode(":", $hrSystemUptime);
|
||||
list($secs, $microsecs) = explode(".", $secs);
|
||||
$hours = $hours + ($days * 24);
|
||||
$mins = $mins + ($hours * 60);
|
||||
$secs = $secs + ($mins * 60);
|
||||
$poll_device['uptime'] = $secs;
|
||||
} else {
|
||||
echo("Using Agent Uptime\n");
|
||||
#SNMPv2-MIB::sysUpTime.0 = Timeticks: (2542831) 7:03:48.31
|
||||
$sysUpTime = str_replace("(", "", $sysUpTime);
|
||||
$sysUpTime = str_replace(")", "", $sysUpTime);
|
||||
list($days, $hours, $mins, $secs) = explode(":", $sysUpTime);
|
||||
list($secs, $microsecs) = explode(".", $secs);
|
||||
$hours = $hours + ($days * 24);
|
||||
$mins = $mins + ($hours * 60);
|
||||
$secs = $secs + ($mins * 60);
|
||||
$poll_device['uptime'] = $secs;
|
||||
}
|
||||
|
||||
if (is_numeric($poll_device['uptime']))
|
||||
{
|
||||
if ($poll_device['uptime'] < $device['uptime'])
|
||||
{
|
||||
notify($device,"Device rebooted: " . $device['hostname'], "Device Rebooted : " . $device['hostname'] . " " . formatUptime($poll_device['uptime']) . " ago.");
|
||||
log_event('Device rebooted after '.formatUptime($device['uptime']), $device, 'reboot', $device['uptime']);
|
||||
}
|
||||
|
||||
$uptime_rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/uptime.rrd";
|
||||
|
||||
if (!is_file($uptime_rrd))
|
||||
{
|
||||
rrdtool_create ($uptime_rrd, "DS:uptime:GAUGE:600:0:U RRA:AVERAGE:0.5:1:600 RRA:AVERAGE:0.5:6:700 RRA:AVERAGE:0.5:24:775 RRA:AVERAGE:0.5:288:797");
|
||||
}
|
||||
rrdtool_update($uptime_rrd, "N:".$poll_device['uptime']);
|
||||
|
||||
$graphs['uptime'] = TRUE;
|
||||
|
||||
echo("Uptime: ".formatUptime($poll_device['uptime'])."\n");
|
||||
|
||||
$device['db_update'] .= ", `uptime` = '".mres($poll_device['uptime'])."'";
|
||||
}
|
||||
|
||||
echo("Hardware: ".$poll_device['hardware']." Version: ".$poll_device['version']." Features: ".$poll_device['features']."\n");
|
||||
|
||||
$poll_device['sysLocation'] = str_replace("\"","", $poll_device['sysLocation']);
|
||||
$poll_device['sysContact'] = str_replace("\"","", $poll_device['sysContact']);
|
||||
|
||||
if ($poll_device['serial'] && $poll_device['serial'] != $device['serial'])
|
||||
{
|
||||
$device['db_update'] .= ", `serial` = '".mres($poll_device['serial'])."'";
|
||||
log_event("Serial -> ".$poll_device['serial'], $device, 'system');
|
||||
}
|
||||
|
||||
if ($poll_device['sysContact'] && $poll_device['sysContact'] != $device['sysContact'])
|
||||
{
|
||||
$device['db_update'] .= ", `sysContact` = '".mres($poll_device['sysContact'])."'";
|
||||
log_event("Contact -> ".$poll_device['sysContact'], $device, 'system');
|
||||
}
|
||||
|
||||
if ($poll_device['sysName'] && $poll_device['sysName'] != $device['sysName'])
|
||||
{
|
||||
$device['db_update'] .= ", `sysName` = '".mres($poll_device['sysName'])."'";
|
||||
log_event("sysName -> ".$poll_device['sysName'], $device, 'system');
|
||||
}
|
||||
|
||||
if ($poll_device['sysDescr'] && $poll_device['sysDescr'] != $device['sysDescr'])
|
||||
{
|
||||
$device['db_update'] .= ", `sysDescr` = '".mres($poll_device['sysDescr'])."'";
|
||||
log_event("sysDescr -> ".$poll_device['sysDescr'], $device, 'system');
|
||||
}
|
||||
|
||||
if ($poll_device['sysLocation'] && $device['location'] != $poll_device['sysLocation'])
|
||||
{
|
||||
if (!get_dev_attrib($device,'override_sysLocation_bool'))
|
||||
{
|
||||
$device['db_update'] .= ", `location` = '".mres($poll_device['sysLocation'])."'";
|
||||
}
|
||||
log_event("Location -> ".$poll_device['sysLocation'], $device, 'system');
|
||||
}
|
||||
|
||||
if ($poll_device['version'] && $device['version'] != $poll_device['version'])
|
||||
{
|
||||
$device['db_update'] .= ", `version` = '".mres($poll_device['version'])."'";
|
||||
log_event("OS Version -> ".$poll_device['version'], $device, 'system');
|
||||
}
|
||||
|
||||
if ($poll_device['features'] != $device['features'])
|
||||
{
|
||||
$device['db_update'] .= ", `features` = '".mres($poll_device['features'])."'";
|
||||
log_event("OS Features -> ".$poll_device['features'], $device, 'system');
|
||||
}
|
||||
|
||||
if ($poll_device['hardware'] && $poll_device['hardware'] != $device['hardware'])
|
||||
{
|
||||
$device['db_update'] .= ", `hardware` = '".mres($poll_device['hardware'])."'";
|
||||
log_event("Hardware -> ".$poll_device['hardware'], $device, 'system');
|
||||
}
|
||||
|
||||
?>
|
8
includes/polling/test.inc.php
Executable file
8
includes/polling/test.inc.php
Executable file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
print_r(snmpwalk_cache_oid ($device, "system", array()));
|
||||
|
||||
print_r(snmp_cache_oid ("system", $device, array()));
|
||||
|
||||
|
||||
?>
|
@ -10,6 +10,8 @@
|
||||
## List of poller modules. Need to be in the array to be
|
||||
## considered for execution.
|
||||
|
||||
#$config['poller_modules']['system'] = 1;
|
||||
#$config['poller_modules']['os'] = 1;
|
||||
$config['poller_modules']['ipmi'] = 1;
|
||||
$config['poller_modules']['sensors'] = 1;
|
||||
$config['poller_modules']['processors'] = 1;
|
||||
|
235
poller.php
235
poller.php
@ -99,6 +99,15 @@ while ($device = mysql_fetch_assoc($device_query))
|
||||
{
|
||||
$device = mysql_fetch_assoc(mysql_query("SELECT * FROM `devices` WHERE `device_id` = '".$device['device_id']."'"));
|
||||
|
||||
poll_device($device, $options);
|
||||
|
||||
}
|
||||
|
||||
|
||||
function poll_device($device, $options) {
|
||||
|
||||
global $config;
|
||||
|
||||
$status = 0; unset($array);
|
||||
$device_start = utime(); // Start counting device poll time
|
||||
|
||||
@ -110,8 +119,7 @@ while ($device = mysql_fetch_assoc($device_query))
|
||||
}
|
||||
echo("\n");
|
||||
|
||||
unset($poll_update); unset($poll_update_query); unset($poll_separator); unset($version); unset($uptime); unset($features);
|
||||
unset($sysLocation); unset($hardware); unset($sysDescr); unset($sysContact); unset($sysName); unset($serial);
|
||||
unset($poll_update); unset($poll_update_query); unset($poll_separator);
|
||||
|
||||
$host_rrd = $config['rrd_dir'] . "/" . $device['hostname'];
|
||||
if (!is_dir($host_rrd)) { mkdir($host_rrd); echo("Created directory : $host_rrd\n"); }
|
||||
@ -147,88 +155,6 @@ while ($device = mysql_fetch_assoc($device_query))
|
||||
$graphs = array();
|
||||
$oldgraphs = array();
|
||||
|
||||
$snmpdata = snmp_get_multi($device, "sysUpTime.0 sysLocation.0 sysContact.0 sysName.0", "-OQUs", "SNMPv2-MIB");
|
||||
foreach (array_keys($snmpdata[0]) as $key) { $$key = $snmpdata[0][$key]; }
|
||||
|
||||
$sysDescr = snmp_get($device, "sysDescr.0", "-Oqv", "SNMPv2-MIB");
|
||||
|
||||
$sysName = strtolower($sysName);
|
||||
|
||||
$hrSystemUptime = snmp_get($device, "hrSystemUptime.0", "-Oqv", "HOST-RESOURCES-MIB");
|
||||
$sysObjectID = snmp_get($device, "sysObjectID.0", "-Oqvn");
|
||||
|
||||
# echo("UPTIMES: ".$hrSystemUptime."|".$sysUpTime."]");
|
||||
|
||||
if ($hrSystemUptime != "" && !strpos($hrSystemUptime, "No") && ($device['os'] != "windows"))
|
||||
{
|
||||
echo("Using hrSystemUptime\n");
|
||||
$agent_uptime = $uptime; ## Move uptime into agent_uptime
|
||||
#HOST-RESOURCES-MIB::hrSystemUptime.0 = Timeticks: (63050465) 7 days, 7:08:24.65
|
||||
$hrSystemUptime = str_replace("(", "", $hrSystemUptime);
|
||||
$hrSystemUptime = str_replace(")", "", $hrSystemUptime);
|
||||
list($days,$hours, $mins, $secs) = explode(":", $hrSystemUptime);
|
||||
list($secs, $microsecs) = explode(".", $secs);
|
||||
$hours = $hours + ($days * 24);
|
||||
$mins = $mins + ($hours * 60);
|
||||
$secs = $secs + ($mins * 60);
|
||||
$uptime = $secs;
|
||||
} else {
|
||||
echo("Using Agent Uptime\n");
|
||||
#SNMPv2-MIB::sysUpTime.0 = Timeticks: (2542831) 7:03:48.31
|
||||
$sysUpTime = str_replace("(", "", $sysUpTime);
|
||||
$sysUpTime = str_replace(")", "", $sysUpTime);
|
||||
list($days, $hours, $mins, $secs) = explode(":", $sysUpTime);
|
||||
list($secs, $microsecs) = explode(".", $secs);
|
||||
$hours = $hours + ($days * 24);
|
||||
$mins = $mins + ($hours * 60);
|
||||
$secs = $secs + ($mins * 60);
|
||||
$uptime = $secs;
|
||||
}
|
||||
|
||||
if (is_numeric($uptime))
|
||||
{
|
||||
if ($uptime < $device['uptime'])
|
||||
{
|
||||
notify($device,"Device rebooted: " . $device['hostname'], "Device Rebooted : " . $device['hostname'] . " " . formatUptime($uptime) . " ago.");
|
||||
log_event('Device rebooted after '.formatUptime($device['uptime']), $device, 'reboot', $device['uptime']);
|
||||
}
|
||||
|
||||
$uptimerrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/uptime.rrd";
|
||||
|
||||
if (!is_file($uptimerrd))
|
||||
{
|
||||
rrdtool_create ($uptimerrd, "DS:uptime:GAUGE:600:0:U RRA:AVERAGE:0.5:1:600 RRA:AVERAGE:0.5:6:700 RRA:AVERAGE:0.5:24:775 RRA:AVERAGE:0.5:288:797");
|
||||
}
|
||||
rrdtool_update($uptimerrd, "N:$uptime");
|
||||
|
||||
$graphs['uptime'] = TRUE;
|
||||
|
||||
echo("Uptime: ".formatUptime($uptime)."\n");
|
||||
|
||||
$poll_update .= $poll_separator . "`uptime` = '$uptime'";
|
||||
$poll_separator = ", ";
|
||||
}
|
||||
|
||||
if (is_file($config['install_dir'] . "/includes/polling/os/".$device['os'].".inc.php"))
|
||||
{
|
||||
/// OS Specific
|
||||
include($config['install_dir'] . "/includes/polling/os/".$device['os'].".inc.php");
|
||||
}
|
||||
elseif ($device['os_group'] && is_file($config['install_dir'] . "/includes/polling/os/".$device['os_group'].".inc.php"))
|
||||
{
|
||||
/// OS Group Specific
|
||||
include($config['install_dir'] . "/includes/polling/os/".$device['os_group'].".inc.php");
|
||||
}
|
||||
else
|
||||
{
|
||||
echo("Generic :(\n");
|
||||
}
|
||||
|
||||
echo("Hardware: ".$hardware." Version: ".$version." Features: ".$features."\n");
|
||||
|
||||
$sysLocation = str_replace("\"","", $sysLocation);
|
||||
$sysContact = str_replace("\"","", $sysContact);
|
||||
|
||||
if ($options['m'])
|
||||
{
|
||||
if (is_file("includes/polling/".$options['m'].".inc.php"))
|
||||
@ -245,133 +171,44 @@ while ($device = mysql_fetch_assoc($device_query))
|
||||
}
|
||||
}
|
||||
|
||||
unset($update);
|
||||
unset($seperator);
|
||||
$device_end = utime(); $device_run = $device_end - $device_start; $device_time = substr($device_run, 0, 5);
|
||||
$device['db_update'] = " `last_polled` = NOW() " . $device['db_update'];
|
||||
$device['db_update'] .= ", `last_polled_timetaken` = '$device_time'";
|
||||
#echo("$device_end - $device_start; $device_time $device_run");
|
||||
echo("Polled in $device_time seconds\n");
|
||||
|
||||
if ($serial && $serial != $device['serial'])
|
||||
$device['db_update_query'] = "UPDATE `devices` SET ";
|
||||
$device['db_update_query'] .= $device['db_update'];
|
||||
$device['db_update_query'] .= " WHERE `device_id` = '" . $device['device_id'] . "'";
|
||||
if ($debug) { echo("Updating " . $device['hostname'] . " - ".$device['db_update_query']." \n"); }
|
||||
if (!mysql_query($device['db_update_query']))
|
||||
{
|
||||
$poll_update .= $poll_separator . "`serial` = '".mres($serial)."'";
|
||||
$poll_separator = ", ";
|
||||
log_event("Serial -> $serial", $device, 'system');
|
||||
echo("ERROR: " . mysql_error() . "\nSQL: ".$device['db_update_query']."\n");
|
||||
}
|
||||
if (mysql_affected_rows() == "1") { echo("UPDATED!\n"); } else { echo("NOT UPDATED!\n"); }
|
||||
|
||||
if ($sysContact && $sysContact != $device['sysContact'])
|
||||
{
|
||||
$poll_update .= $poll_separator . "`sysContact` = '".mres($sysContact)."'";
|
||||
$poll_separator = ", ";
|
||||
log_event("Contact -> $sysContact", $device, 'system');
|
||||
}
|
||||
|
||||
if ($sysName && $sysName != $device['sysName'])
|
||||
{
|
||||
$poll_update .= $poll_separator . "`sysName` = '".mres($sysName)."'";
|
||||
$poll_separator = ", ";
|
||||
log_event("sysName -> $sysName", $device, 'system');
|
||||
}
|
||||
|
||||
if ($sysDescr && $sysDescr != $device['sysDescr'])
|
||||
{
|
||||
$poll_update .= $poll_separator . "`sysDescr` = '".mres($sysDescr)."'";
|
||||
$poll_separator = ", ";
|
||||
log_event("sysDescr -> $sysDescr", $device, 'system');
|
||||
}
|
||||
|
||||
if ($sysLocation && $device['location'] != $sysLocation)
|
||||
{
|
||||
if (!get_dev_attrib($device,'override_sysLocation_bool'))
|
||||
{
|
||||
$poll_update .= $poll_separator . "`location` = '".mres($sysLocation)."'";
|
||||
$poll_separator = ", ";
|
||||
}
|
||||
log_event("Location -> $sysLocation", $device, 'system');
|
||||
}
|
||||
|
||||
if ($version && $device['version'] != $version)
|
||||
{
|
||||
$poll_update .= $poll_separator . "`version` = '".mres($version)."'";
|
||||
$poll_separator = ", ";
|
||||
log_event("OS Version -> $version", $device, 'system');
|
||||
}
|
||||
|
||||
if ($features != $device['features'])
|
||||
{
|
||||
$poll_update .= $poll_separator . "`features` = '".mres($features)."'";
|
||||
$poll_separator = ", ";
|
||||
log_event("OS Features -> $features", $device, 'system');
|
||||
}
|
||||
|
||||
if ($hardware && $hardware != $device['hardware'])
|
||||
{
|
||||
$poll_update .= $poll_separator . "`hardware` = '".mres($hardware)."'";
|
||||
$poll_separator = ", ";
|
||||
log_event("Hardware -> $hardware", $device, 'system');
|
||||
}
|
||||
|
||||
$poll_update .= $poll_separator . "`last_polled` = NOW()";
|
||||
$poll_separator = ", ";
|
||||
$polled_devices++;
|
||||
echo("\n");
|
||||
|
||||
unset($storage_cache); // Clear cache of hrStorage ** MAYBE FIXME? **
|
||||
unset($cache); // Clear cache (unify all things here?)
|
||||
}
|
||||
|
||||
## FIXME EVENTLOGGING
|
||||
### This code cycles through the graphs already known in the database and the ones we've defined as being polled here
|
||||
### If there any don't match, they're added/deleted from the database.
|
||||
### Ideally we should hold graphs for xx days/weeks/polls so that we don't needlessly hide information.
|
||||
|
||||
$query = mysql_query("SELECT `graph` FROM `device_graphs` WHERE `device_id` = '".$device['device_id']."'");
|
||||
while ($graph = mysql_fetch_assoc($query))
|
||||
{
|
||||
if (!isset($graphs[$graph["graph"]]))
|
||||
{
|
||||
mysql_query("DELETE FROM `device_graphs` WHERE `device_id` = '".$device['device_id']."' AND `graph` = '".$graph["graph"]."'");
|
||||
} else {
|
||||
$oldgraphs[$graph["graph"]] = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($graphs as $graph => $value)
|
||||
{
|
||||
if (!isset($oldgraphs[$graph]))
|
||||
{
|
||||
mysql_query("INSERT INTO `device_graphs` (`device_id`, `graph`) VALUES ('".$device['device_id']."','".$graph."')");
|
||||
}
|
||||
}
|
||||
|
||||
$device_end = utime(); $device_run = $device_end - $device_start; $device_time = substr($device_run, 0, 5);
|
||||
$poll_update .= $poll_separator . "`last_polled_timetaken` = '$device_time'";
|
||||
#echo("$device_end - $device_start; $device_time $device_run");
|
||||
echo("Polled in $device_time seconds\n");
|
||||
|
||||
$poll_update_query = "UPDATE `devices` SET ";
|
||||
$poll_update_query .= $poll_update;
|
||||
$poll_update_query .= " WHERE `device_id` = '" . $device['device_id'] . "'";
|
||||
if ($debug) { echo("Updating " . $device['hostname'] . " - $poll_update_query \n"); }
|
||||
if (!mysql_query($poll_update_query))
|
||||
{
|
||||
echo("ERROR: " . mysql_error() . "\nSQL: $poll_update_query\n");
|
||||
}
|
||||
if (mysql_affected_rows() == "1") { echo("UPDATED!\n"); } else { echo("NOT UPDATED!\n"); }
|
||||
|
||||
unset($storage_cache); // Clear cache of hrStorage ** MAYBE FIXME? **
|
||||
unset($cache); // Clear cache (unify all things here?)
|
||||
}
|
||||
|
||||
$poller_end = utime(); $poller_run = $poller_end - $poller_start; $poller_time = substr($poller_run, 0, 5);
|
||||
$poller_end = utime(); $poller_run = $poller_end - $poller_start; $poller_time = substr($poller_run, 0, 5);
|
||||
|
||||
if ($polled_devices)
|
||||
{
|
||||
mysql_query("INSERT INTO `perf_times` (`type`, `doing`, `start`, `duration`, `devices`)
|
||||
VALUES ('poll', '$doing', '$poller_start', '$poller_time', '$polled_devices')");
|
||||
}
|
||||
if ($polled_devices)
|
||||
{
|
||||
mysql_query("INSERT INTO `perf_times` (`type`, `doing`, `start`, `duration`, `devices`)
|
||||
VALUES ('poll', '$doing', '$poller_start', '$poller_time', '$polled_devices')");
|
||||
}
|
||||
|
||||
$string = $argv[0] . " $doing " . date("F j, Y, G:i") . " - $polled_devices devices polled in $poller_time secs";
|
||||
if ($debug) echo("$string\n");
|
||||
$string = $argv[0] . " $doing " . date("F j, Y, G:i") . " - $polled_devices devices polled in $poller_time secs";
|
||||
if ($debug) echo("$string\n");
|
||||
|
||||
logfile($string);
|
||||
logfile($string);
|
||||
|
||||
unset($config); ### Remove this for testing
|
||||
unset($config); ### Remove this for testing
|
||||
|
||||
#print_r(get_defined_vars());
|
||||
|
||||
#print_r(get_defined_vars());
|
||||
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user