mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
add new files
git-svn-id: http://www.observium.org/svn/observer/trunk@434 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
52
includes/polling/cisco-entity-sensors.inc.php
Executable file
52
includes/polling/cisco-entity-sensors.inc.php
Executable file
@ -0,0 +1,52 @@
|
||||
<?
|
||||
|
||||
$query = "SELECT * FROM entPhysical WHERE device_id = '" . $device['device_id'] . "' AND entPhysicalClass = 'sensor'";
|
||||
$sensors = mysql_query($query);
|
||||
while($sensor = mysql_fetch_array($sensors)) {
|
||||
|
||||
echo("Checking Entity Sensor " . $sensor['entPhysicalName'] . " - " . $sensor['cempsensorName']);
|
||||
|
||||
$oid = $sensor['entPhysicalIndex'];
|
||||
|
||||
$sensor_cmd = $config['snmpget'] . " -m CISCO-ENTITY-SENSOR-MIB -O Uqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
|
||||
$sensor_cmd .= " entSensorValue.$oid entSensorStatus.$oid";
|
||||
|
||||
$sensor_data = trim(shell_exec($sensor_cmd));
|
||||
|
||||
# echo("$sensor_data");
|
||||
|
||||
list($entSensorValue, $entSensorStatus) = explode("\n", $sensor_data);
|
||||
|
||||
$rrd = addslashes($config['rrd_dir'] . "/" . $device['hostname'] . "/ces-" . $oid . ".rrd");
|
||||
|
||||
if (!is_file($rrd)) {
|
||||
`rrdtool create $rrd \
|
||||
--step 300 \
|
||||
DS:value:GAUGE:600:-1000:U \
|
||||
RRA:AVERAGE:0.5:1:2304 \
|
||||
RRA:AVERAGE:0.5:6:1536 \
|
||||
RRA:AVERAGE:0.5:24:2268 \
|
||||
RRA:AVERAGE:0.5:288:1890 \
|
||||
RRA:MAX:0.5:1:2304 \
|
||||
RRA:MAX:0.5:6:1536 \
|
||||
RRA:MAX:0.5:24:2268 \
|
||||
RRA:MAX:0.5:288:1890 \
|
||||
RRA:MIN:0.5:1:2304 \
|
||||
RRA:MIN:0.5:6:1536 \
|
||||
RRA:MIN:0.5:24:2268 \
|
||||
RRA:MIN:0.5:288:1890`;
|
||||
}
|
||||
|
||||
$entSensorValue = entPhysical_scale($entSensorValue, $sensor['entSensorScale']);
|
||||
|
||||
$updatecmd = $config['rrdtool'] ." update $rrd N:$entSensorValue";
|
||||
shell_exec($updatecmd);
|
||||
|
||||
$update_query = "UPDATE `entPhysical` SET entSensorValue='$entSensorValue', entSensorStatus='$entSensorStatus' WHERE `entPhysical_id` = '".$sensor['entPhysical_id']."'";
|
||||
mysql_query($update_query);
|
||||
|
||||
echo($entSensorValue . " - " . $entSensorStatus . "\n");
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -4,8 +4,8 @@ $query = "SELECT * FROM cempMemPool WHERE device_id = '" . $device['device_id']
|
||||
$pool_data = mysql_query($query);
|
||||
while($mempool = mysql_fetch_array($pool_data)) {
|
||||
|
||||
$entPhysicalName = mysql_result(mysql_query("SELECT entPhysicalName from entPhysical WHERE device_id = '".$device['device_id']."'
|
||||
AND entPhysicalIndex = '".$mempool['entPhysicalIndex']."'"),0);
|
||||
$entPhysicalName = @mysql_result(mysql_query("SELECT `entPhysicalName` from entPhysical WHERE device_id = '".$device['device_id']."'
|
||||
AND `entPhysicalIndex` = '".$mempool['entPhysicalIndex']."'"),0);
|
||||
|
||||
echo("Checking Mempool " . $entPhysicalName . " - " . $mempool['cempMemPoolName']);
|
||||
|
||||
|
Reference in New Issue
Block a user