mirror of
				https://github.com/librenms/librenms.git
				synced 2024-10-07 16:52:45 +00:00 
			
		
		
		
	Add precision to current graph, sexify fix-port-rrd.php, fix papouch tme precision and lm-sensors description fixing
git-svn-id: http://www.observium.org/svn/observer/trunk@1658 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
		| @@ -20,7 +20,7 @@ | |||||||
| 		fixRdd($file); | 		fixRdd($file); | ||||||
| 		$i++; | 		$i++; | ||||||
| 		if(date("U") - $start > 1) | 		if(date("U") - $start > 1) | ||||||
| 			echo round(($i / $count) * 100, 2) . "%\n"; | 			echo round(($i / $count) * 100, 2) . "%  \r"; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	function getDirectoryTree( $outerDir, &$files = array()){  | 	function getDirectoryTree( $outerDir, &$files = array()){  | ||||||
| @@ -190,9 +190,9 @@ THIRD; | |||||||
| 			$fileC = str_replace('</row>', $third, $fileC);		 | 			$fileC = str_replace('</row>', $third, $fileC);		 | ||||||
| 			$tmpfname = tempnam("/tmp", "OBS"); | 			$tmpfname = tempnam("/tmp", "OBS"); | ||||||
| 			file_put_contents($tmpfname, $fileC); | 			file_put_contents($tmpfname, $fileC); | ||||||
| 			unlink($file); | 			@unlink($file); | ||||||
| 			$newfile = preg_replace("/(\d+)\.rrd/", "port-\\1.rrd", $file); | 			$newfile = preg_replace("/(\d+)\.rrd/", "port-\\1.rrd", $file); | ||||||
| 			unlink($newfile); | 			@unlink($newfile); | ||||||
| 			shell_exec($config['rrdtool'] . " restore $tmpfname  $newfile"); | 			shell_exec($config['rrdtool'] . " restore $tmpfname  $newfile"); | ||||||
| 			unlink($tmpfname); | 			unlink($tmpfname); | ||||||
|  |  | ||||||
| @@ -201,5 +201,7 @@ THIRD; | |||||||
| 		 | 		 | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
|  | 	echo "\n"; | ||||||
|  |  | ||||||
| ?> | ?> | ||||||
|  |  | ||||||
|   | |||||||
| @@ -6,13 +6,14 @@ include("includes/graphs/common.inc.php"); | |||||||
|  |  | ||||||
|   $rrd_filename  = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("current-" . $sensor['sensor_descr'] . ".rrd"); |   $rrd_filename  = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("current-" . $sensor['sensor_descr'] . ".rrd"); | ||||||
|  |  | ||||||
|   $rrd_options .= " COMMENT:'                                 Last   Max\\n'"; |   $rrd_options .= " COMMENT:'                       Min     Last    Max\\n'"; | ||||||
|  |  | ||||||
|   $sensor['sensor_descr_fixed'] = substr(str_pad($sensor['sensor_descr'], 28),0,28); |   $sensor['sensor_descr_fixed'] = substr(str_pad($sensor['sensor_descr'], 18),0,18); | ||||||
|  |  | ||||||
|   $rrd_options .= " DEF:current=$rrd_filename:current:AVERAGE"; |   $rrd_options .= " DEF:current=$rrd_filename:current:AVERAGE"; | ||||||
|   $rrd_options .= " LINE1.5:current#cc0000:'" . $sensor['sensor_descr_fixed']."'"; |   $rrd_options .= " LINE1.5:current#cc0000:'" . $sensor['sensor_descr_fixed']."'"; | ||||||
|   $rrd_options .= " GPRINT:current:LAST:%3.0lfA"; |   $rrd_options .= " GPRINT:current$current_id:MIN:%5.2lfA"; | ||||||
|   $rrd_options .= " GPRINT:current:MAX:%3.0lfA\\\\l"; |   $rrd_options .= " GPRINT:current:LAST:%5.2lfA"; | ||||||
|  |   $rrd_options .= " GPRINT:current:MAX:%5.2lfA\\\\l"; | ||||||
|  |  | ||||||
| ?> | ?> | ||||||
|   | |||||||
| @@ -4,7 +4,7 @@ global $valid_sensor; | |||||||
|  |  | ||||||
| if ($device['os'] == "ios" || $device['os_group'] == "ios")  | if ($device['os'] == "ios" || $device['os_group'] == "ios")  | ||||||
| { | { | ||||||
|   echo("CISCO-ENTITY-SENSOR"); |   echo(" CISCO-ENTITY-SENSOR"); | ||||||
|  |  | ||||||
|   $oids = array();   |   $oids = array();   | ||||||
|  |  | ||||||
| @@ -79,5 +79,4 @@ if ($device['os'] == "ios" || $device['os_group'] == "ios") | |||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| ?> | ?> | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ | |||||||
|  |  | ||||||
| global $valid_sensor; | global $valid_sensor; | ||||||
|  |  | ||||||
| echo("ENTITY-SENSOR "); | echo(" ENTITY-SENSOR"); | ||||||
|  |  | ||||||
| $oids = array();   | $oids = array();   | ||||||
| $oids = snmpwalk_cache_multi_oid($device, "entPhySensorType", $oids, "ENTITY-SENSOR-MIB"); | $oids = snmpwalk_cache_multi_oid($device, "entPhySensorType", $oids, "ENTITY-SENSOR-MIB"); | ||||||
|   | |||||||
| @@ -19,6 +19,7 @@ if ($device['os'] == "linux") | |||||||
|       $temperature_oid  = "1.3.6.1.4.1.2021.13.16.2.1.3.$temperature_id"; |       $temperature_oid  = "1.3.6.1.4.1.2021.13.16.2.1.3.$temperature_id"; | ||||||
|       $temperature = snmp_get($device, $temperature_oid, "-Ovq") / 1000; |       $temperature = snmp_get($device, $temperature_oid, "-Ovq") / 1000; | ||||||
|       $descr = str_ireplace("temperature-", "", $descr); |       $descr = str_ireplace("temperature-", "", $descr); | ||||||
|  |       $descr = str_ireplace("temp-", "", $descr); | ||||||
|       $descr = trim($descr); |       $descr = trim($descr); | ||||||
|       if($temperature != "0" && $temperature <= "1000") |       if($temperature != "0" && $temperature <= "1000") | ||||||
|       { |       { | ||||||
|   | |||||||
| @@ -13,7 +13,7 @@ if ($device['os'] == "papouch-tme") | |||||||
|   { |   { | ||||||
|     $temperature_oid = ".1.3.6.1.4.1.18248.1.1.1.0"; |     $temperature_oid = ".1.3.6.1.4.1.18248.1.1.1.0"; | ||||||
|     $descr = trim(str_replace("\"", "", $descr)); |     $descr = trim(str_replace("\"", "", $descr)); | ||||||
|     discover_sensor($valid_sensor, 'temperature', $device, $temperature_oid, "1", 'papouch-tme', $descr, '1', '1', NULL, NULL, NULL, NULL, $temperature); |     discover_sensor($valid_sensor, 'temperature', $device, $temperature_oid, "1", 'papouch-tme', $descr, '10', '1', NULL, NULL, NULL, NULL, $temperature); | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user