add Thompson speedtouch

git-svn-id: http://www.observium.org/svn/observer/trunk@543 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2009-12-04 15:28:52 +00:00
parent e0e02d9b15
commit 23633d1579
12 changed files with 37 additions and 26 deletions

View File

@ -53,7 +53,7 @@ while ($device = mysql_fetch_array($device_query)) {
echo("\n"); echo("\n");
## Discover OS Changes ## Discover OS Changes
include("includes/discovery/os.inc.php"); # include("includes/discovery/os.inc.php");
## Discover Interfaces ## Discover Interfaces
include("includes/discovery/interfaces.php"); include("includes/discovery/interfaces.php");

View File

@ -20,7 +20,7 @@ if($_GET['bg']) { $rrd_options .= " -c CANVAS#" . mres($_GET['bg']) . " "; }
#$rrd_options .= " -c BACK#FFFFFF"; #$rrd_options .= " -c BACK#FFFFFF";
if($height < "99") { $rrd_options .= " --only-graph"; } if($height < "99") { $rrd_options .= " --only-graph"; }
if($width <= "300") { $rrd_options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']; if($width <= "300") { $rrd_options .= " --font LEGEND:7:MONO --font AXIS:6:MONO";
} else { $rrd_options .= " --font LEGEND:8:".$config['mono_font']." --font AXIS:7:".$config['mono_font']; } } else { $rrd_options .= " --font LEGEND:8:MONO --font AXIS:7:MONO"; }
?> ?>

View File

