2009-11-09 11:38:13 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/// HOST-RESOURCES-MIB
|
|
|
|
// Generic System Statistics
|
|
|
|
|
|
|
|
$hrSystem_rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/hrSystem.rrd";
|
2010-07-02 19:58:13 +00:00
|
|
|
$hrSystem_cmd = $config['snmpget'] . " -M ".$config['mibdir']." -m HOST-RESOURCES-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
|
2010-03-03 09:15:37 +00:00
|
|
|
$hrSystem_cmd .= " hrSystemProcesses.0 hrSystemNumUsers.0 hrMemorySize.0";
|
2009-11-09 11:38:13 +00:00
|
|
|
$hrSystem = `$hrSystem_cmd`;
|
2010-03-03 09:15:37 +00:00
|
|
|
list ($hrSystemProcesses, $hrSystemNumUsers, $hrMemorySize) = explode("\n", $hrSystem);
|
2010-01-28 09:57:19 +00:00
|
|
|
|
2009-11-09 11:38:13 +00:00
|
|
|
if (!is_file($hrSystem_rrd)) {
|
|
|
|
shell_exec($config['rrdtool'] . " create $hrSystem_rrd \
|
|
|
|
--step 300 \
|
|
|
|
DS:users:GAUGE:600:0:U \
|
|
|
|
DS:procs:GAUGE:600:0:U \
|
|
|
|
DS:uptime: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");
|
|
|
|
}
|
|
|
|
|
|
|
|
rrdtool_update($hrSystem_rrd, "N:$hrSystemNumUsers:$hrSystemProcesses:$uptime");
|
|
|
|
|
|
|
|
|
|
|
|
?>
|