2010-07-03 17:02:39 +00:00
< ? php
2010-07-29 18:25:11 +00:00
global $valid_sensor ;
2010-08-11 17:08:56 +00:00
global $entity_temperature ;
2010-07-24 19:14:41 +00:00
2010-08-11 17:08:56 +00:00
if ( mysql_result ( mysql_query ( " SELECT COUNT(*) FROM `sensors` WHERE `device_id` = ' " . $device [ 'device_id' ] . " ' AND `sensor_class` = 'temperature' AND (`sensor_type` = 'cisco-entity-sensor' OR `sensor_type` = 'entity-sensor') " ), 0 ) == " 0 " && ( $device [ 'os' ] == " ios " || $device [ 'os_group' ] == " ios " ))
2010-07-03 17:02:39 +00:00
{
2010-07-09 22:38:46 +00:00
echo ( " Cisco " );
$oids = snmp_walk ( $device , " .1.3.6.1.4.1.9.9.13.1.3.1.2 " , " -Osqn " , " CISCO-ENVMON-MIB " );
$oids = str_replace ( '.1.3.6.1.4.1.9.9.13.1.3.1.2.' , '' , $oids );
$oids = trim ( $oids );
foreach ( explode ( " \n " , $oids ) as $data )
{
$data = trim ( $data );
if ( $data )
2010-07-03 17:02:39 +00:00
{
2010-07-09 22:38:46 +00:00
list ( $index ) = explode ( " " , $data );
$oid = " .1.3.6.1.4.1.9.9.13.1.3.1.3. $index " ;
$descr_oid = " .1.3.6.1.4.1.9.9.13.1.3.1.2. $index " ;
$descr = snmp_get ( $device , $descr_oid , " -Oqv " , " CISCO-ENVMON-MIB " );
2010-07-29 18:25:11 +00:00
$temperature = snmp_get ( $device , $oid , " -Oqv " , " CISCO-ENVMON-MIB " );
if ( ! strstr ( $descr , " No " ) && ! strstr ( $temperature , " No " ) && $descr != " " )
2010-07-03 17:02:39 +00:00
{
2010-07-09 22:38:46 +00:00
$descr = str_replace ( " \" " , " " , $descr );
$descr = str_replace ( " temperature " , " " , $descr );
2010-07-29 18:25:11 +00:00
$descr = str_replace ( " temperature " , " " , $descr );
2010-07-09 22:38:46 +00:00
$descr = trim ( $descr );
2010-07-29 18:25:11 +00:00
discover_sensor ( $valid_sensor , 'temperature' , $device , $oid , $index , 'cisco' , $descr , '1' , '1' , NULL , NULL , NULL , NULL , $temperature );
2010-07-03 17:02:39 +00:00
}
}
2010-07-09 22:38:46 +00:00
}
2010-07-03 17:02:39 +00:00
}
?>