@ -541,7 +541,7 @@ function collectd_draw_rrd($host, $plugin, $pinst = null, $type, $tinst = null,
#$rrd_cmd = array(RRDTOOL, 'graph', '-', '-a', 'PNG', '-w', $config['rrd_width'], '-h', $config['rrd_height'], '-s', -1*$timespan_def['seconds'], '-t', $rrdfile); #$rrd_cmd = array(RRDTOOL, 'graph', '-', '-a', 'PNG', '-w', $config['rrd_width'], '-h', $config['rrd_height'], '-s', -1*$timespan_def['seconds'], '-t', $rrdfile);
$rrd_cmd = array(RRDTOOL, 'graph', '-', '-a', 'PNG', '-w', $config['rrd_width'], '-h', $config['rrd_height'], '-s', -1*$timespan_def['seconds']); $rrd_cmd = array(RRDTOOL, 'graph', '-', '-a', 'PNG', '-w', $config['rrd_width'], '-h', $config['rrd_height'], '-s', -1*$timespan_def['seconds']);
if($config['rrd_width'] <= "300") { if($config['rrd_width'] <= "300") {
$small_opts = array ('--font', "LEGEND:7:".$config['mono_font'], '--font', "AXIS:6:".$config['mono_font'], "--font-render-mode", "normal"); $small_opts = array ('--font', "LEGEND:7:mono", '--font', "AXIS:6:mono", "--font-render-mode", "normal");
$rrd_cmd = array_merge($rrd_cmd, $small_opts); $rrd_cmd = array_merge($rrd_cmd, $small_opts);
} }
@ -582,7 +582,7 @@ function collectd_draw_generic($timespan, $host, $plugin, $pinst = null, $type,
$rrd_cmd = array(RRDTOOL, 'graph', '-', '-a', 'PNG', '-w', $config['rrd_width'], '-h', $config['rrd_height'], '-s', -1*$timespan_def['seconds']); $rrd_cmd = array(RRDTOOL, 'graph', '-', '-a', 'PNG', '-w', $config['rrd_width'], '-h', $config['rrd_height'], '-s', -1*$timespan_def['seconds']);
if($config['rrd_width'] <= "300") { if($config['rrd_width'] <= "300") {
$small_opts = array ('--font', 'LEGEND:7:'.$config['mono_font'], '--font', 'AXIS:6:'.$config['mono_font'], '--font-render-mode', 'normal'); $small_opts = array ('--font', 'LEGEND:7:mono', '--font', 'AXIS:6:mono', '--font-render-mode', 'normal');
$rrd_cmd = array_merge($rrd_cmd, $small_opts); $rrd_cmd = array_merge($rrd_cmd, $small_opts);
} }
@ -637,7 +637,7 @@ function collectd_draw_meta_stack(&$opts, &$sources) {
$cmd = array(RRDTOOL, 'graph', '-', '-a', 'PNG', '-w', $config['rrd_width'], '-h', $config['rrd_height'], '-s', -1*$timespan_def['seconds']); $cmd = array(RRDTOOL, 'graph', '-', '-a', 'PNG', '-w', $config['rrd_width'], '-h', $config['rrd_height'], '-s', -1*$timespan_def['seconds']);
if($config['rrd_width'] <= "300") { if($config['rrd_width'] <= "300") {
$small_opts = array ('--font', 'LEGEND:7:'.$config['mono_font'], '--font', 'AXIS:6:'.$config['mono_font'], '--font-render-mode', 'normal'); $small_opts = array ('--font', 'LEGEND:7:mono', '--font', 'AXIS:6:mono', '--font-render-mode', 'normal');
$cmd = array_merge($cmd, $small_opts); $cmd = array_merge($cmd, $small_opts);
} }
@ -735,7 +735,7 @@ function collectd_draw_meta_line(&$opts, &$sources) {
$cmd = array(RRDTOOL, 'graph', '-', '-a', 'PNG', '-w', $config['rrd_width'], '-h', $config['rrd_height'], '-s', -1*$timespan_def['seconds']); $cmd = array(RRDTOOL, 'graph', '-', '-a', 'PNG', '-w', $config['rrd_width'], '-h', $config['rrd_height'], '-s', -1*$timespan_def['seconds']);
if($config['rrd_width'] <= "300") { if($config['rrd_width'] <= "300") {
$small_opts = array ('--font', 'LEGEND:7:'.$config['mono_font'], '--font', 'AXIS:6:'.$config['mono_font'], '--font-render-mode', 'normal'); $small_opts = array ('--font', 'LEGEND:7:mono', '--font', 'AXIS:6:mono', '--font-render-mode', 'normal');
$cmd = array_merge($cmd, $small_opts); $cmd = array_merge($cmd, $small_opts);
} }

View File

@ -10,15 +10,15 @@
## Cisco Enhanced Mempool ## Cisco Enhanced Mempool
if($device['os_type'] == "ios") { if($device['os_type'] == "ios") {
$oids = shell_exec($config['snmpwalk'] . " -m CISCO-ENHANCED-MEMPOOL-MIB -v2c -CI -Osq -c ".$community." ".$hostname.":".$port." cempMemPoolName | sed s/cempMemPoolName.//g"); $oids = shell_exec($config['snmpwalk'] . " -m CISCO-ENHANCED-MEMPOOL-MIB -".$device['snmpver']." -CI -Osq -c ".$community." ".$hostname.":".$port." cempMemPoolName | sed s/cempMemPoolName.//g");
$oids = trim($oids); $oids = trim($oids);
foreach(explode("\n", $oids) as $data) { foreach(explode("\n", $oids) as $data) {
$data = trim($data); $data = trim($data);
if($data) { if($data) {
list($oid, $cempMemPoolName) = explode(" ", $data); list($oid, $cempMemPoolName) = explode(" ", $data);
list($entPhysicalIndex, $Index) = explode(".", $oid); list($entPhysicalIndex, $Index) = explode(".", $oid);
$cempMemPoolType = trim(shell_exec($config['snmpget'] . " -m CISCO-ENHANCED-MEMPOOL-MIB -O qv -v2c -c $community $hostname:$port cempMemPoolType.$oid")); $cempMemPoolType = trim(shell_exec($config['snmpget'] . " -m CISCO-ENHANCED-MEMPOOL-MIB -O qv -".$device['snmpver']." -c $community $hostname:$port cempMemPoolType.$oid"));
$cempMemPoolValid = trim(shell_exec($config['snmpget'] . " -m CISCO-ENHANCED-MEMPOOL-MIB -O qv -v2c -c $community $hostname:$port cempMemPoolValid.$oid")); $cempMemPoolValid = trim(shell_exec($config['snmpget'] . " -m CISCO-ENHANCED-MEMPOOL-MIB -O qv -".$device['snmpver']." -c $community $hostname:$port cempMemPoolValid.$oid"));
if(!strstr($descr, "No") && !strstr($usage, "No") && $cempMemPoolName != "" ) { if(!strstr($descr, "No") && !strstr($usage, "No") && $cempMemPoolName != "" ) {
$descr = str_replace("\"", "", $descr); $descr = str_replace("\"", "", $descr);
$descr = trim($descr); $descr = trim($descr);

View File

@ -9,7 +9,7 @@
## Cisco Processors ## Cisco Processors
if($device['os_type'] == "ios") { if($device['os_type'] == "ios") {
$oids = shell_exec($config['snmpwalk'] . " -m CISCO-PROCESS-MIB -v2c -CI -Osqn -c ".$community." ".$hostname.":".$port." .1.3.6.1.4.1.9.9.109.1.1.1.1.2 | sed s/.1.3.6.1.4.1.9.9.109.1.1.1.1.2.//g"); $oids = shell_exec($config['snmpwalk'] . " -m CISCO-PROCESS-MIB -".$device['snmpver']." -CI -Osqn -c ".$community." ".$hostname.":".$port." .1.3.6.1.4.1.9.9.109.1.1.1.1.2 | sed s/.1.3.6.1.4.1.9.9.109.1.1.1.1.2.//g");
$oids = trim($oids); $oids = trim($oids);
foreach(explode("\n", $oids) as $data) { foreach(explode("\n", $oids) as $data) {
$data = trim($data); $data = trim($data);
@ -17,8 +17,8 @@
list($oid, $entPhysicalIndex) = explode(" ", $data); list($oid, $entPhysicalIndex) = explode(" ", $data);
$usage_oid = "cpmCPUTotal5minRev.$oid"; $usage_oid = "cpmCPUTotal5minRev.$oid";
$descr_oid = "entPhysicalName.$entPhysicalIndex"; $descr_oid = "entPhysicalName.$entPhysicalIndex";
$descr = trim(shell_exec($config['snmpget'] . " -m ENTITY-MIB -O qv -v2c -c $community $hostname:$port $descr_oid")); $descr = trim(shell_exec($config['snmpget'] . " -m ENTITY-MIB -O qv -".$device['snmpver']." -c $community $hostname:$port $descr_oid"));
$usage = trim(shell_exec($config['snmpget'] . " -m CISCO-PROCESS-MIB -O qv -v2c -c $community $hostname:$port $usage_oid")); $usage = trim(shell_exec($config['snmpget'] . " -m CISCO-PROCESS-MIB -O qv -".$device['snmpver']." -c $community $hostname:$port $usage_oid"));
if($entPhysicalIndex == "0") { $descr = "Proc $oid"; } if($entPhysicalIndex == "0") { $descr = "Proc $oid"; }
if(!strstr($descr, "No") && !strstr($usage, "No") && $descr != "" ) { if(!strstr($descr, "No") && !strstr($usage, "No") && $descr != "" ) {
$descr = str_replace("\"", "", $descr); $descr = str_replace("\"", "", $descr);

View File

@ -6,6 +6,7 @@
$cmd = $config['snmpbulkwalk'] . " -m IF-MIB -O nsq -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port']; $cmd = $config['snmpbulkwalk'] . " -m IF-MIB -O nsq -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
$cmd .= " ifDescr"; $cmd .= " ifDescr";
echo("$cmd");
$interfaces = trim(shell_exec($cmd)); $interfaces = trim(shell_exec($cmd));
$interfaces = str_replace("\"", "", $interfaces); $interfaces = str_replace("\"", "", $interfaces);
$interfaces = str_replace("ifDescr.", "", $interfaces); $interfaces = str_replace("ifDescr.", "", $interfaces);

View File

@ -631,7 +631,7 @@ function createHost ($host, $community, $snmpver, $port = 161){
$device = array('hostname' => $host, 'community' => $community, 'snmpver' => $snmpver, 'port' => $port); $device = array('hostname' => $host, 'community' => $community, 'snmpver' => $snmpver, 'port' => $port);
$host_os = getHostOS($device); $host_os = getHostOS($device);
if($host_os) { if($host_os) {
$sql = mysql_query("INSERT INTO `devices` (`hostname`, `sysName`, `community`, `port`, `os`, `status`) VALUES ('$host', '$host', '$community', '$port', '$host_os', '1')"); $sql = mysql_query("INSERT INTO `devices` (`hostname`, `sysName`, `community`, `port`, `os`, `status`,`snmpver`) VALUES ('$host', '$host', '$community', '$port', '$host_os', '1','$snmpver')");
if(mysql_affected_rows()) { if(mysql_affected_rows()) {
$device_id = mysql_result(mysql_query("SELECT device_id FROM devices WHERE hostname = '$host'"),0); $device_id = mysql_result(mysql_query("SELECT device_id FROM devices WHERE hostname = '$host'"),0);
mysql_query("INSERT INTO devices_attribs (attrib_type, attrib_value, device_id) VALUES ('discover','1','$device_id')"); mysql_query("INSERT INTO devices_attribs (attrib_type, attrib_value, device_id) VALUES ('discover','1','$device_id')");

View File

@ -20,19 +20,19 @@ function pollDevice() {
$memrrd = "rrd/" . $device['hostname'] . "-mem.rrd"; $memrrd = "rrd/" . $device['hostname'] . "-mem.rrd";
$memgraph = "public_html/graphs/" . $device['hostname'] . "-mem.png"; $memgraph = "public_html/graphs/" . $device['hostname'] . "-mem.png";
$cmd = $config['snmpget'] . " -O qv -v2c -c ".$community." ".$device['hostname'].":".$device['port']." 1.3.6.1.4.1.9.2.1.58.0 1.3.6.1.4.1.9.2.1.56.0"; $cmd = $config['snmpget'] . " -O qv -".$device['snmpver']." -c ".$community." ".$device['hostname'].":".$device['port']." 1.3.6.1.4.1.9.2.1.58.0 1.3.6.1.4.1.9.2.1.56.0";
list ($cpu5m, $cpu5s) = explode("\n", shell_exec($cmd)); list ($cpu5m, $cpu5s) = explode("\n", shell_exec($cmd));
$cpu5m = $cpu5m + 0; $cpu5m = $cpu5m + 0;
$cpu5s = $cpu5s + 0; $cpu5s = $cpu5s + 0;
$cmd = $config['snmpget'] . " -O qv -v2c -c ".$community." ".$device['hostname'].":".$device['port']." .1.3.6.1.4.1.9.9.13.1.3.1.3.1 .1.3.6.1.4.1.9.9.13.1.3.1.3.2"; $cmd = $config['snmpget'] . " -O qv -".$device['snmpver']." -c ".$community." ".$device['hostname'].":".$device['port']." .1.3.6.1.4.1.9.9.13.1.3.1.3.1 .1.3.6.1.4.1.9.9.13.1.3.1.3.2";
list ($tempin1, $tempout1) = explode("\n", shell_exec($cmd)); list ($tempin1, $tempout1) = explode("\n", shell_exec($cmd));
$tempin1 = $tempin1 +0; $tempin1 = $tempin1 +0;
$tempout1 = $tempout1 + 0; $tempout1 = $tempout1 + 0;
$cmd = $config['snmpget'] . " -O qv -v2c -c ".$community." ".$device['hostname'].":".$device['port']; $cmd = $config['snmpget'] . " -O qv -".$device['snmpver']." -c ".$community." ".$device['hostname'].":".$device['port'];
$cmd .= " .1.3.6.1.4.1.9.9.48.1.1.1.6.2 .1.3.6.1.4.1.9.9.48.1.1.1.6.1 .1.3.6.1.4.1.9.9.48.1.1.1.5.2 .1.3.6.1.4.1.9.9.48.1.1.1.5.1"; $cmd .= " .1.3.6.1.4.1.9.9.48.1.1.1.6.2 .1.3.6.1.4.1.9.9.48.1.1.1.6.1 .1.3.6.1.4.1.9.9.48.1.1.1.5.2 .1.3.6.1.4.1.9.9.48.1.1.1.5.1";
list ($memfreeio, $memfreeproc, $memusedio, $memusedproc) = explode("\n", shell_exec($cmd)); list ($memfreeio, $memfreeproc, $memusedio, $memusedproc) = explode("\n", shell_exec($cmd));

View File

@ -0,0 +1,9 @@
<?php
if(!$os) {
if(strpos($sysDescr, "TG585v7") !== FALSE) { $os = "speedtouch"; }
}
?>

View File

@ -51,7 +51,7 @@
$mem_get = ".1.3.6.1.4.1.9.9.48.1.1.1.6.2 .1.3.6.1.4.1.9.9.48.1.1.1.6.1 .1.3.6.1.4.1.9.9.48.1.1.1.6.3"; $mem_get = ".1.3.6.1.4.1.9.9.48.1.1.1.6.2 .1.3.6.1.4.1.9.9.48.1.1.1.6.1 .1.3.6.1.4.1.9.9.48.1.1.1.6.3";
$mem_get .= ".1.3.6.1.4.1.9.9.48.1.1.1.5.2 .1.3.6.1.4.1.9.9.48.1.1.1.5.1 .1.3.6.1.4.1.9.9.48.1.1.1.5.3"; $mem_get .= ".1.3.6.1.4.1.9.9.48.1.1.1.5.2 .1.3.6.1.4.1.9.9.48.1.1.1.5.1 .1.3.6.1.4.1.9.9.48.1.1.1.5.3";
$mem_raw = shell_exec($config['snmpget'] . " -O qv -v2c -c $community $hostname:$port $mem_get"); $mem_raw = shell_exec($config['snmpget'] . " -O qv -".$device['snmpver']." -c $community $hostname:$port $mem_get");
$mem_raw = str_replace("No Such Instance currently exists at this OID", "0", $mem_raw); $mem_raw = str_replace("No Such Instance currently exists at this OID", "0", $mem_raw);
list ($memfreeio, $memfreeproc, $memfreeprocb, $memusedio, $memusedproc, $memusedprocb) = explode("\n", $mem_raw); list ($memfreeio, $memfreeproc, $memfreeprocb, $memusedio, $memusedproc, $memusedprocb) = explode("\n", $mem_raw);
$memfreeproc = $memfreeproc + $memfreeprocb; $memfreeproc = $memfreeproc + $memfreeprocb;

View File

@ -1,27 +1,27 @@
<?php <?php
if ($device['os'] == "FreeBSD") { if ($device['os'] == "freebsd") {
$sysDescr = str_replace(" 0 ", " ", $sysDescr); $sysDescr = str_replace(" 0 ", " ", $sysDescr);
list(,,$version) = explode (" ", $sysDescr); list(,,$version) = explode (" ", $sysDescr);
$hardware = "i386"; $hardware = "i386";
$features = "GENERIC"; $features = "GENERIC";
} elseif ($device['os'] == "DragonFly") { } elseif ($device['os'] == "dragonfly") {
list(,,$version,,,$features,,$hardware) = explode (" ", $sysDescr); list(,,$version,,,$features,,$hardware) = explode (" ", $sysDescr);
} elseif ($device['os'] == "NetBSD") { } elseif ($device['os'] == "netbsd") {
list(,,$version,,,$features) = explode (" ", $sysDescr); list(,,$version,,,$features) = explode (" ", $sysDescr);
$features = str_replace("(", "", $features); $features = str_replace("(", "", $features);
$features = str_replace(")", "", $features); $features = str_replace(")", "", $features);
list(,,$hardware) = explode ("$features", $sysDescr); list(,,$hardware) = explode ("$features", $sysDescr);
} elseif ($device['os'] == "OpenBSD") { } elseif ($device['os'] == "openbsd") {
list(,,$version,$features,$hardware) = explode (" ", $sysDescr); list(,,$version,$features,$hardware) = explode (" ", $sysDescr);
$features = str_replace("(", "", $features); $features = str_replace("(", "", $features);
$features = str_replace(")", "", $features); $features = str_replace(")", "", $features);
} elseif ($device['os'] == "m0n0wall" || $device['os'] == "Voswall") { } elseif ($device['os'] == "monowall" || $device['os'] == "Voswall") {
list(,,$version,$hardware,$freebsda, $freebsdb, $arch) = split(" ", $sysDescr); list(,,$version,$hardware,$freebsda, $freebsdb, $arch) = split(" ", $sysDescr);
$features = $freebsda . " " . $freebsdb; $features = $freebsda . " " . $freebsdb;
$hardware = "$hardware ($arch)"; $hardware = "$hardware ($arch)";
$hardware = str_replace("\"", "", $hardware); $hardware = str_replace("\"", "", $hardware);
} elseif ($device['os'] == "Linux") { } elseif ($device['os'] == "linux") {
list(,,$version) = explode (" ", $sysDescr); list(,,$version) = explode (" ", $sysDescr);
if(strstr($sysDescr, "386")|| strstr($sysDescr, "486")||strstr($sysDescr, "586")||strstr($sysDescr, "686")) { $hardware = "Generic x86"; } if(strstr($sysDescr, "386")|| strstr($sysDescr, "486")||strstr($sysDescr, "586")||strstr($sysDescr, "686")) { $hardware = "Generic x86"; }
if(strstr($sysDescr, "x86_64")) { $hardware = "Generic x86 64-bit"; } if(strstr($sysDescr, "x86_64")) { $hardware = "Generic x86 64-bit"; }
@ -32,7 +32,7 @@
// Detect Dell hardware via OpenManage SNMP // Detect Dell hardware via OpenManage SNMP
$cmd = $config['snmpget'] . " -m MIB-Dell-10892 -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " .1.3.6.1.4.1.674.10892.1.300.10.1.9.1"; $cmd = $config['snmpget'] . " -m MIB-Dell-10892 -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " .1.3.6.1.4.1.674.10892.1.300.10.1.9.1";
$hw = trim(str_replace("\"", "", `$cmd`)); $hw = trim(str_replace("\"", "", `$cmd`));
if(strstr($hw, "No")) { unset($hw); } else { $hardware = "Dell " . $hw; } if(strpos($hw, "No") !== FALSE) { unset($hw); } else { $hardware = "Dell " . $hw; }
} }
include("ucd-mib.inc.php"); include("ucd-mib.inc.php");

View File

@ -5,6 +5,7 @@ $config['ifname']['asa'] = true;
$config['ifname']['catos'] = true; $config['ifname']['catos'] = true;
$config['ifname']['windows'] = true; $config['ifname']['windows'] = true;
$config['ifname']['powerconnect'] = true; $config['ifname']['powerconnect'] = true;
$config['ifname']['speedtouch'] = true;
## AFI / SAFI pairs for BGP (and other stuff, perhaps) ## AFI / SAFI pairs for BGP (and other stuff, perhaps)
$config['afi']['ipv4']['unicast'] = "IPv4"; $config['afi']['ipv4']['unicast'] = "IPv4";
@ -44,7 +45,7 @@ $os_text['powerconnect'] = "Dell PowerConnect";
$os_text['windows'] = "Microsoft Windows"; $os_text['windows'] = "Microsoft Windows";
$os_text['junos'] = "Juniper JunOS"; $os_text['junos'] = "Juniper JunOS";
$os_text['procurve'] = "HP ProCurve"; $os_text['procurve'] = "HP ProCurve";
$os_text['speedtouch'] = "Thomson Speedtouch";
if(!$config['graph_colours']['greens']) { if(!$config['graph_colours']['greens']) {
$config['graph_colours']['greens'] = array('B6D14B','91B13C','6D912D','48721E','24520F','003300'); $config['graph_colours']['greens'] = array('B6D14B','91B13C','6D912D','48721E','24520F','003300');