mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-28 00:24:21 +02:00
move poller.php (inc os/system) to db* (and others, but poller is biggest change)
git-svn-id: http://www.observium.org/svn/observer/trunk@2298 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -22,8 +22,9 @@ Usage
|
||||
* Used by the other _query functions.
|
||||
* */
|
||||
function dbQuery($sql, $parameters = array()) {
|
||||
global $fullSql;
|
||||
global $fullSql, $debug;
|
||||
$fullSql = dbMakeQuery($sql, $parameters);
|
||||
if($debug) { echo(" SQL[".$fullSql."] "); }
|
||||
/*
|
||||
if($this->logFile)
|
||||
$time_start = microtime(true);
|
||||
@@ -111,6 +112,7 @@ function dbUpdate($data, $table, $where = null, $parameters = array()) {
|
||||
if(dbQuery($sql, $data)) {
|
||||
return mysql_affected_rows();
|
||||
} else {
|
||||
#echo("$fullSql");
|
||||
trigger_error('QDB - Update failed.', E_WARNING);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -17,25 +17,25 @@
|
||||
|
||||
if ($version && $device['version'] != $version)
|
||||
{
|
||||
$device['db_update'] .= ", `version` = '".mres($version)."'";
|
||||
$update_array['version'] = $version;
|
||||
log_event("OS Version -> ".$version, $device, 'system');
|
||||
}
|
||||
|
||||
if ($features != $device['features'])
|
||||
{
|
||||
$device['db_update'] .= ", `features` = '".mres($features)."'";
|
||||
$update_array['features'] = $features;
|
||||
log_event("OS Features -> ".$features, $device, 'system');
|
||||
}
|
||||
|
||||
if ($hardware && $hardware != $device['hardware'])
|
||||
{
|
||||
$device['db_update'] .= ", `hardware` = '".mres($hardware)."'";
|
||||
$update_array['hardware'] = $hardware;
|
||||
log_event("Hardware -> ".$hardware, $device, 'system');
|
||||
}
|
||||
|
||||
if ($serial && $serial != $device['serial'])
|
||||
{
|
||||
$device['db_update'] .= ", `serial` = '".mres($serial)."'";
|
||||
$update_array['serial'] = $serial;
|
||||
log_event("serial -> ".$serial, $device, 'system');
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
|
||||
echo("Uptime: ".formatUptime($uptime)."\n");
|
||||
|
||||
$device['db_update'] .= ", `uptime` = '".mres($uptime)."'";
|
||||
$update_array['uptime'] = $uptime;
|
||||
}
|
||||
|
||||
$poll_device['sysLocation'] = str_replace("\"","", $poll_device['sysLocation']);
|
||||
@@ -77,19 +77,19 @@
|
||||
|
||||
if ($poll_device['sysContact'] && $poll_device['sysContact'] != $device['sysContact'])
|
||||
{
|
||||
$device['db_update'] .= ", `sysContact` = '".mres($poll_device['sysContact'])."'";
|
||||
$update_array['sysContact'] = $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'])."'";
|
||||
$update_array['sysName'] = $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'])."'";
|
||||
$update_array['sysDescr'] = $poll_device['sysDescr'];
|
||||
log_event("sysDescr -> ".$poll_device['sysDescr'], $device, 'system');
|
||||
}
|
||||
|
||||
@@ -97,9 +97,9 @@
|
||||
{
|
||||
if (!get_dev_attrib($device,'override_sysLocation_bool'))
|
||||
{
|
||||
$device['db_update'] .= ", `location` = '".mres($poll_device['sysLocation'])."'";
|
||||
$update_array['location'] = $poll_device['sysLocation'];
|
||||
log_event("Location -> ".$poll_device['sysLocation'], $device, 'system');
|
||||
}
|
||||
log_event("Location -> ".$poll_device['sysLocation'], $device, 'system');
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user