mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-12 16:06:25 +02:00
updates additions
git-svn-id: http://www.observium.org/svn/observer/trunk@505 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Executable
+44
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
echo("hrDevice : ");
|
||||
|
||||
$hrDevice_oids = array('hrDeviceIndex','hrDeviceType','hrDeviceDescr','hrDeviceStatus','hrDeviceErrors','hrProcessorLoad');
|
||||
|
||||
foreach ($hrDevice_oids as $oid) { echo("$oid "); $hrDevice_array = snmp_cache_oid($oid, $device, $hrDevice_array, "HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES"); }
|
||||
|
||||
foreach($hrDevice_array[$device[device_id]] as $hrDevice) {
|
||||
if(is_array($hrDevice)) {
|
||||
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `hrDevice` WHERE device_id = '".$device['device_id']."' AND hrDeviceIndex = '".$hrDevice['hrDeviceIndex']."'"),0)) {
|
||||
$update_query = "UPDATE `hrDevice` SET";
|
||||
$update_query .= " `hrDeviceType` = '".mres($hrDevice[hrDeviceType])."'";
|
||||
$update_query .= ", `hrDeviceDescr` = '".mres($hrDevice[hrDeviceDescr])."'";
|
||||
$update_query .= ", `hrDeviceStatus` = '".mres($hrDevice[hrDeviceStatus])."'";
|
||||
$update_query .= ", `hrDeviceErrors` = '".mres($hrDevice[hrDeviceErrors])."'";
|
||||
if($hrDevice['hrDeviceType'] == "hrDeviceProcessor") {
|
||||
$update_query .= ", `hrProcessorLoad` = '".mres($hrDevice[hrProcessorLoad])."'";
|
||||
}
|
||||
$update_query .= " WHERE device_id = '".$device['device_id']."' AND hrDeviceIndex = '".$hrDevice['hrDeviceIndex']."'";
|
||||
@mysql_query($update_query); $mysql++; echo(".");
|
||||
} else {
|
||||
$insert_query = "INSERT INTO `hrDevice` (`hrDeviceIndex`,`device_id`,`hrDeviceType`,`hrDeviceDescr`,`hrDeviceStatus`,`hrDeviceErrors`) ";
|
||||
$insert_query .= " VALUES ('".mres($hrDevice[hrDeviceIndex])."','".mres($device[device_id])."','".mres($hrDevice[hrDeviceType])."','".mres($hrDevice[hrDeviceDescr])."','".mres($hrDevice[hrDeviceStatus])."','".mres($hrDevice[hrDeviceErrors])."')";
|
||||
@mysql_query($insert_query); $mysql++; echo("+");
|
||||
}
|
||||
$valid_hrDevice[$hrDevice[hrDeviceIndex]] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM `hrDevice` WHERE `device_id` = '".$device['device_id']."'";
|
||||
$query = mysql_query($sql);
|
||||
|
||||
while ($test_hrDevice = mysql_fetch_array($query)) {
|
||||
if(!$valid_hrDevice[$test_hrDevice[hrDeviceIndex]]) {
|
||||
echo("-");
|
||||
mysql_query("DELETE FROM `hrDevice` WHERE hrDevice_id = '" . $test['hrDevice_id'] . "'");
|
||||
}
|
||||
}
|
||||
|
||||
unset($valid_hrDevice);
|
||||
echo("\n");
|
||||
|
||||
?>
|
||||
@@ -2,19 +2,21 @@
|
||||
|
||||
unset( $storage_exists );
|
||||
|
||||
echo("hrStorage : ");
|
||||
echo("HOST-RESOURCES-MIB Storage : ");
|
||||
|
||||
$oids = shell_exec($config['snmpwalk'] . " -m HOST-RESOURCES-MIB -Osq -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " hrStorageIndex");
|
||||
$oids = shell_exec($config['snmpwalk'] . " -CI -m HOST-RESOURCES-MIB -Osq -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " hrStorageIndex");
|
||||
$oids = trim(str_replace("hrStorageIndex.","",$oids));
|
||||
|
||||
echo(".. $oids .. ");
|
||||
|
||||
foreach(explode("\n", $oids) as $data) {
|
||||
if($data) {
|
||||
$data = trim($data);
|
||||
list($oid,$hrStorageIndex) = explode(" ", $data);
|
||||
$temp = shell_exec($config['snmpget'] . " -m HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " hrStorageDescr.$oid hrStorageAllocationUnits.$oid hrStorageSize.$oid hrStorageType.$oid");
|
||||
$temp = trim($temp);
|
||||
list($descr, $units, $size, $fstype) = explode("\n", $temp);
|
||||
list($units) = explode(" ", $units);
|
||||
|
||||
$allow = 1;
|
||||
foreach($config['ignore_mount'] as $bi) {
|
||||
if($descr == $bi) {
|
||||
@@ -39,6 +41,7 @@
|
||||
}
|
||||
$storage_exists[] = $device[device_id]." $hrStorageIndex";
|
||||
} else { echo("X"); };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
|
||||
function snmp_cache_cip($oid, $device, $array, $mib = 0) {
|
||||
global $config;
|
||||
$cmd = $config['snmpbulkwalk'] . " -O snq -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " ";
|
||||
$cmd = $config['snmpbulkwalk'] . " -O snQ -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " ";
|
||||
if($mib) { $cmd .= "-m $mib "; }
|
||||
$cmd .= $oid;
|
||||
$data = trim(shell_exec($cmd));
|
||||
$device_id = $device['device_id'];
|
||||
#echo("Caching: $oid\n");
|
||||
foreach(explode("\n", $data) as $entry) {
|
||||
list ($this_oid, $this_value) = split(" ", $entry);
|
||||
list ($this_oid, $this_value) = split("=", $entry);
|
||||
$this_oid = trim($this_oid);
|
||||
$this_value = trim($this_value);
|
||||
$this_oid = substr($this_oid, 30);
|
||||
|
||||
@@ -20,7 +20,7 @@ if($device[os] != "Snom") {
|
||||
'snmpOutBadValues','snmpOutGenErrs','snmpOutGetRequests','snmpOutGetNexts','snmpOutSetRequests','snmpOutGetResponses','snmpOutTraps',
|
||||
'snmpEnableAuthenTraps','snmpSilentDrops','snmpProxyDrops');
|
||||
|
||||
$oids['tcp'] = array ('tcpRtoMin', 'tcpRtoMax', 'tcpMaxConn', 'tcpActiveOpens', 'tcpPassiveOpens', 'tcpAttemptFails', 'tcpEstabResets', 'tcpCurrEstab',
|
||||
$oids['tcp'] = array ('tcpActiveOpens', 'tcpPassiveOpens', 'tcpAttemptFails', 'tcpEstabResets', 'tcpCurrEstab',
|
||||
'tcpInSegs', 'tcpOutSegs', 'tcpRetransSegs', 'tcpInErrs', 'tcpOutRsts', 'tcpHCInSegs', 'tcpHCOutSegs');
|
||||
|
||||
$oids['udp'] = array ('udpInDatagrams','udpOutDatagrams','udpInErrors','udpNoPorts');
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
<?php
|
||||
|
||||
$loadrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/load.rrd";
|
||||
$cpurrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/cpu.rrd";
|
||||
$memrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/mem.rrd";
|
||||
|
||||
if ($device['os'] == "FreeBSD") {
|
||||
$sysDescr = str_replace(" 0 ", " ", $sysDescr);
|
||||
list(,,$version) = explode (" ", $sysDescr);
|
||||
@@ -39,100 +35,5 @@ $memrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/mem.rrd";
|
||||
if(strstr($hw, "No")) { unset($hw); } else { $hardware = "Dell " . $hw; }
|
||||
}
|
||||
|
||||
|
||||
## Set OIDs
|
||||
$oid_ssCpuRawUser = ".1.3.6.1.4.1.2021.11.50.0";
|
||||
$oid_ssCpuRawNice = ".1.3.6.1.4.1.2021.11.51.0";
|
||||
$oid_ssCpuRawSystem = ".1.3.6.1.4.1.2021.11.52.0";
|
||||
$oid_ssCpuRawIdle = ".1.3.6.1.4.1.2021.11.53.0";
|
||||
$oid_ssCpuUser = ".1.3.6.1.4.1.2021.11.9.0";
|
||||
$oid_ssCpuSystem = ".1.3.6.1.4.1.2021.11.10.0";
|
||||
|
||||
$cpu_cmd = $config['snmpget'] ." -m UCD-SNMP-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
|
||||
$cpu_cmd .= " $oid_ssCpuRawUser $oid_ssCpuRawSystem $oid_ssCpuRawNice $oid_ssCpuRawIdle $oid_ssCpuUser $oid_ssCpuSystem";
|
||||
$cpu = `$cpu_cmd`;
|
||||
list ($cpuUser, $cpuSystem, $cpuNice, $cpuIdle, $UsageUser, $UsageSystem) = explode("\n", $cpu);
|
||||
|
||||
$cpuUsage = $UsageUser + $UsageSystem;
|
||||
|
||||
if(mysql_result(mysql_query("SELECT COUNT(*) FROM devices_attribs WHERE `device_id` = '" . $device['device_id'] . "' AND `attrib_type` = 'cpuusage'"),0)) {
|
||||
$update_usage = mysql_query("UPDATE devices_attribs SET attrib_value = '$cpuUsage' WHERE `device_id` = '" . $device['device_id'] . "' AND `attrib_type` = 'cpuusage'");
|
||||
} else {
|
||||
$insert_usage = mysql_query("INSERT INTO devices_attribs (`device_id`, `attrib_type`, `attrib_value`) VALUES ('" . $device['device_id'] . "', 'cpuusage', '$cpuUsage')");
|
||||
}
|
||||
|
||||
## Create CPU RRD if it doesn't already exist
|
||||
if (!is_file($cpurrd)) {
|
||||
shell_exec($config['rrdtool'] . " create $cpurrd \
|
||||
--step 300 \
|
||||
DS:user:COUNTER:600:0:U \
|
||||
DS:system:COUNTER:600:0:U \
|
||||
DS:nice:COUNTER:600:0:U \
|
||||
DS:idle:COUNTER:600:0:U \
|
||||
RRA:AVERAGE:0.5:1:800 \
|
||||
RRA:AVERAGE:0.5:6:800 \
|
||||
RRA:AVERAGE:0.5:24:800 \
|
||||
RRA:AVERAGE:0.5:288:800 \
|
||||
RRA:MAX:0.5:1:800 \
|
||||
RRA:MAX:0.5:6:800 \
|
||||
RRA:MAX:0.5:24:800 \
|
||||
RRA:MAX:0.5:288:800");
|
||||
}
|
||||
rrdtool_update($cpurrd, "N:$cpuUser:$cpuSystem:$cpuNice:$cpuIdle");
|
||||
|
||||
|
||||
## If the device isn't monowall or pfsense, monitor all the pretty things
|
||||
if($device[os] != "m0n0wall" && $device[os] != "Voswall" && $device[os] != "pfSense" ) {
|
||||
if (!is_file($memrrd)) {
|
||||
shell_exec($config['rrdtool'] . " create $memrrd \
|
||||
--step 300 \
|
||||
DS:totalswap:GAUGE:600:0:10000000000 \
|
||||
DS:availswap:GAUGE:600:0:10000000000 \
|
||||
DS:totalreal:GAUGE:600:0:10000000000 \
|
||||
DS:availreal:GAUGE:600:0:10000000000 \
|
||||
DS:totalfree:GAUGE:600:0:10000000000 \
|
||||
DS:shared:GAUGE:600:0:10000000000 \
|
||||
DS:buffered:GAUGE:600:0:10000000000 \
|
||||
DS:cached:GAUGE:600:0:10000000000 \
|
||||
RRA:AVERAGE:0.5:1:800 \
|
||||
RRA:AVERAGE:0.5:6:800 \
|
||||
RRA:AVERAGE:0.5:24:800 \
|
||||
RRA:AVERAGE:0.5:288:800 \
|
||||
RRA:MAX:0.5:1:800 \
|
||||
RRA:MAX:0.5:6:800 \
|
||||
RRA:MAX:0.5:24:800 \
|
||||
RRA:MAX:0.5:288:800");
|
||||
} // end create mem rrd
|
||||
|
||||
if(!is_file($loadrrd)) {
|
||||
shell_exec($config['rrdtool'] . " create $loadrrd \
|
||||
--step 300 \
|
||||
DS:1min:GAUGE:600:0:5000 \
|
||||
DS:5min:GAUGE:600:0:5000 \
|
||||
DS:15min:GAUGE:600:0:5000 \
|
||||
RRA:AVERAGE:0.5:1:800 \
|
||||
RRA:AVERAGE:0.5:6:800 \
|
||||
RRA:AVERAGE:0.5:24:800 \
|
||||
RRA:AVERAGE:0.5:288:800 \
|
||||
RRA:MAX:0.5:1:800 \
|
||||
RRA:MAX:0.5:6:800 \
|
||||
RRA:MAX:0.5:24:800 \
|
||||
RRA:MAX:0.5:288:800");
|
||||
} // end create load rrd
|
||||
|
||||
$mem_cmd = $config['snmpget'] . " -m UCD-SNMP-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
|
||||
$mem_cmd .= " memTotalSwap.0 memAvailSwap.0 memTotalReal.0 memAvailReal.0 memTotalFree.0 memShared.0 memBuffer.0 memCached.0";
|
||||
|
||||
$mem_raw = shell_exec($mem_cmd);
|
||||
list($memTotalSwap, $memAvailSwap, $memTotalReal, $memAvailReal, $memTotalFree, $memShared, $memBuffer, $memCached) = explode("\n", str_replace(" kB", "", $mem_raw));
|
||||
|
||||
$load_get = "laLoadInt.1 laLoadInt.2 laLoadInt.3";
|
||||
$load_cmd = "snmpget -m UCD-SNMP-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " " . $load_get;
|
||||
$load_raw = `$load_cmd`;
|
||||
list ($load1, $load5, $load10) = explode ("\n", $load_raw);
|
||||
|
||||
rrdtool_update($loadrrd, "N:$load1:$load5:$load10");
|
||||
rrdtool_update($memrrd, "N:$memTotalSwap:$memAvailSwap:$memTotalReal:$memAvailReal:$memTotalFree:$memShared:$memBuffer:$memCached");
|
||||
|
||||
} // end Non-m0n0wall
|
||||
|
||||
include("ucd-mib.inc.php");
|
||||
include("hr-mib.inc.php");
|
||||
|
||||
@@ -7,105 +7,7 @@
|
||||
if(strstr($sysDescr, "Uniprocessor Free")) { $features = "Uniprocessor"; }
|
||||
if(strstr($sysDescr, "Multiprocessor Free")) { $features = "Multiprocessor"; }
|
||||
|
||||
$loadrrd = $host_rrd . "/load.rrd";
|
||||
$cpurrd = $host_rrd . "/cpu.rrd";
|
||||
$memrrd = $host_rrd . "/mem.rrd";
|
||||
$sysrrd = $host_rrd . "/sys.rrd";
|
||||
|
||||
$oid_ssCpuRawUser = ".1.3.6.1.4.1.2021.11.50.0";
|
||||
$oid_ssCpuRawSystem = ".1.3.6.1.4.1.2021.11.51.0";
|
||||
$oid_ssCpuRawNice = ".1.3.6.1.4.1.2021.11.52.0";
|
||||
$oid_ssCpuRawIdle = ".1.3.6.1.4.1.2021.11.53.0";
|
||||
$oid_hrSystemProcesses = ".1.3.6.1.2.1.25.1.6.0";
|
||||
$oid_hrSystemNumUsers = ".1.3.6.1.2.1.25.1.5.0";
|
||||
|
||||
$s_cmd = $config['snmpget'] . " -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
|
||||
$s_cmd .= " $oid_ssCpuRawUser $oid_ssCpuRawSystem $oid_ssCpuRawNice $oid_ssCpuRawIdle $oid_hrSystemProcesses $oid_hrSystemNumUsers";
|
||||
$s = shell_exec($s_cmd);
|
||||
list ($cpuUser, $cpuSystem, $cpuNice, $cpuIdle, $procs, $users) = explode("\n", $s);
|
||||
|
||||
if (!is_file($cpurrd)) {
|
||||
shell_exec($config['rrdtool'] . " create $cpurrd \
|
||||
--step 300 \
|
||||
DS:user:COUNTER:600:0:U \
|
||||
DS:system:COUNTER:600:0:U \
|
||||
DS:nice:COUNTER:600:0:U \
|
||||
DS:idle:COUNTER:600:0:U \
|
||||
RRA:AVERAGE:0.5:1:800 \
|
||||
RRA:AVERAGE:0.5:6:800 \
|
||||
RRA:AVERAGE:0.5:24:800 \
|
||||
RRA:AVERAGE:0.5:288:800 \
|
||||
RRA:MAX:0.5:1:800 \
|
||||
RRA:MAX:0.5:6:800 \
|
||||
RRA:MAX:0.5:24:800 \
|
||||
RRA:MAX:0.5:288:800");
|
||||
}
|
||||
|
||||
if (!is_file($sysrrd)) {
|
||||
shell_exec($config['rrdtool'] . " create $sysrrd \
|
||||
--step 300 \
|
||||
DS:users:GAUGE:600:0:U \
|
||||
DS:procs:GAUGE:600:0:U \
|
||||
RRA:AVERAGE:0.5:1:800 \
|
||||
RRA:AVERAGE:0.5:6:800 \
|
||||
RRA:AVERAGE:0.5:24:800 \
|
||||
RRA:AVERAGE:0.5:288:800 \
|
||||
RRA:MAX:0.5:1:800 \
|
||||
RRA:MAX:0.5:6:800 \
|
||||
RRA:MAX:0.5:24:800 \
|
||||
RRA:MAX:0.5:288:800");
|
||||
}
|
||||
|
||||
if (!is_file($memrrd)) {
|
||||
shell_exec($config['rrdtool'] . " create $memrrd \
|
||||
--step 300 \
|
||||
DS:totalswap:GAUGE:600:0:10000000000 \
|
||||
DS:availswap:GAUGE:600:0:10000000000 \
|
||||
DS:totalreal:GAUGE:600:0:10000000000 \
|
||||
DS:availreal:GAUGE:600:0:10000000000 \
|
||||
DS:totalfree:GAUGE:600:0:10000000000 \
|
||||
DS:shared:GAUGE:600:0:10000000000 \
|
||||
DS:buffered:GAUGE:600:0:10000000000 \
|
||||
DS:cached:GAUGE:600:0:10000000000 \
|
||||
RRA:AVERAGE:0.5:1:800 \
|
||||
RRA:AVERAGE:0.5:6:800 \
|
||||
RRA:AVERAGE:0.5:24:800 \
|
||||
RRA:AVERAGE:0.5:288:800 \
|
||||
RRA:MAX:0.5:1:800 \
|
||||
RRA:MAX:0.5:6:800 \
|
||||
RRA:MAX:0.5:24:800 \
|
||||
RRA:MAX:0.5:288:800");
|
||||
}
|
||||
|
||||
if(!is_file($loadrrd)) {
|
||||
shell_exec($config['rrdtool'] . " create $loadrrd \
|
||||
--step 300 \
|
||||
DS:1min:GAUGE:600:0:5000 \
|
||||
DS:5min:GAUGE:600:0:5000 \
|
||||
DS:15min:GAUGE:600:0:5000 \
|
||||
RRA:AVERAGE:0.5:1:800 \
|
||||
RRA:AVERAGE:0.5:6:800 \
|
||||
RRA:AVERAGE:0.5:24:800 \
|
||||
RRA:AVERAGE:0.5:288:800 \
|
||||
RRA:MAX:0.5:1:800 \
|
||||
RRA:MAX:0.5:6:800 \
|
||||
RRA:MAX:0.5:24:800 \
|
||||
RRA:MAX:0.5:288:800");
|
||||
}
|
||||
|
||||
$mem_get = "memTotalSwap.0 memAvailSwap.0 memTotalReal.0 memAvailReal.0 memTotalFree.0 memShared.0 memBuffer.0 memCached.0";
|
||||
$mem_cmd = $config['snmpget'] . " -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " " . $mem_get;
|
||||
$mem_raw = shell_exec($mem_cmd);
|
||||
list($memTotalSwap, $memAvailSwap, $memTotalReal, $memAvailReal, $memTotalFree, $memShared, $memBuffer, $memCached) = explode("\n", $mem_raw);
|
||||
|
||||
$load_get = "laLoadInt.1 laLoadInt.2 laLoadInt.3";
|
||||
$load_cmd = $config['snmpget'] . " -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " " . $load_get;
|
||||
$load_raw = shell_exec($load_cmd);
|
||||
list ($load1, $load5, $load10) = explode ("\n", $load_raw);
|
||||
|
||||
rrdtool_update($sysrrd, "N:$users:$procs");
|
||||
rrdtool_update($loadrrd, "N:$load1:$load5:$load10");
|
||||
rrdtool_update($memrrd, "N:$memTotalSwap:$memAvailSwap:$memTotalReal:$memAvailReal:$memTotalFree:$memShared:$memBuffer:$memCached");
|
||||
rrdtool_update($cpurrd, "N:$cpuUser:$cpuSystem:$cpuNice:$cpuIdle");
|
||||
include("ucd-mib.inc.php");
|
||||
include("hr-mib.inc.php");
|
||||
|
||||
?>
|
||||
|
||||
@@ -32,5 +32,6 @@ if (!is_file($hrSystem_rrd)) {
|
||||
rrdtool_update($hrSystem_rrd, "N:$hrSystemNumUsers:$hrSystemProcesses:$uptime");
|
||||
|
||||
include("hr-mib_storage.inc.php"); // Run HOST-RESOURCES-MIB Storage
|
||||
include("hr-mib_processor.inc.php"); // Run HOST-RESOURCES-MIB ProcessorLoad
|
||||
|
||||
?>
|
||||
|
||||
Executable
+41
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
echo("hrDevice : ");
|
||||
|
||||
$hrDevice_oids = array('hrDeviceStatus','hrDeviceErrors','hrProcessorLoad');
|
||||
|
||||
foreach ($hrDevice_oids as $oid) { echo("$oid "); $hrDevice_array = snmp_cache_oid($oid, $device, $hrDevice_array, "HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES"); }
|
||||
|
||||
$sql = "SELECT * FROM `hrDevice` WHERE `device_id` = '".$device['device_id']."' AND `hrDeviceType` = 'hrDeviceProcessor'";
|
||||
$query = mysql_query($sql);
|
||||
while ($hrDevice = mysql_fetch_array($query)) {
|
||||
$this_hrDevice = $hrDevice_array[$device[device_id]][$hrDevice[hrDeviceIndex]];
|
||||
|
||||
$update_query = "UPDATE `hrDevice` SET";
|
||||
$update_query .= ", `hrDeviceStatus` = '".mres($this_hrDevice[hrDeviceStatus])."'";
|
||||
$update_query .= ", `hrDeviceErrors` = '".mres($this_hrDevice[hrDeviceErrors])."'";
|
||||
$update_query .= ", `hrProcessorLoad` = '".mres($this_hrDevice[hrProcessorLoad])."'";
|
||||
$update_query .= " WHERE device_id = '".$device['device_id']."' AND hrDeviceIndex = '".$hrDevice['hrDeviceIndex']."'";
|
||||
@mysql_query($update_query); $mysql++; echo(".");
|
||||
|
||||
$procrrd = addslashes($config['rrd_dir'] . "/" . $device['hostname'] . "/hrProcessor-" . $hrDevice['hrDeviceIndex'] . ".rrd");
|
||||
|
||||
if (!is_file($procrrd)) {
|
||||
shell_exec($config['rrdtool'] . " create $procrrd \
|
||||
--step 300 \
|
||||
DS:usage:GAUGE:600:-273:1000 \
|
||||
RRA:AVERAGE:0.5:1:1200 \
|
||||
RRA:MIN:0.5:12:2400 \
|
||||
RRA:MAX:0.5:12:2400 \
|
||||
RRA:AVERAGE:0.5:12:2400");
|
||||
}
|
||||
|
||||
echo($this_hrDevice['hrProcessorLoad'] . "% ");
|
||||
|
||||
rrdtool_update ($procrrd, "N:".$this_hrDevice['hrProcessorLoad']);
|
||||
|
||||
}
|
||||
|
||||
echo("\n");
|
||||
|
||||
?>
|
||||
@@ -40,8 +40,6 @@ if (!is_file($cpurrd)) {
|
||||
rrdtool_update($cpurrd, "N:$cpuUser:$cpuSystem:$cpuNice:$cpuIdle");
|
||||
|
||||
|
||||
## If the device isn't monowall or pfsense, monitor all the pretty things
|
||||
if($device[os] != "m0n0wall" && $device[os] != "Voswall" && $device[os] != "pfSense" ) {
|
||||
if (!is_file($memrrd)) {
|
||||
shell_exec($config['rrdtool'] . " create $memrrd \
|
||||
--step 300 \
|
||||
@@ -93,5 +91,3 @@ if($device[os] != "m0n0wall" && $device[os] != "Voswall" && $device[os] != "pfSe
|
||||
rrdtool_update($loadrrd, "N:$load1:$load5:$load10");
|
||||
rrdtool_update($memrrd, "N:$memTotalSwap:$memAvailSwap:$memTotalReal:$memAvailReal:$memTotalFree:$memShared:$memBuffer:$memCached");
|
||||
|
||||
} // end Non-m0n0wall
|
||||
|
||||
|
||||
Reference in New Issue
Block a user