a billion changes. **** MAKE SURE TO UPDATE DATABASE AND RUN poll-os.php AND discovery.php -h all **** This is VERY important, as a lot of things have changed! Expect missing files, and another update soon!

git-svn-id: http://www.observium.org/svn/observer/trunk@531 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2009-11-28 09:48:23 +00:00
parent bea6a0667f
commit 7157ec5549
72 changed files with 842 additions and 498 deletions

View File

@@ -65,4 +65,6 @@ ALTER TABLE `interfaces` DROP `in_errors`;
ALTER TABLE `interfaces` DROP `out_errors`;
CREATE TABLE IF NOT EXISTS `cmpMemPool` ( `cmp_id` int(11) NOT NULL auto_increment, `Index` varchar(8) NOT NULL, `cmpName` varchar(32) NOT NULL, `cmpValid` varchar(8) NOT NULL, `device_id` int(11) NOT NULL, `cmpUsed` int(11) NOT NULL, `cmpFree` int(11) NOT NULL, `cmpLargestFree` int(11) NOT NULL, `cmpAlternate` tinyint(4) default NULL, PRIMARY KEY (`cmp_id`), KEY `device_id` (`device_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `hrDevice` ( `hrDevice_id` int(11) NOT NULL auto_increment, `device_id` int(11) NOT NULL, `hrDeviceIndex` int(11) NOT NULL, `hrDeviceDescr` text NOT NULL, `hrDeviceType` text NOT NULL, `hrDeviceErrors` int(11) NOT NULL, `hrDeviceStatus` text NOT NULL, `hrProcessorLoad` tinyint(4) default NULL, PRIMARY KEY (`hrDevice_id`), KEY `device_id` (`device_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
ALTER TABLE `entPhysical` ADD `entPhysicalHardwareRev` VARCHAR( 16 ) NULL AFTER `entPhysicalName` ,ADD `entPhysicalFirmwareRev` VARCHAR( 16 ) NULL AFTER `entPhysicalHardwareRev` ,ADD `entPhysicalSoftwareRev` VARCHAR( 16 ) NULL AFTER `entPhysicalFirmwareRev` ,ADD `entPhysicalAlias` VARCHAR( 32 ) NULL AFTER `entPhysicalSoftwareRev` ,ADD `entPhysicalAssetID` VARCHAR( 32 ) NULL AFTER `entPhysicalAlias` ,ADD `entPhysicalIsFRU` VARCHAR( 8 ) NULL AFTER `entPhysicalAssetID`;
ALTER TABLE `devices` ADD `last_discovered` timestamp NULL DEFAULT NULL AFTER `last_polled`;
ALTER TABLE `devices` CHANGE `lastchange` `uptime` BIGINT NULL DEFAULT NULL;

View File

@@ -1,2 +0,0 @@
Since 0.6.0
interfaces table added field `ifName` VARCHAR(64)

View File

@@ -46,7 +46,9 @@ $devices_discovered = 0;
$device_query = mysql_query("SELECT * FROM `devices` WHERE status = '1' $where ORDER BY device_id DESC");
while ($device = mysql_fetch_array($device_query)) {
echo($device['hostname'] ."\n");
echo($device['hostname'] . " ".$device['device_id']." ".$device['os']." ");
if($os_groups[$device[os]]) {$device['os_group'] = $os_groups[$device[os]]; echo "(".$device['os_group'].")";}
echo("\n");
## Discover Interfaces
include("includes/discovery/interfaces.php");
@@ -73,8 +75,7 @@ while ($device = mysql_fetch_array($device_query)) {
if($device['os'] == "JunOS") { include("includes/discovery/bgp-peers.php"); }
if($device['os'] == "IOS" || $device['os'] == "IOS XE" || $device['os'] == "CatOS" || $device['os'] == "ASA") {
if($device['os'] == "powerconnect" || $device['os'] == "ios" || $device['os'] == "iosxe" || $device['os'] == "catos" || $device['os'] == "asa" || $device['os'] == "pix") {
include("includes/discovery/cisco-vlans.php");
include("includes/discovery/bgp-peers.php");
include("includes/discovery/cisco-mac-accounting.php");
@@ -86,8 +87,12 @@ while ($device = mysql_fetch_array($device_query)) {
include("includes/discovery/cisco-cdp.inc.php");
}
$update_query = "UPDATE `devices` SET ";
$update .= " `last_discovered` = NOW()";
$update_query .= " WHERE `device_id` = '" . $device['device_id'] . "'";
$update_result = mysql_query($update_query);
echo("\n"); $devices_discovered++;
mysql_query("DELETE FROM `devices_attribs` WHERE `device_id` = '".$device['device_id']."' AND `attrib_type` = 'discover'");
}
$end = utime(); $run = $end - $start;

View File

@@ -72,162 +72,7 @@ if($_GET['debug']) {
imagepng($im);
imagedestroy($im);
}
} else {
switch ($type) {
case 'cisco_entity_sensor':
$graph = graph_entity_sensor ($_GET['a'], $graphfile, $from, $to, $width, $height, $title, $vertical);
break;
case 'fortigate_sessions':
$graph = graph_fortigate_sessions ($hostname . "/fortigate-sessions.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
break;
case 'fortigate_cpu':
$graph = graph_fortigate_cpu ($hostname . "/fortigate-cpu.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
break;
case 'fortigate_memory':
$graph = graph_fortigate_memory ($hostname . "/fortigate-memory.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
break;
case 'netscreen_sessions':
$graph = graph_netscreen_sessions ($hostname . "/netscreen-sessions.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
break;
case 'netscreen_cpu':
$graph = graph_netscreen_cpu ($hostname . "/netscreen-cpu.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
break;
case 'netscreen_memory':
$graph = graph_netscreen_memory ($hostname . "/netscreen-memory.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
break;
case 'multi_bits_duo':
$groups = array($_GET['interfaces'], $_GET['interfaces_b']);
$graph = graph_multi_bits_duo ($groups, $graphfile, $from, $to, $width, $height, $title, $vertical, $inverse, $legend);
break;
case 'multi_bits_trio':
$groups = array($_GET['interfaces'], $_GET['interfaces_b'], $_GET['interfaces_c']);
$graph = graph_multi_bits_trio ($groups, $graphfile, $from, $to, $width, $height, $title, $vertical, $inverse, $legend);
break;
case 'adsl_rate':
$graph = graph_adsl_rate ($hostname. "/adsl-4.rrd", $graphfile, $from, $to, $width, $height);
break;
case 'adsl_snr':
$graph = graph_adsl_snr ($hostname. "/adsl-4.rrd", $graphfile, $from, $to, $width, $height);
break;
case 'adsl_atn':
$graph = graph_adsl_atn ($hostname. "/adsl-4.rrd", $graphfile, $from, $to, $width, $height);
break;
case 'global_bits':
$graph = graph_global_bits ("global_bits.png", $from, $to, $width, $height);
break;
case 'mac_acc_int':
$graph = graph_mac_acc_interface ($_GET['if'], $graphfile, $from, $to, $width, $height, $title, $vertical);
break;
case 'mac_acc_pkts':
$graph = graph_mac_pkts ($_GET['id'], $graphfile, $from, $to, $width, $height, $title, $vertical);
break;
case 'mac_acc':
case 'mac_acc_bits':
$graph = graph_mac_acc ($_GET['id'], $graphfile, $from, $to, $width, $height, $title, $vertical);
break;
case 'unixfs_dev':
$graph = unixfsgraph_dev ($device_id, $graphfile, $from, $to, $width, $height, $title, $vertical);
break;
case 'unixfs':
$graph = unixfsgraph ($_GET['id'], $graphfile, $from, $to, $width, $height, $title, $vertical);
break;
case 'bgp_updates':
$bgpPeerIdentifier = mysql_result(mysql_query("SELECT bgpPeerIdentifier FROM bgpPeers WHERE bgpPeer_id = '".$_GET['peer']."'"),0);
$graph = bgpupdatesgraph ($hostname . "/bgp-" . $bgpPeerIdentifier . ".rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
break;
case 'cbgp_prefixes':
$bgpPeerIdentifier = mysql_result(mysql_query("SELECT bgpPeerIdentifier FROM bgpPeers WHERE bgpPeer_id = '".$_GET['peer']."'"),0);
$graph = graph_cbgp_prefixes ($hostname . "/cbgp-" . $bgpPeerIdentifier . ".".$_GET['afi'].".".$_GET['safi'].".rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
break;
case 'calls':
$graph = callsgraphSNOM ($hostname . "/data.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
break;
case 'dev_cpmCPU':
$graph = graph_device_cpmCPU ($device_id, $graphfile, $from, $to, $width, $height, $title, $vertical);
break;
case 'cpmCPU':
$graph = graph_cpmCPU ($_GET['id'], $graphfile, $from, $to, $width, $height, $title, $vertical);
break;
case 'temp':
$graph = temp_graph ($_GET['id'], $graphfile, $from, $to, $width, $height, $title, $vertical);
break;
case 'dev_temp':
$graph = temp_graph_dev ($device_id, $graphfile, $from, $to, $width, $height, $title, $vertical);
break;
case 'cempMemPool':
$graph = graph_cempMemPool ($_GET['id'], $graphfile, $from, $to, $width, $height, $title, $vertical);
break;
case 'mem':
if($os == "Linux" || $os == "FreeBSD" || $os == "DragonFly" || $os == "OpenBSD" || $os == "NetBSD" ) {
$graph = memgraphUnix ($hostname . "/mem.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
} elseif($os == "IOS" || $os == "IOS XE") {
$graph = graph_device_cempMemPool ($device_id, $graphfile, $from, $to, $width, $height, $title, $vertical);
} elseif($os == "CatOS") {
$graph = memgraph ($hostname . "/mem.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
} elseif($os == "Windows") {
} elseif($os == "ProCurve") {
$graph = memgraphHP ($hostname . "/mem.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
}
break;
case 'load':
if($os == "Linux" || $os == "FreeBSD" || $os == "DragonFly" || $os == "OpenBSD" || $os == "NetBSD" ) {
$graph = loadgraphUnix ($hostname . "/load.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
} elseif($os == "IOS" || $os == "IOS XE") {
$graph = loadgraph ($hostname . "/load.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
} elseif($os == "Windows") {
$graph = loadgraphwin ($hostname . "/load.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
}
break;
case 'users':
if($os == "Linux" || $os == "FreeBSD" || $os == "DragonFly" || $os == "OpenBSD" || $os == "NetBSD" ) {
$graph = usersgraphUnix ($hostname . "/sys.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
} elseif($os == "Windows") {
$graph = usersgraphwin ($hostname . "/sys.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
}
break;
case 'procs':
if($os == "Linux" || $os == "FreeBSD" || $os == "DragonFly" || $os == "OpenBSD" || $os == "NetBSD" ) {
$graph = procsgraphUnix ($hostname . "/sys.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
} elseif($os == "Windows") {
$graph = procsgraphwin ($hostname . "/sys.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
}
break;
case 'unixfs':
if($os == "Linux" || $os == "FreeBSD" || $os == "DragonFly" || $os == "OpenBSD" || $os == "NetBSD" ) {
$graph = unixfsgraph ($device_id, $graphfile, $from, $to, $width, $height, $title, $vertical);
}
break;
case 'postfix':
case 'mail':
if($os == "Linux" || $os == "FreeBSD" || $os == "DragonFly" || $os == "OpenBSD") {
$graph = mailsgraphUnix ($hostname . "/mailstats.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
}
break;
case 'mailerrors':
case 'postfixerrors':
if($os == "Linux" || $os == "FreeBSD" || $os == "DragonFly" || $os == "OpenBSD") {
$graph = mailerrorgraphUnix ($hostname, $graphfile, $from, $to, $width, $height, $title, $vertical);
}
break;
case 'courier':
if($os == "Linux" || $os == "FreeBSD" || $os == "DragonFly" || $os == "OpenBSD") {
$graph = couriergraphUnix ($hostname . "/courierstats.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
}
break;
case 'apachehits':
if($os == "Linux" || $os == "FreeBSD" || $os == "DragonFly" || $os == "OpenBSD") {
$graph = apachehitsgraphUnix ($hostname . "/apache.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
}
break;
case 'apachebits':
if($os == "Linux" || $os == "FreeBSD" || $os == "DragonFly" || $os == "OpenBSD") {
$graph = apachebitsgraphUnix ($hostname . "/apache.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
}
break;
default:
break;
} // End SWITCH
}
if($graph) {
header('Content-type: image/png');
@@ -245,7 +90,7 @@ if($_GET['debug']) {
$delete = `rm $graphfile`;
} // End IF
# } // End IF
?>

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 850 B

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1 @@
<div class='errorbox' style='font-weight: bold;'><img src='images/16/error.png' align='absmiddle' /> Insufficient permissions to view this page</div>

View File

@@ -12,8 +12,8 @@ include("common.inc.php");
if($iter=="1") {$colour="CC0000";} elseif($iter=="2") {$colour="008C00";} elseif($iter=="3") {$colour="4096EE";
} elseif($iter=="4") {$colour="73880A";} elseif($iter=="5") {$colour="D01F3C";} elseif($iter=="6") {$colour="36393D";
} elseif($iter=="7") {$colour="FF0084"; $iter = "0"; }
$descr = str_pad($fs[hrStorageDescr], 14);
$descr = substr($descr,0,14);
$descr = substr(str_pad($fs[hrStorageDescr], 12),0,12);
$descr = str_replace(":","\:",$descr);
$rrd = $config['rrd_dir'] . "/$hostname/hrStorage-".$fs['hrStorageIndex'].".rrd";
$rrd_options .= " DEF:$fs[storage_id]=$rrd:used:AVERAGE";
$rrd_options .= " DEF:$fs[storage_id]s=$rrd:size:AVERAGE";

View File

@@ -0,0 +1,67 @@
<?php
include("common.inc.php");
$rrd_filename_4 = $config['rrd_dir'] . "/" . $hostname . "/ipSystemStats-ipv4.rrd";
$rrd_filename_6 = $config['rrd_dir'] . "/" . $hostname . "/ipSystemStats-ipv6.rrd";
$rrd_options .= " DEF:InForwDatagrams_4=$rrd_filename_4:InForwDatagrams:AVERAGE";
$rrd_options .= " DEF:OutForwDatagrams_4=$rrd_filename_4:OutForwDatagrams:AVERAGE";
$rrd_options .= " DEF:InDelivers_4=$rrd_filename_4:InDelivers:AVERAGE";
$rrd_options .= " DEF:InReceives_4=$rrd_filename_4:InReceives:AVERAGE";
$rrd_options .= " DEF:OutRequests_4=$rrd_filename_4:OutRequests:AVERAGE";
$rrd_options .= " DEF:InDiscards_4=$rrd_filename_4:InDiscards:AVERAGE";
$rrd_options .= " DEF:OutDiscards_4=$rrd_filename_4:OutDiscards:AVERAGE";
$rrd_options .= " DEF:OutNoRoutes_4=$rrd_filename_4:InDiscards:AVERAGE";
$rrd_options .= " DEF:InForwDatagrams_6=$rrd_filename_6:InForwDatagrams:AVERAGE";
$rrd_options .= " DEF:OutForwDatagrams_6=$rrd_filename_6:OutForwDatagrams:AVERAGE";
$rrd_options .= " DEF:InDelivers_6=$rrd_filename_6:InDelivers:AVERAGE";
$rrd_options .= " DEF:InReceives_6=$rrd_filename_6:InReceives:AVERAGE";
$rrd_options .= " DEF:OutRequests_6=$rrd_filename_6:OutRequests:AVERAGE";
$rrd_options .= " DEF:InDiscards_6=$rrd_filename_6:InDiscards:AVERAGE";
$rrd_options .= " DEF:OutDiscards_6=$rrd_filename_6:OutDiscards:AVERAGE";
$rrd_options .= " DEF:OutNoRoutes_6=$rrd_filename_6:InDiscards:AVERAGE";
$rrd_options .= " COMMENT:'Packets/sec Current Average Maximum\\n'";
$rrd_options .= " LINE1.25:InForwDatagrams_4#cc0000:InForwDgrams.4";
$rrd_options .= " GPRINT:InForwDatagrams_4:LAST:%6.2lf%s";
$rrd_options .= " GPRINT:InForwDatagrams_4:AVERAGE:%6.2lf%s";
$rrd_options .= " GPRINT:InForwDatagrams_4:MAX:%6.2lf%s\\\\n";
$rrd_options .= " LINE1.25:InForwDatagrams_6#cc0000:' .6'";
$rrd_options .= " GPRINT:InForwDatagrams_6:LAST:%6.2lf%s";
$rrd_options .= " GPRINT:InForwDatagrams_6:AVERAGE:%6.2lf%s";
$rrd_options .= " GPRINT:InForwDatagrams_6:MAX:%6.2lf%s\\\\n";
$rrd_options .= " LINE1.25:InDelivers_4#00cc00:'InDelivers .4'";
$rrd_options .= " GPRINT:InDelivers_4:LAST:%6.2lf%s";
$rrd_options .= " GPRINT:InDelivers_4:AVERAGE:%6.2lf%s";
$rrd_options .= " GPRINT:InDelivers_4:MAX:%6.2lf%s\\\\n";
$rrd_options .= " LINE1.25:InDelivers_6#00cc00:' .6'";
$rrd_options .= " GPRINT:InDelivers_6:LAST:%6.2lf%s";
$rrd_options .= " GPRINT:InDelivers_6:AVERAGE:%6.2lf%s";
$rrd_options .= " GPRINT:InDelivers_6:MAX:%6.2lf%s\\\\n";
$rrd_options .= " LINE1.25:InReceives_4#006600:'InReceives .4'";
$rrd_options .= " GPRINT:InReceives_4:LAST:%6.2lf%s";
$rrd_options .= " GPRINT:InReceives_4:AVERAGE:%6.2lf%s";
$rrd_options .= " GPRINT:InReceives_4:MAX:%6.2lf%s\\\\n";
$rrd_options .= " LINE1.25:InReceives_6#006600:' .6'";
$rrd_options .= " GPRINT:InReceives_6:LAST:%6.2lf%s";
$rrd_options .= " GPRINT:InReceives_6:AVERAGE:%6.2lf%s";
$rrd_options .= " GPRINT:InReceives_6:MAX:%6.2lf%s\\\\n";
$rrd_options .= " LINE1.25:OutRequests_4#0000cc:'OutRequests .4'";
$rrd_options .= " GPRINT:OutRequests_4:LAST:%6.2lf%s";
$rrd_options .= " GPRINT:OutRequests_4:AVERAGE:%6.2lf%s";
$rrd_options .= " GPRINT:OutRequests_4:MAX:%6.2lf%s\\\\n";
$rrd_options .= " LINE1.25:OutRequests_6#0000cc:' .6'";
$rrd_options .= " GPRINT:OutRequests_6:LAST:%6.2lf%s";
$rrd_options .= " GPRINT:OutRequests_6:AVERAGE:%6.2lf%s";
$rrd_options .= " GPRINT:OutRequests_6:MAX:%6.2lf%s\\\\n";
?>

View File

@@ -1,5 +1,7 @@
<?php
$scale_min = "0";
include("common.inc.php");
$rrd_filename = $config['rrd_dir'] . "/" . $hostname . "/procurve-mem.rrd";
@@ -8,6 +10,11 @@ $rrd_options .= " -b 1024";
$rrd_options .= " DEF:TOTAL=$rrd_filename:TOTAL:AVERAGE";
$rrd_options .= " DEF:FREE=$rrd_filename:FREE:AVERAGE";
$rrd_options .= " DEF:USED=$rrd_filename:USED:AVERAGE";
$rrd_options .= " DEF:FREE_max=$rrd_filename:FREE:MAX";
$rrd_options .= " DEF:USED_max=$rrd_filename:USED:MAX";
$rrd_options .= " DEF:FREE_min=$rrd_filename:FREE:MIN";
$rrd_options .= " DEF:USED_min=$rrd_filename:USED:MIN";
$rrd_options .= " CDEF:tot=FREE,USED,+";
$rrd_options .= " COMMENT:'Bytes Current Average Maximum\\n'";
@@ -20,6 +27,8 @@ $rrd_options .= " AREA:FREE#e5e5e5:free:STACK";
$rrd_options .= " GPRINT:FREE:LAST:\ \ \ %7.2lf%sB";
$rrd_options .= " GPRINT:FREE:AVERAGE:%7.2lf%sB";
$rrd_options .= " GPRINT:FREE:MAX:%7.2lf%sB\\\\n";
$rrd_options .= " LINE1:TOTAL#e5e5e5:";
$rrd_options .= " LINE1.5:USED#c03030:";
$rrd_options .= " LINE1.5:TOTAL#808080:";
?>

View File

@@ -12,12 +12,14 @@
$image = getImage($device['device_id']);
$device['os_text'] = $os_text[$device[os]];
echo(" <tr bgcolor='$bg' onmouseover=\"this.style.backgroundColor='#fdd';\" onmouseout=\"this.style.backgroundColor='$bg';\"
onclick=\"location.href='/device/".$device['device_id']."/'\" style='cursor: hand;'>
<td width='40' align=center valign=middle>$image</td>
<td width='300'><span style='font-weight: bold; font-size: 14px;'>" . generatedevicelink($device) . "</span>
<br />$device[sysName]</td>
<td width='200'>$device[os]<br />
<td width='200'>$device[os_text]<br />
$device[version]</td>
<td width='200'>$device[hardware]<br />
$device[features]</td>

View File

@@ -78,7 +78,7 @@
# if($interface[ifDuplex] != unknown) { echo("<span class=box-desc>Duplex " . $interface['ifDuplex'] . "</span>"); } else { echo("-"); }
if($device['os'] == "IOS" || $device['os'] == "IOS XE") {
if($device['os'] == "ios" || $device['os'] == "iosxe") {
if($interface['ifTrunk']) {
echo("<span class=box-desc><span class=red>" . $interface['ifTrunk'] . "</span></span>");
} elseif ($interface['ifVlan']) {

View File

@@ -10,8 +10,8 @@
$query_a = mysql_query("SELECT * FROM `devices`");
while($device = mysql_fetch_array($query_a)) {
if($device['status'] == 0 && $device['ignore'] == '0') { $this_alert = "1"; } elseif($device['ignore'] == '0') {
if(mysql_result(mysql_query("SELECT count(service_id) FROM services WHERE service_status = '0' AND service_host = '$device[id]'"),0)) { $this_alert = "1"; }
if(mysql_result(mysql_query("SELECT count(*) FROM interfaces WHERE `ifOperStatus` = 'down' AND `ifAdminStatus` = 'up' AND device_id = '" . $device[device_id] . "'"),0)) { $this_alert = "1"; }
if(mysql_result(mysql_query("SELECT count(service_id) FROM services WHERE service_status = '0' AND service_host = '".$device['device_id']."'"),0)) { $this_alert = "1"; }
if(mysql_result(mysql_query("SELECT count(*) FROM interfaces WHERE `ifOperStatus` = 'down' AND `ifAdminStatus` = 'up' AND device_id = '" . $device['device_id'] . "'"),0)) { $this_alert = "1"; }
}
if($this_alert) {
$device_alerts++;

View File

@@ -0,0 +1,5 @@
<?php
## REWRITE THIS
?>

View File

@@ -54,7 +54,7 @@
$prev_customer = $customer;
}
if($device['os'] == "IOS") {
if($device['os'] == "ios") {
if($interface['ifTrunk']) { $vlan = "<span class=box-desc><span class=red>" . $interface['ifTrunk'] . "</span></span>";
} elseif ($interface['ifVlan']) { $vlan = "<span class=box-desc><span class=blue>VLAN " . $interface['ifVlan'] . "</span></span>";

View File

@@ -7,28 +7,24 @@ while($device = mysql_fetch_array($device_query)) {
echo("<div style='clear: both;'>");
$os = strtolower(str_replace(" ", "_", $device['os']));
if(is_file($config['install_dir'] . "/html/pages/device/graphs/os-$os.inc.php")) {
include($config['install_dir'] . "/html/pages/device/graphs/os-$os.inc.php");
}
if($os_groups[$device[os]]) {$os_group = $os_groups[$device[os]];}
if(is_file($config['install_dir'] . "/html/pages/device/graphs/os-".$device['os'].".inc.php")) {
/// OS Specific
include($config['install_dir'] . "/html/pages/device/graphs/os-".$device['os'].".inc.php");
}elseif($os_group && is_file($config['install_dir'] . "/html/pages/device/graphs/os-".$os_group.".inc.php")) {
/// OS Group Specific
include($config['install_dir'] . "/html/pages/device/graphs/os-".$os_group.".inc.php");
} else {
switch ($device['os']) {
case "JunOS":
echo("<div class=graphhead>Processor Utilisation</div>");
$graph_type = "device_cpu"; include ("includes/print-device-graph.php");
if(mysql_result(mysql_query("SELECT count(*) FROM temperature WHERE temp_host = '" . $device['device_id'] . "'"),0)) {
echo("<div class=graphhead>Temperatures</div>");
$graph_type = "dev_temperatures"; include ("includes/print-device-graph.php");
echo("<br />");
}
include("graphs/netstats.inc.php");
include("graphs/uptime.inc.php");
break;
case "Fortigate":
case "fortigate":
echo("<div class=graphhead>Processor Utilisation</div>");
$graph_type = "fortigate_cpu"; include ("includes/print-device-graph.php");
echo("<div class=graphhead>Memory Usage</div>");
@@ -41,7 +37,7 @@ while($device = mysql_fetch_array($device_query)) {
break;
case "BCM96348":
case "bcm96348":
echo("<div class=graphhead>ADSL Attainable Rate</div>");
$graph_type = "adsl_rate"; include ("includes/print-device-graph.php");
echo("<br />");
@@ -57,7 +53,7 @@ while($device = mysql_fetch_array($device_query)) {
break;
case "ScreenOS":
case "screenos":
echo("<div class=graphhead>Processor Utilisation</div>");
$graph_type = "netscreen_cpu"; include ("includes/print-device-graph.php");
echo("<div class=graphhead>Memory Usage</div>");
@@ -82,106 +78,14 @@ while($device = mysql_fetch_array($device_query)) {
$graph_type = "device_uptime"; include ("includes/print-device-graph.php"); break;
echo("<br />");
break;
case "Windows":
echo("<div class=graphhead>CPU Usage</div>");
$graph_type = "device_cpu";
include ("includes/print-device-graph.php");
echo("<div class=graphhead>Memory Utilisation</div>");
$graph_type = "device_memory"; include ("includes/print-device-graph.php");
echo("<br />");
if(mysql_result(mysql_query("SELECT count(storage_id) FROM storage WHERE host_id = '" . $device['device_id'] . "'"),0)) {
echo("<div class=graphhead>Storage</div>");
$graph_type = "device_hrstorage"; include ("includes/print-device-graph.php");
echo("<br />");
}
if(mysql_result(mysql_query("SELECT count(*) FROM temperature WHERE temp_host = '" . $device['device_id'] . "'"),0)) {
echo("<div class=graphhead>Temperatures</div>");
$graph_type = "device_temperatures"; include ("includes/print-device-graph.php");
echo("<br />");
}
include("graphs/netstats.inc.php");
include("graphs/uptime.inc.php");
# $memgraph = memgraphWin ($device[hostname] . "-mem.rrd", $device[hostname] . "-mem.png", $day, $now, 335, 100);
# $loadgraph = loadgraphWin ($device[hostname] . "-load.rrd", $device[hostname] . "-load.png", $day, $now, 335, 100);
# $cpugraphm = cpugraphWin ($device[hostname] . "-cpu.rrd", $device[hostname] . "-cpu-m.png", $month, $now, 335, 100);
# $memgraphm = memgraphWin ($device[hostname] . "-mem.rrd", $device[hostname] . "-mem-m.png", $month, $now, 335, 100);
# $loadgraphm = loadgraphWin ($device[hostname] . "-load.rrd", $device[hostname] . "-load-m.png", $month, $now, 335, 100);
# $usersgraph = usersgraphWin ($device[hostname] . "-sys.rrd", $device[hostname] . "-users.png", $day, $now, 335, 100);
# $usersgraphm = usersgraphWin ($device[hostname] . "-sys.rrd", $device[hostname] . "-users-m.png", $month, $now, 335, 100);
# $procsgraph = procsgraphWin ($device[hostname] . "-sys.rrd", $device[hostname] . "-procs.png", $day, $now, 335, 100);
# $procsgraphm = procsgraphWin ($device[hostname] . "-sys.rrd", $device[hostname] . "-procs-m.png", $month, $now, 335, 100);
break;
case "FreeBSD":
case "NetBSD":
case "Linux":
case "m0n0wall":
case "Voswall":
case "DragonFly":
case "OpenBSD":
case "pfSense":
echo("<div class=graphhead>Processor Utilisation</div>");
$graph_type = "device_cpu"; include ("includes/print-device-graph.php");
echo("<br />");
if($device[os] == "m0n0wall" || $device[os] == "pfSense" || $device[os] == "Voswall" || $device[monowall]) {
echo("<div class=graphhead>IP Statistics</div>");
$graph_type = "device_ip"; include ("includes/print-device-graph.php");
echo("<br />");
echo("<div class=graphhead>Device Uptime</div>");
$graph_type = "device_uptime"; include ("includes/print-device-graph.php");
break;
}
if($device['os'] != "NetBSD") {
echo("<div class=graphhead>Memory Utilisation</div>");
$graph_type = "device_memory"; include ("includes/print-device-graph.php");
echo("<br />");
}
if(mysql_result(mysql_query("SELECT count(storage_id) FROM storage WHERE host_id = '" . $device['device_id'] . "'"),0)) {
echo("<div class=graphhead>Storage</div>");
$graph_type = "device_hrstorage"; include ("includes/print-device-graph.php");
echo("<br />");
}
if(mysql_result(mysql_query("SELECT count(*) FROM temperature WHERE temp_host = '" . $device['device_id'] . "'"),0)) {
echo("<div class=graphhead>Temperatures</div>");
$graph_type = "device_temperatures"; include ("includes/print-device-graph.php");
echo("<br />");
}
include("graphs/netstats.inc.php");
include("graphs/uptime.inc.php");
echo("<div class=graphhead>System Load</div>");
$graph_type = "device_load"; include ("includes/print-device-graph.php");
echo("<br />");
echo("<div class=graphhead>Users Logged On</div>");
$graph_type = "device_hrusers"; include ("includes/print-device-graph.php");
echo("<br />");
echo("<div class=graphhead>Running Processes</div>");
$graph_type = "device_hrprocesses"; include ("includes/print-device-graph.php");
echo("<br />");
break;
case "CatOS":
break;
case "IOS":
case "IOS XE":
break;
case "Snom":
echo("<div class=graphhead>Calls</div>");
$graph_type = "snom_calls"; include ("includes/print-device-graph.php");
}
}
if($memgraph) {
echo("<img src='$memgraph'> <img src='$memgraphm'>");
}

View File

@@ -0,0 +1,7 @@
<?php
echo("<div class=graphhead>Processor Utilisation</div>");
$graph_type = "device_cpu"; include ("includes/print-device-graph.php");
?>

View File

@@ -0,0 +1,5 @@
<?php
echo("<div class=graphhead>Running Processes</div>");
$graph_type = "device_hrprocesses"; include ("includes/print-device-graph.php");
echo("<br />");
?>

View File

@@ -0,0 +1,9 @@
<?php
if(mysql_result(mysql_query("SELECT count(storage_id) FROM storage WHERE host_id = '" . $device['device_id'] . "'"),0)) {
echo("<div class=graphhead>Storage</div>");
$graph_type = "device_hrstorage"; include ("includes/print-device-graph.php");
echo("<br />");
}
?>

View File

@@ -0,0 +1,5 @@
<?php
echo("<div class=graphhead>Users Logged On</div>");
$graph_type = "device_hrusers"; include ("includes/print-device-graph.php");
echo("<br />");
?>

View File

@@ -0,0 +1,8 @@
<?php
echo("<div class=graphhead>System Load</div>");
$graph_type = "device_load"; include ("includes/print-device-graph.php");
echo("<br />");
?>

View File

@@ -0,0 +1,5 @@
<?php
echo("<div class=graphhead>Memory Utilisation</div>");
$graph_type = "device_memory"; include ("includes/print-device-graph.php");
echo("<br />");
?>

View File

@@ -19,5 +19,4 @@
$graph_type = "device_icmp_informational"; include ("includes/print-device-graph.php");
echo("<br />");
?>

View File

@@ -1,18 +1,12 @@
<?php
echo("<div class=graphhead>CPU Usage</div>");
$graph_type = "device_cpu"; include ("includes/print-device-graph.php");
echo("<br />");
echo("<div class=graphhead>Memory Usage</div>");
$graph_type = "device_memory"; include ("includes/print-device-graph.php");
echo("<br />");
if(mysql_result(mysql_query("SELECT count(*) FROM temperature WHERE temp_host = '" . $device['device_id'] . "'"),0)) {
echo("<div class=graphhead>Temperatures</div>");
$graph_type = "device_temperatures"; include ("includes/print-device-graph.php");
echo("<br />");
}
include("cpu.inc.php");
include("memory.inc.php");
include("temperatures.inc.php");
include("netstats.inc.php");
include("uptime.inc.php");
include("netstats.inc.php");
include("uptime.inc.php");
?>

View File

@@ -1,5 +0,0 @@
<?php
include("os-ios.inc.php");
?>

View File

@@ -0,0 +1,6 @@
<?php
include("graphs/cpu.inc.php");
include("graphs/temperatures.inc.php");
include("graphs/netstats.inc.php");
include("graphs/uptime.inc.php");
?>

View File

@@ -1,5 +0,0 @@
<?php
include("os-unix.inc.php");
?>

View File

@@ -1,4 +1,13 @@
<?php
include("cpu.inc.php");
include("memory.inc.php");
include("hrstorage.inc.php");
include("temperatures.inc.php");
include("netstats.inc.php");
include("laload.inc.php");
include("hrusers.inc.php");
include("hrprocesses.inc.php");
include("uptime.inc.php");
?>

View File

@@ -0,0 +1,18 @@
<?php
include("cpu.inc.php");
include("memory.inc.php");
include("hrstorage.inc.php");
include("temperatures.inc.php");
include("netstats.inc.php");
include("laload.inc.php");
include("hrusers.inc.php");
include("hrprocesses.inc.php");
include("uptime.inc.php");
# $usersgraph = usersgraphWin ($device[hostname] . "-sys.rrd", $device[hostname] . "-users.png", $day, $now, 335, 100);
# $usersgraphm = usersgraphWin ($device[hostname] . "-sys.rrd", $device[hostname] . "-users-m.png", $month, $now, 335, 100);
# $procsgraph = procsgraphWin ($device[hostname] . "-sys.rrd", $device[hostname] . "-procs.png", $day, $now, 335, 100);
# $procsgraphm = procsgraphWin ($device[hostname] . "-sys.rrd", $device[hostname] . "-procs-m.png", $month, $now, 335, 100);
?>

View File

@@ -0,0 +1,7 @@
<?php
if(mysql_result(mysql_query("SELECT count(*) FROM temperature WHERE temp_host = '" . $device['device_id'] . "'"),0)) {
echo("<div class=graphhead>Temperatures</div>");
$graph_type = "device_temperatures"; include ("includes/print-device-graph.php");
echo("<br />");
}
?>

View File

@@ -1,8 +1,5 @@
<?php
echo("<div class=graphhead>Device Uptime</div>");
$graph_type = "device_uptime"; include ("includes/print-device-graph.php");
echo("<br />");
?>

View File

@@ -68,13 +68,11 @@ while($peer = mysql_fetch_array($sql)){
}
$sql = mysql_query("SELECT * FROM `devices` AS D, devices_attribs AS A WHERE A.device_id = D.device_id AND A.attrib_type = 'uptime' AND A.attrib_value < '84600'");
$sql = mysql_query("SELECT * FROM `devices` WHERE status = '1' AND `uptime` < '84600'");
while($device = mysql_fetch_array($sql)){
generate_front_box("info", "<center><strong>".generatedevicelink($device, shorthost($device['hostname']))."</strong><br />
<span style='font-size: 14px; font-weight: bold; margin: 5px; color: #009;'>Device<br />Rebooted</span><br />
<span class=body-date-1>".formatUptime($device['attrib_value'], 'short')."</span>
<span class=body-date-1>".formatUptime($device['uptime'], 'short')."</span>
</center>");
}

View File

@@ -7,24 +7,6 @@
?>
<?php
$nodes = array();
$sql = mysql_query("SELECT * FROM `devices` AS D, `devices_attribs` AS A WHERE D.status = '1' AND A.device_id = D.device_id AND A.attrib_type = 'uptime' AND A.attrib_value > '0' AND A.attrib_value < '86400'");
while($device = mysql_fetch_array($sql)){
unset($already);
$i = 0;
while ($i <= count($nodes)) {
$thisnode = $device['device_id'];
if ($nodes[$i] == $thisnode) {
$already = "yes";
}
$i++;
}
if(!$already) { $nodes[] = $device['device_id']; }
}
$sql = mysql_query("SELECT * FROM `devices` WHERE `status` = '0' AND `ignore` = '0'");
while($device = mysql_fetch_array($sql)){
@@ -72,15 +54,13 @@ while($peer = mysql_fetch_array($sql)){
}
$sql = mysql_query("SELECT * FROM `devices` AS D, devices_attribs AS A WHERE A.device_id = D.device_id AND D.status = '1' AND A.attrib_type = 'uptime' AND A.attrib_value < '84600'");
$sql = mysql_query("SELECT * FROM `devices` WHERE status = '1' AND `uptime` < '84600'");
while($device = mysql_fetch_array($sql)){
echo("<div style='border: solid 2px #d0D0D0; float: left; padding: 5px; width: 120px; height: 90px; background: #ddffdd; margin: 4px;'>
<center><strong>".generatedevicelink($device, shorthost($device['hostname']))."</strong><br />
<span style='font-size: 14px; font-weight: bold; margin: 5px; color: #090;'>Device<br />Rebooted</span><br />
<span class=body-date-1>".formatUptime($device['attrib_value'])."</span>
<span class=body-date-1>".formatUptime($device['uptime'])."</span>
</center></div>");
}

View File

@@ -36,8 +36,8 @@
$update = mysql_query("UPDATE `bgpPeers` SET astext = '$astext' WHERE `device_id` = '".$device['device_id']."' AND bgpPeerIdentifier = '$peer_ip'");
}
## Get afi/safi and populate cbgp on cisco IOS
if($device['os'] == "IOS" || $device['os'] == "IOS XE") {
## Get afi/safi and populate cbgp on cisco ios (xe/xr)
if($device['os_type'] == "ios") {
unset($af_list);
$af_cmd = $config['snmpwalk'] . " -CI -m CISCO-BGP4-MIB -OsQ -" . $device['snmpver'] . " -c" . $device['community'] . " " . $device['hostname'].":".$device['port'] . " ";
$af_cmd .= "cbgpPeerAddrFamilyName." . $peer_ip;
@@ -61,7 +61,7 @@
mysql_query("DELETE FROM `bgpPeers_cbgp` WHERE `device_id` = '".$device['device_id']."' AND bgpPeerIdentifier = '$peer_ip' AND afi = '$afi' AND safi = '$safi'");
}
} # AF list
} # if IOS
} # if os_type = ios
} # If Peer
} # Foreach
} else {

View File

@@ -8,7 +8,7 @@
echo("CISCO-ENHANCED-MEMORY-POOL : ");
## Cisco Enhanced Mempool
if($device['os'] == "IOS" || $device['os'] == "IOS XE") {
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 = trim($oids);

View File

@@ -8,7 +8,7 @@
echo("CISCO-PROCESS-MIB : ");
## Cisco Processors
if($device['os'] == "IOS" || $device['os'] == "IOS XE") {
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 = trim($oids);
foreach(explode("\n", $oids) as $data) {

View File

@@ -7,9 +7,11 @@
if($config['enable_inventory']) {
$empty = array();
$entity_array = snmpwalk_cache_oid("entityPhysical", $device, $empty, "ENTITY-MIB");
$entity_array = snmpwalk_cache_oid("entPhysicalEntry", $device, $empty, "ENTITY-MIB");
$entity_array = snmpwalk_cache_oid("entSensorValues", $device, $entity_array, "CISCO-ENTITY-SENSOR-MIB");
if(!$entity_array[$device[device_id]]) { $entity_array[$device[device_id]] = array(); }
foreach($entity_array[$device[device_id]] as $entPhysicalIndex => $entry) {
$entPhysicalDescr = $entry['entPhysicalDescr'];
@@ -21,6 +23,13 @@
$entPhysicalMfgName = $entry['entPhysicalMfgName'];
$entPhysicalVendorType = $entry['entPhysicalVendorType'];
$entPhysicalParentRelPos = $entry['entPhysicalParentRelPos'];
$entPhysicalHardwareRev = $entry['entPhysicalHardwareRev'];
$entPhysicalFirmwareRev = $entry['entPhysicalFirmwareRev'];
$entPhysicalSoftwareRev = $entry['entPhysicalSoftwareRev'];
$entPhysicalIsFRU = $entry['entPhysicalIsFRU'];
$entPhysicalAlias = $entry['entPhysicalAlias'];
$entPhysicalAssetID = $entry['entPhysicalAssetID'];
$ent_data = $config['snmpget'] . " -m ENTITY-MIB:IF-MIB -Ovqs -";
$ent_data .= $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'] .":".$device['port'];
@@ -42,25 +51,21 @@
$sql .= ", entPhysicalIndex = '$entPhysicalIndex', entPhysicalDescr = '$entPhysicalDescr', entPhysicalClass = '$entPhysicalClass', entPhysicalName = '$entPhysicalName'";
$sql .= ", entPhysicalModelName = '$entPhysicalModelName', entPhysicalSerialNum = '$entPhysicalSerialNum', entPhysicalContainedIn = '$entPhysicalContainedIn'";
$sql .= ", entPhysicalMfgName = '$entPhysicalMfgName', entPhysicalParentRelPos = '$entPhysicalParentRelPos', entPhysicalVendorType = '$entPhysicalVendorType'";
$sql .= ", entPhysicalHardwareRev = '$entPhysicalHardwareRev', entPhysicalFirmwareRev = '$entPhysicalFirmwareRev', entPhysicalSoftwareRev = '$entPhysicalSoftwareRev'";
$sql .= ", entPhysicalIsFRU = '$entPhysicalIsFRU', entPhysicalAlias = '$entPhysicalAlias', entPhysicalAssetID = '$entPhysicalAssetID'";
$sql .= " WHERE device_id = '".$device['device_id']."' AND entPhysicalIndex = '$entPhysicalIndex'";
mysql_query($sql);
echo(".");
} else {
$sql = "INSERT INTO `entPhysical` ( `device_id` , `entPhysicalIndex` , `entPhysicalDescr` , `entPhysicalClass` , `entPhysicalName` , `entPhysicalModelName` , `entPhysicalSerialNum` , `entPhysicalContainedIn`, `entPhysicalMfgName`, `entPhysicalParentRelPos`, `entPhysicalVendorType`, `ifIndex` ) ";
$sql .= "VALUES ( '" . $device['device_id'] . "', '$entPhysicalIndex', '$entPhysicalDescr', '$entPhysicalClass', '$entPhysicalName', '$entPhysicalModelName', '$entPhysicalSerialNum', '$entPhysicalContainedIn', '$entPhysicalMfgName','$entPhysicalParentRelPos' , '$entPhysicalVendorType', '$ifIndex')";
$sql = "INSERT INTO `entPhysical` ( `device_id` , `entPhysicalIndex` , `entPhysicalDescr` , `entPhysicalClass` , `entPhysicalName` , `entPhysicalModelName` , `entPhysicalSerialNum` , `entPhysicalContainedIn`, `entPhysicalMfgName`, `entPhysicalParentRelPos`, `entPhysicalVendorType`, `entPhysicalHardwareRev`,`entPhysicalFirmwareRev`,`entPhysicalSoftwareRev`,`entPhysicalIsFRU`,`entPhysicalAlias`,`entPhysicalAssetID`, `ifIndex` ) ";
$sql .= "VALUES ( '" . $device['device_id'] . "', '$entPhysicalIndex', '$entPhysicalDescr', '$entPhysicalClass', '$entPhysicalName', '$entPhysicalModelName', '$entPhysicalSerialNum', '$entPhysicalContainedIn', '$entPhysicalMfgName','$entPhysicalParentRelPos' , '$entPhysicalVendorType', '$entPhysicalHardwareRev', '$entPhysicalFirmwareRev', '$entPhysicalSoftwareRev', '$entPhysicalIsFRU', '$entPhysicalAlias', '$entPhysicalAssetID', '$ifIndex')";
mysql_query($sql);
echo("+");
}
if($entPhysicalClass == "sensor") {
# $sensor_cmd = $config['snmpget'] . " -m CISCO-ENTITY-SENSOR-MIB -O Uqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
# $sensor_cmd .= " entSensorType.$entPhysicalIndex entSensorScale.$entPhysicalIndex entSensorPrecision.$entPhysicalIndex";
# $sensor_cmd .= " entSensorValueUpdateRate.$entPhysicalIndex entSensorMeasuredEntity.$entPhysicalIndex";
# $sensor_data = shell_exec($sensor_cmd);
# list($entSensorType,$entSensorScale,$entSensorPrecision,$entSensorValueUpdateRate,$entSensorMeasuredEntity) = explode("\n", $sensor_data);
$entSensorType = $entry['entSensorType'];
$entSensorScale = $entry['entSensorScale'];
$entSensorPrecision = $entry['entSensorPrecision'];

View File

@@ -14,17 +14,14 @@
list($net,$cidr) = explode("/", $network);
$cidr = trim($cidr);
if($mask == "255.255.255.255") { $cidr = "32"; $network = "$oid/$cidr"; }
if (mysql_result(mysql_query("SELECT count(*) FROM `interfaces` WHERE device_id = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'"), 0) != '0') {
if (mysql_result(mysql_query("SELECT count(*) FROM `interfaces` WHERE device_id = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'"), 0) != '0' && $oid != "0.0.0.0") {
$i_query = "SELECT interface_id FROM `interfaces` WHERE device_id = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'";
$interface_id = mysql_result(mysql_query($i_query), 0);
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `ipv4_networks` WHERE `ipv4_network` = '$network'"), 0) < '1') {
mysql_query("INSERT INTO `ipv4_networks` (`ipv4_network`) VALUES ('$network')");
#echo("Create Subnet $network\n");
echo("S");
}
$ipv4_network_id = @mysql_result(mysql_query("SELECT `ipv4_network_id` from `ipv4_networks` WHERE `ipv4_network` = '$network'"), 0);
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `ipv4_addresses` WHERE `ipv4_address` = '$oid' AND `ipv4_prefixlen` = '$cidr' AND `interface_id` = '$interface_id'"), 0) == '0') {
@@ -32,10 +29,8 @@
#echo("Added $oid/$cidr to $interface_id ( $hostname $ifIndex )\n $i_query\n");
echo("+");
} else { echo("."); }
$full_address = "$oid/$cidr|$ifIndex";
$valid_v4[$full_address] = 1;
} else { echo("!"); }
}

View File

@@ -2,9 +2,9 @@
echo("IPv6 Addresses : ");
$ipv6interfaces = shell_exec($config['snmpget']." -m IPV6-MIB -Ovnq -".$device['snmpver']." -c ".$device['community']." ".$device['hostname'].":".$device['port']." ipv6Interfaces.0");
#$ipv6interfaces = shell_exec($config['snmpget']." -m IPV6-MIB -Ovnq -".$device['snmpver']." -c ".$device['community']." ".$device['hostname'].":".$device['port']." ipv6Interfaces.0");
if($ipv6interfaces){
#if($ipv6interfaces){
$cmd = $config['snmpwalk']." -m IP-MIB -".$device['snmpver']." -Ln -c ".$device['community']." ".$device['hostname'].":".$device['port'];
$cmd .= " ipAddressIfIndex.ipv6 -Osq | grep -v No";
@@ -58,7 +58,7 @@ if($ipv6interfaces){
}
}
}
} else { echo("None configured"); }
#} else { echo("None configured"); }
$sql = "SELECT * FROM ipv6_addresses AS A, interfaces AS I WHERE I.device_id = '".$device['device_id']."' AND A.interface_id = I.interface_id";
$data = mysql_query($sql);

View File

@@ -22,16 +22,16 @@
}
}
if(strstr($fstype, "FixedDisk") && $size > '0' && $allow) {
if(strstr($fstype, "FixedDisk") || strstr($fstype, "Ram") || strstr($fstype, "VirtualMemory") && $size > '0' && $allow) {
if(mysql_result(mysql_query("SELECT count(storage_id) FROM `storage` WHERE hrStorageIndex = '$hrStorageIndex' AND host_id = '".$device['device_id']."'"),0) == '0') {
$query = "INSERT INTO storage (`host_id`, `hrStorageIndex`, `hrStorageDescr`,`hrStorageSize`,`hrStorageAllocationUnits`) ";
$query .= "values ('".$device['device_id']."', '$hrStorageIndex', '$descr', '$size', '$units')";
$query = "INSERT INTO storage (`host_id`, `hrStorageIndex`, `hrStorageType`, `hrStorageDescr`,`hrStorageSize`,`hrStorageAllocationUnits`) ";
$query .= "values ('".$device['device_id']."', '$hrStorageIndex', '$fstype', '$descr', '$size', '$units')";
mysql_query($query);
echo("+");
} else {
$data = mysql_fetch_array(mysql_query("SELECT * FROM `storage` WHERE hrStorageIndex = '$hrStorageIndex' AND host_id = '".$device['device_id']."'"));
if($data['hrStorageDescr'] != $descr || $data['hrStorageSize'] != $size || $data['hrStorageAllocationUnits'] != $units ) {
$query = "UPDATE storage SET `hrStorageDescr` = '$descr', `hrStorageSize` = '$size', `hrStorageAllocationUnits` = '$units' ";
$query = "UPDATE storage SET `hrStorageDescr` = '$descr', `hrStorageType` = '$fstype', `hrStorageSize` = '$size', `hrStorageAllocationUnits` = '$units' ";
$query .= "WHERE hrStorageIndex = '$hrStorageIndex' AND host_id = '".$device['device_id']."'";
echo("U");
mysql_query($query);

View File

@@ -92,7 +92,7 @@
## Cisco Temperatures
if($device['os'] == "IOS" || $device['os'] == "IOS XE") {
if($device['os_type'] == "ios") {
echo("Cisco ");
$oids = shell_exec($config['snmpwalk'] . " -m CISCO-ENVMON-MIB -$snmpver -CI -Osqn -c $community $hostname:$port .1.3.6.1.4.1.9.9.13.1.3.1.2 | sed s/.1.3.6.1.4.1.9.9.13.1.3.1.2.//g");
$oids = trim($oids);

View File

@@ -50,12 +50,12 @@ global $config;
return $array;
}
function snmpwalk_cache_oid($oid, $device, $array, $mib = 0) {
function snmpwalk_cache_oid($poll_oid, $device, $array, $mib = 0) {
global $config;
$cmd = $config['snmpbulkwalk'] . " -O Qs -" . $device['snmpver'] . " -c " . $device['community'] . " " .
$device['hostname'].":".$device['port'] . " ";
if($mib) { $cmd .= "-m $mib "; }
$cmd .= $oid;
$cmd .= $poll_oid;
$data = trim(shell_exec($cmd));
$device_id = $device['device_id'];
foreach(explode("\n", $data) as $entry) {

View File

@@ -109,9 +109,9 @@ function device_array($device_id) {
return $device;
}
function getHostOS($hostname, $community, $snmpver, $port) {
function getHostOS($device) {
global $config;
$sysDescr_cmd = $config['snmpget']." -m SNMPv2-MIB -O qv -" . $snmpver . " -c " . $community . " " . $hostname.":".$port . " sysDescr.0";
$sysDescr_cmd = $config['snmpget']." -m SNMPv2-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " sysDescr.0";
$sysDescr = str_replace("\"", "", trim(shell_exec($sysDescr_cmd)));
$dir_handle = @opendir($config['install_dir'] . "/includes/osdiscovery") or die("Unable to open $path");
while ($file = readdir($dir_handle)) {
@@ -628,7 +628,8 @@ function fixIOSHardware($hardware){
function createHost ($host, $community, $snmpver, $port = 161){
$host = trim(strtolower($host));
$host_os = getHostOS($host, $community, $snmpver, $port);
$device = array('hostname' => $host, 'community' => $community, 'snmpver' => $snmpver, 'port' => $port);
$host_os = getHostOS($device);
if($host_os) {
$sql = mysql_query("INSERT INTO `devices` (`hostname`, `sysName`, `community`, `port`, `os`, `status`) VALUES ('$host', '$host', '$community', '$port', '$host_os', '1')");
if(mysql_affected_rows()) {

View File

@@ -1,7 +1,7 @@
<?php
if(!$os) {
if(preg_match("/^Cisco\ Adaptive\ Security\ Appliance/", $sysDescr)) { $os = "ASA"; }
if(preg_match("/^Cisco\ Adaptive\ Security\ Appliance/", $sysDescr)) { $os = "asa"; }
}
?>

View File

@@ -2,7 +2,7 @@
if(!$os) {
if(strstr($sysDescr, "Cisco Catalyst Operating System Software")) { $os = "CatOS"; }
if(strstr($sysDescr, "Cisco Catalyst Operating System Software")) { $os = "catos"; }
}

View File

@@ -1,15 +1,10 @@
<?php
if(!$os) {
$sysObjectId = shell_exec($config['snmpget'] . " -Ovq -v2c -c ". $community ." ". $hostname.":".$port ." .1.3.6.1.2.1.1.2.0");
if(strstr($sysObjectId, "fortinet")) {
$fnSysVersion = shell_exec($config['snmpget'] . " -Ovq -v2c -c ". $community ." ". $hostname.":".$port ." fnSysVersion.0");
if(strstr($fnSysVersion, "Fortigate")) {
$os = "Fortigate";
}
$fnSysVersion = shell_exec($config['snmpget'] . " -Ovq -".$device['snmpver']." -c ". $device['community'] ." ". $device['hostname'].":".$device['port'] ." 1.3.6.1.4.1.12356.1.3.0");
if(strstr($fnSysVersion, "Fortigate")) {
$os = "fortigate";
}
}
?>

View File

@@ -1,8 +1,8 @@
<?php
if(!$os) {
if(strstr($sysDescr, "FreeBSD")) { $os = "FreeBSD"; } ## It's FreeBSD!
if(strstr($sysDescr, "Voswall")) { unset($os); } ## Oh-No-It-Isn't!!
if(strstr($sysDescr, "m0n0wall")) { unset($os); } ## Ditto
if(strstr($sysDescr, "FreeBSD")) { $os = "freebsd"; } ## It's FreeBSD!
if(strstr($sysDescr, "Voswall")) { $os = "voswall"; } ## Oh-No-It-Isn't!!
if(strstr($sysDescr, "m0n0wall")) { $os = "monowall"; } ## Ditto
}
?>

View File

@@ -2,10 +2,11 @@
if(!$os) {
if(strstr($sysDescr, "Cisco Internetwork Operating System Software")) { $os = "IOS"; }
if(strstr($sysDescr, "IOS (tm)")) { $os = "IOS"; }
if(strstr($sysDescr, "Cisco IOS Software")) { $os = "IOS"; }
if(strstr($sysDescr, "IOS-XE")) { $os = "IOS XE"; }
if(strstr($sysDescr, "Cisco Internetwork Operating System Software")) { $os = "ios"; }
if(strstr($sysDescr, "IOS (tm)")) { $os = "ios"; }
if(strstr($sysDescr, "Cisco IOS Software")) { $os = "ios"; }
if(strstr($sysDescr, "IOS-XE")) { $os = "iosxe"; }
if(strstr($sysDescr, "IOS XR")) { $os = "iosxr"; }
}

View File

@@ -2,8 +2,8 @@
if(!$os) {
$sysObjectId = shell_exec($config['snmpget'] . " -Ovqn -v2c -c ". $community ." ". $hostname.":".$port ." sysObjectID.0");
if(strstr($sysObjectId, ".1.3.6.1.4.1.2636")) { $os = "JunOS"; }
$sysObjectId = shell_exec($config['snmpget'] . " -Ovqn -".$device['snmpver']." -c ". $device['community'] ." ". $device['hostname'].":".$device['port'] ." sysObjectID.0");
if(strstr($sysObjectId, ".1.3.6.1.4.1.2636")) { $os = "junos"; }
}

View File

@@ -1,7 +1,7 @@
<?php
if(!$os) {
if(preg_match("/^Linux/", $sysDescr)) { $os = "Linux"; }
if(preg_match("/^Linux/", $sysDescr)) { $os = "linux"; }
}
?>

View File

@@ -1,12 +1,4 @@
<?php
if(!$os) {
if(preg_match("/^m0n0wall/", $sysDescr)) { $os = "m0n0wall"; }
}
if(!$os) {
if(preg_match("/^Voswall/", $sysDescr)) { $os = "Voswall"; }
}
?>

View File

@@ -1,7 +1,7 @@
<?php
if(!$os) {
if(preg_match("/^NetBSD/", $sysDescr)) { $os = "NetBSD"; }
if(preg_match("/^NetBSD/", $sysDescr)) { $os = "netbsd"; }
}
?>

View File

@@ -1,7 +1,7 @@
<?php
if(!$os) {
if(preg_match("/^OpenBSD/", $sysDescr)) { $os = "OpenBSD"; }
if(preg_match("/^OpenBSD/", $sysDescr)) { $os = "openbsd"; }
}
?>

View File

@@ -0,0 +1,9 @@
<?php
if(!$os) {
if(strstr($sysDescr, "Neyland 24T")) { $os = "powerconnect"; }
}
?>

View File

@@ -2,9 +2,8 @@
if(!$os) {
var_dump($port);
$sysObjectId = shell_exec($config['snmpget'] . " -Ovq -v2c -c ". $community ." ". $hostname.":".$port ." .1.3.6.1.2.1.1.2.0");
if(strstr($sysObjectId, "netscreen")) { $os = "ScreenOS"; } elseif (strstr($sysObjectId, "enterprises.3224.1")) { $os = "ScreenOS"; }
$sysObjectId = shell_exec($config['snmpget'] . " -Ovq -".$device['snmpver']." -c ". $device['community'] ." ". $device['hostname'].":".$device['port'] ." .1.3.6.1.2.1.1.2.0");
if(strstr($sysObjectId, "netscreen")) { $os = "screenos"; } elseif (strstr($sysObjectId, "enterprises.3224.1")) { $os = "screenos"; }
}

View File

@@ -1,7 +1,7 @@
<?php
if(!$os) {
if(preg_match("/Windows/", $sysDescr)) { $os = "Windows"; }
if(preg_match("/Windows/", $sysDescr)) { $os = "windows"; }
}
?>

View File

@@ -44,7 +44,7 @@ while($peer = mysql_fetch_array($peers)) {
mysql_query($update);
if($device['os'] == "IOS" || $device['os'] == "IOS XE") {
if($device['os_group'] == "ios") {
## Poll each AFI/SAFI for this peer (using CISCO-BGP4-MIB)
$afi_query = mysql_query("SELECT * FROM bgpPeers_cbgp WHERE `device_id` = '".$device['device_id']."' AND bgpPeerIdentifier = '" . $peer['bgpPeerIdentifier'] . "'");

View File

@@ -1,6 +1,6 @@
<?php
if($device['os'] == "IOS") {
if($device['os_group'] == "ios") {
$array = snmp_cache_portIfIndex ($device, $array);

View File

@@ -1,10 +1,17 @@
<?php
echo("Doing Juniper JunOS");
echo("Doing Juniper JunOS ");
$jun_ver = trim(str_replace("\"", "", shell_exec($config['snmpget'] . " -m HOST-RESOURCES-MIB -".$device['snmpver']." -Oqv -c ".$device['community']." ".$device['hostname'].":".$device['port']." .1.3.6.1.2.1.25.6.3.1.2.2")));
$hardware = trim(str_replace("\"", "", shell_exec($config['snmpget'] . " -m JUNIPER-MIB -".$device['snmpver']." -Oqv -c ".$device['community']." ".$device['hostname'].":".$device['port']." .1.3.6.1.4.1.2636.3.1.2.0")));
$serial = trim(str_replace("\"", "", shell_exec($config['snmpget'] . " -m JUNIPER-MIB -".$device['snmpver']." -Oqv -c ".$device['community']." ".$device['hostname'].":".$device['port']." .1.3.6.1.4.1.2636.3.1.3.0")));
if(strpos($sysDescr, "olive")) {
$hardware = "Olive";
$serial = "";
} else {
$hardware = trim(str_replace("\"", "", shell_exec($config['snmpget'] . " -m JUNIPER-MIB -".$device['snmpver']." -OQv -c ".$device['community']." ".$device['hostname'].":".$device['port']." .1.3.6.1.4.1.2636.3.1.2.0")));
$serial = trim(str_replace("\"", "", shell_exec($config['snmpget'] . " -m JUNIPER-MIB -".$device['snmpver']." -Oqv -c ".$device['community']." ".$device['hostname'].":".$device['port']." .1.3.6.1.4.1.2636.3.1.3.0")));
list(,$hardware,) = explode(" ", $hardware);
$hardware = "Juniper " . $hardware;
}
list($version) = explode("]", $jun_ver);
list(,$version) = explode("[", $version);

View File

@@ -0,0 +1,10 @@
<?php
$snmp_cmd = $config['snmpget'] . " -m Dell-Vendor-MIB -O Qv -" . $device['snmpver'] . " -c " . $device['community'] . " " .
$device['hostname'].":".$device['port'];
$snmp_cmd .= " productIdentificationDisplayName.0 productIdentificationVersion.0 productIdentificationDescription.0";
list($hardware, $version, $features) = explode("\n", shell_exec($snmp_cmd));
?>

View File

@@ -1,6 +1,6 @@
<?php
if($device['os'] == "CatOS" || $device['os'] == "IOS") {
if($device['os_group'] == "ios") {
$portifIndex = array();
$cmd = $config['snmpwalk'] . " -CI -m CISCO-STACK-MIB -O q -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " portIfIndex";
#echo("$cmd");

View File

@@ -0,0 +1,49 @@
<?php
echo("Polling IP-MIB ipSystemStats ");
$ipSystemStats = snmpwalk_cache_oid("ipSystemStats", $device, $ipSystemStats, "IP-MIB");
$ipSystemStats = $ipSystemStats[$device[device_id]];
foreach($ipSystemStats as $af => $stats) {
echo("$af ");
$oids = array('ipSystemStatsInReceives','ipSystemStatsInHdrErrors','ipSystemStatsInAddrErrors','ipSystemStatsInUnknownProtos','ipSystemStatsInForwDatagrams','ipSystemStatsReasmReqds',
'ipSystemStatsReasmOKs','ipSystemStatsReasmFails','ipSystemStatsInDiscards','ipSystemStatsInDelivers','ipSystemStatsOutRequests','ipSystemStatsOutNoRoutes','ipSystemStatsOutDiscards',
'ipSystemStatsOutFragFails','ipSystemStatsOutFragCreates','ipSystemStatsOutForwDatagrams');
if(isset($stats['ipSystemStatsHCInReceives'])) { $stats['ipSystemStatsInReceives'] = $stats['ipSystemStatsHCInReceives']; }
if(isset($stats['ipSystemStatsHCInForwDatagrams'])) { $stats['ipSystemStatsInForwDatagrams'] = $stats['ipSystemStatsHCInForwDatagrams']; }
if(isset($stats['ipSystemStatsHCInDelivers'])) { $stats['ipSystemStatsInDelivers'] = $stats['ipSystemStatsHCInDelivers']; }
if(isset($stats['ipSystemStatsHCOutRequests'])) { $stats['ipSystemStatsOutRequests'] = $stats['ipSystemStatsHCOutRequests']; }
if(isset($stats['ipSystemStatsHCOutForwDatagrams'])) { $stats['ipSystemStatsOutForwDatagrams'] = $stats['ipSystemStatsHCOutForwDatagrams']; }
unset($snmpstring, $rrdupdate, $snmpdata, $snmpdata_cmd, $rrd_create);
$rrdfile = $config['rrd_dir'] . "/" . $device['hostname'] . "/ipSystemStats-".$af.".rrd";
$rrd_create = $config['rrdtool'] . " create $rrdfile ";
$rrd_create .= "RRA:AVERAGE:0.5:1:600 RRA:AVERAGE:0.5:6:700 RRA:AVERAGE:0.5:24:775 RRA:AVERAGE:0.5:288:797 RRA:MAX:0.5:1:600 RRA:MAX:0.5:6:700 RRA:MAX:0.5:24:775 RRA:MAX:0.5:288:797";
$rrdupdate = "N";
foreach($oids as $oid){
$oid_ds = str_replace("ipSystemStats", "", $oid);
$oid_ds = truncate($oid_ds, 19, '');
$rrd_create .= " DS:$oid_ds:COUNTER:600:U:100000000000";
$snmpstring .= " $oid.0";
if(strstr($stats[$oid], "No") || strstr($stats[$oid], "d") || strstr($stats[$oid], "s")) { $stats[$oid] = "0"; }
$rrdupdate .= ":".$stats[$oid];
}
if(!file_exists($rrdfile)) { shell_exec($rrd_create); }
rrdtool_update($rrdfile, $rrdupdate);
unset($snmpstring, $rrdupdate, $snmpdata, $snmpdata_cmd, $rrd_create);
}
echo("\n");
?>

View File

@@ -38,7 +38,7 @@
#foreach ($cisco_oids as $oid) { $array = snmp_cache_oid($oid, $device, $array, "OLD-CISCO-INTERFACES-MIB"); }
#foreach ($pagp_oids as $oid) { $array = snmp_cache_oid($oid, $device, $array, "CISCO-PAGP-MIB"); }
if($device['os'] == "IOS" || $device['os'] == "CatOS" || $device['os'] == "IOS XE") {
if($device['os_group'] == "ios") {
#$array = snmp_cache_portIfIndex ($device, $array);
#$array = snmp_cache_portName ($device, $array);
#$array = snmp_cache_oid("vmVlan", $device, $array, "CISCO-VLAN-MEMBERSHIP-MIB");

View File

@@ -4,6 +4,7 @@
$config['ifname']['asa'] = true;
$config['ifname']['catos'] = true;
$config['ifname']['windows'] = true;
$config['ifname']['powerconnect'] = true;
## AFI / SAFI pairs for BGP (and other stuff, perhaps)
$config['afi']['ipv4']['unicast'] = "IPv4";
@@ -21,9 +22,30 @@ $os_groups['netbsd'] = "unix";
$os_groups['dragonfly'] = "unix";
$os_groups['solaris'] = "unix";
$os_groups['ios xe'] = "ios";
$os_groups['iosxe'] = "ios";
$os_groups['iosxr'] = "ios";
$os_groups['ios'] = "ios";
$os_groups['asa'] = "ios";
##
$os_text['linux'] = "Linux";
$os_text['ios'] = "Cisco IOS";
$os_text['iosxr'] = "Cisco IOS XE";
$os_text['iosxe'] = "Cisco IOS XR";
$os_text['catos'] = "Cisco CatOS";
$os_text['nxos'] = "Cisco NX-OS";
$os_text['asa'] = "Cisco ASA";
$os_text['pix'] = "Cisco PIX";
$os_text['freebsd'] = "FreeBSD";
$os_text['openbsd'] = "OpenBSD";
$os_text['netbsd'] = "NetBSD";
$os_text['dragonflybsd'] = "DragonFlyBSD";
$os_text['powerconnect'] = "Dell PowerConnect";
$os_text['windows'] = "Microsoft Windows";
$os_text['junos'] = "Juniper JunOS";
$os_text['procurve'] = "HP ProCurve";
if(!$config['graph_colours']['greens']) {
$config['graph_colours']['greens'] = array('B6D14B','91B13C','6D912D','48721E','24520F','003300');
}

View File

@@ -24,7 +24,7 @@ function process_syslog ($entry, $update) {
if($device_id && !$delete) {
$entry['device_id'] = $device_id;
$os = mysql_result(mysql_query("SELECT `os` FROM `devices` WHERE `device_id` = '$device_id'"),0);
if($os == "IOS" || $os == "IOS XE") {
if($os == "ios" || $os == "iosxe") {
if(strstr($entry[msg], "%")) {
$entry['msg'] = preg_replace("/^%(.+?):\ /", "\\1||", $entry['msg']);
list(,$entry[msg]) = split(": %", $entry['msg']);

View File

@@ -24,7 +24,7 @@ while($loc_data = mysql_fetch_array($loc_result)) {
style=filled;
color=lightgrey;\n\n");
$dev_sql = "SELECT * FROM devices WHERE location = '" . $loc_data['location'] . "' and `os` LIKE '%IOS%' and disabled = 0";
$dev_sql = "SELECT * FROM devices WHERE location = '" . $loc_data['location'] . "' and `os` LIKE '%ios%' and disabled = 0";
$dev_result = mysql_query($dev_sql);
while($dev_data = mysql_fetch_array($dev_result)) {
$device_id = $dev_data['device_id'];

437
mibs/Dell_vendor.mib Normal file
View File

@@ -0,0 +1,437 @@
Dell-Vendor-MIB DEFINITIONS ::= BEGIN
IMPORTS
enterprises, TimeTicks
FROM RFC1155-SMI
MODULE-IDENTITY, OBJECT-TYPE, Unsigned32, Integer32, IpAddress,
NOTIFICATION-TYPE
FROM SNMPv2-SMI
DisplayString, RowStatus, TEXTUAL-CONVENTION
FROM SNMPv2-TC;
powerConnect3000MIB MODULE-IDENTITY
LAST-UPDATED "200211250000Z"
ORGANIZATION "Dell Computer Corporation"
CONTACT-INFO
"support.dell.com"
DESCRIPTION
"The private MIB module definition for the Dell powerConnect 3000 Devices."
REVISION "200211250000Z"
DESCRIPTION
"Initial version of this MIB."
::= { enterprises dell(674) dellLan(10895) 3000 }
EnvMonState ::= TEXTUAL-CONVENTION
STATUS current
DESCRIPTION
"Represents the state of a device being monitored.
Valid values are:
normal(1): the environment is good, such as low
temperature.
warning(2): the environment is bad, such as temperature
above normal operation range but not too
high.
critical(3): the environment is very bad, such as
temperature much higher than normal
operation limit.
shutdown(4): the environment is the worst, the system
should be shutdown immediately.
notPresent(5): the environmental monitor is not present,
such as temperature sensors do not exist.
notFunctioning(6): the environmental monitor does not
function properly, such as a temperature
sensor generates a abnormal data like
1000 C.
"
SYNTAX INTEGER {
normal(1),
warning(2),
critical(3),
shutdown(4),
notPresent(5),
notFunctioning(6)
}
dell-VendorMIBObjects OBJECT IDENTIFIER ::= { powerConnect3000MIB 1 }
dellVendorNotifications OBJECT IDENTIFIER ::= { powerConnect3000MIB 2 }
hardware OBJECT IDENTIFIER ::= { dell-VendorMIBObjects 2 }
productIdentification OBJECT IDENTIFIER ::= { hardware 100 }
productStatus OBJECT IDENTIFIER ::= { hardware 110 }
--
--
-- productIdentification
--
productIdentificationDisplayName OBJECT-TYPE
SYNTAX DisplayString
MAX-ACCESS read-only
STATUS current
DESCRIPTION "Name of this product for display purposes."
::= { productIdentification 1}
productIdentificationDescription OBJECT-TYPE
SYNTAX DisplayString
MAX-ACCESS read-only
STATUS current
DESCRIPTION "A short description of this product such as: Ethernet Router Switch."
::= { productIdentification 2}
productIdentificationVendor OBJECT-TYPE
SYNTAX DisplayString
MAX-ACCESS read-only
STATUS current
DESCRIPTION "The name of the product manufacturer, such as: Dell Computer Corp."
::= { productIdentification 3 }
productIdentificationVersion OBJECT-TYPE
SYNTAX DisplayString
MAX-ACCESS read-only
STATUS current
DESCRIPTION "The version of this product."
::= { productIdentification 4 }
productIdentificationBuildNumber OBJECT-TYPE
SYNTAX DisplayString
MAX-ACCESS read-only
STATUS current
DESCRIPTION "The software build number of the product."
::= { productIdentification 5 }
productIdentificationURL OBJECT-TYPE
SYNTAX DisplayString
MAX-ACCESS read-only
STATUS current
DESCRIPTION "The URL of the web-based application to manage this device, should the device provide one.
The format of the value held by this object is: http://<device IP address>."
::= { productIdentification 6 }
productIdentificationDeviceNetworkName OBJECT-TYPE
SYNTAX DisplayString
MAX-ACCESS read-only
STATUS current
DESCRIPTION "Device Name."
::= { productIdentification 7 }
productIdentificationPerUnitTable OBJECT-TYPE
SYNTAX SEQUENCE OF ProductIdentificationPerBoxEntry
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION
"Identification specific to product instance and, in case of stackable products, per unit. If the product is not stackable,
it will be considered a stack of one unit and therefore this table will contain one conceptual row only."
::= { productIdentification 8 }
productIdentificationPerUnitEntry OBJECT-TYPE
SYNTAX ProductIdentificationPerBoxEntry
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION
"This row applies to a unit in a stackable product. "
INDEX { productIdentificationPerBoxIndex }
::= { productIdentificationPerUnitTable 1 }
ProductIdentificationPerBoxEntry ::= SEQUENCE {
productIdentificationPerBoxIndex INTEGER,
productIdentificationSerialNumber DisplayString,
productIdentificationAssetTag DisplayString,
productIdentificationServiceTag DisplayString
}
productIdentificationPerBoxIndex OBJECT-TYPE
SYNTAX INTEGER (1..2147483647)
MAX-ACCESS read-only
STATUS current
DESCRIPTION "The index of the stack unit to which this conceptual row corresponds.
Note that the index will be the same index as the index
of a 'chassis' physical entity in the entity MIB of the product."
::= { productIdentificationPerUnitEntry 1 }
productIdentificationSerialNumber OBJECT-TYPE
SYNTAX DisplayString
MAX-ACCESS read-only
STATUS current
DESCRIPTION "Serial number of the product."
::= { productIdentificationPerUnitEntry 2 }
productIdentificationAssetTag OBJECT-TYPE
SYNTAX DisplayString
MAX-ACCESS read-only
STATUS current
DESCRIPTION "Asset tag of the product."
::= { productIdentificationPerUnitEntry 3 }
productIdentificationServiceTag OBJECT-TYPE
SYNTAX DisplayString
MAX-ACCESS read-only
STATUS current
DESCRIPTION "Service tag of the product."
::= { productIdentificationPerUnitEntry 4 }
--
-- productStatus
--
productStatusGlobalStatus OBJECT-TYPE
SYNTAX INTEGER {
ok(3),
non-critical(4),
critical(5)
}
MAX-ACCESS read-only
STATUS current
DESCRIPTION "Current status of the product.This is a rollup for the entire product.
The status is intended to give initiative to a snmp monitor to get further data when this status is abnormal.
This variable can take the following values:
3: OK
If fans and power supplies are functioning and the system did not reboot because of a HW watchdog failure
or a SW fatal error condition.
4: Non-critical
If at least one power supply is not functional or the system rebooted at least once because of a HW watchdog failure
or a SW fatal error condition.
5: Critical
If at least one fan is not functional, possibly causing a dangerous warming up of the device."
::= { productStatus 1 }
productStatusLastGlobalStatus OBJECT-TYPE
SYNTAX INTEGER {
ok(3),
non-critical(4),
critical(5)
}
MAX-ACCESS read-only
STATUS current
DESCRIPTION "The status before the current status which induced an initiative to issue a global status change trap."
::= { productStatus 2 }
productStatusTimeStamp OBJECT-TYPE
SYNTAX TimeTicks
MAX-ACCESS read-only
STATUS current
DESCRIPTION "The last time that the product global status has been updated.
The time will be given in TimeTicks"
::= { productStatus 3 }
productStatusGetTimeOut OBJECT-TYPE
SYNTAX INTEGER
MAX-ACCESS read-only
STATUS current
DESCRIPTION "Suggested time out value in milliseconds for how long the SNMP getter
should wait while attempting to poll the product SNMP service."
::= { productStatus 4 }
productStatusRefreshRate OBJECT-TYPE
SYNTAX INTEGER
MAX-ACCESS read-only
STATUS current
DESCRIPTION "Rate in seconds at which the SNMP service cached data is being updated."
::= { productStatus 5 }
productStatusGeneratingTrapsFlag OBJECT-TYPE
SYNTAX INTEGER { true(1),
false(2),
disabled(3)
}
MAX-ACCESS read-only
STATUS current
DESCRIPTION "Indicates if this SNMP service is generating SNMP Traps.
This variable can take the following values:
1: true - The device is capable and currently configured to generate traps if necessary.
2: false - The device is not capable of generating traps.
3: disabled - The device is capable but not configured to generate traps.
"
::= { productStatus 6 }
productStatusEnvironment OBJECT IDENTIFIER ::= { productStatus 7}
envMonFanStatusTable OBJECT-TYPE
SYNTAX SEQUENCE OF EnvMonFanStatusEntry
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION
"The table of fan status maintained by the environmental
monitor."
::= { productStatusEnvironment 1 }
envMonFanStatusEntry OBJECT-TYPE
SYNTAX EnvMonFanStatusEntry
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION
"An entry in the fan status table, representing the status of
the associated fan maintained by the environmental monitor."
INDEX { envMonFanStatusIndex }
::= { envMonFanStatusTable 1 }
EnvMonFanStatusEntry ::=
SEQUENCE {
envMonFanStatusIndex INTEGER,
envMonFanStatusDescr DisplayString,
envMonFanState EnvMonState
}
envMonFanStatusIndex OBJECT-TYPE
SYNTAX INTEGER (1..2147483647)
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Unique index for the fan being instrumented.
This index is for SNMP purposes only, and has no
intrinsic meaning."
::= { envMonFanStatusEntry 1 }
envMonFanStatusDescr OBJECT-TYPE
SYNTAX DisplayString (SIZE (0..32))
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Textual description of the fan being instrumented.
This description is a short textual label, suitable as a
human-sensible identification for the rest of the
information in the entry."
::= { envMonFanStatusEntry 2 }
envMonFanState OBJECT-TYPE
SYNTAX EnvMonState
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"The mandatory state of the fan being instrumented."
::= { envMonFanStatusEntry 3 }
envMonSupplyStatusTable OBJECT-TYPE
SYNTAX SEQUENCE OF EnvMonSupplyStatusEntry
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION
"The table of power supply status maintained by the
environmental monitor card."
::= { productStatusEnvironment 2 }
envMonSupplyStatusEntry OBJECT-TYPE
SYNTAX EnvMonSupplyStatusEntry
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION
"An entry in the power supply status table, representing the
status of the associated power supply maintained by the
environmental monitor card."
INDEX { envMonSupplyStatusIndex }
::= { envMonSupplyStatusTable 1 }
EnvMonSupplyStatusEntry ::=
SEQUENCE {
envMonSupplyStatusIndex INTEGER ,
envMonSupplyStatusDescr DisplayString,
envMonSupplyState EnvMonState,
envMonSupplySource INTEGER
}
envMonSupplyStatusIndex OBJECT-TYPE
SYNTAX INTEGER (0..2147483647)
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Unique index for the power supply being instrumented.
This index is for SNMP purposes only, and has no
intrinsic meaning."
::= { envMonSupplyStatusEntry 1 }
envMonSupplyStatusDescr OBJECT-TYPE
SYNTAX DisplayString (SIZE (0..32))
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Textual description of the power supply being instrumented.
This description is a short textual label, suitable as a
human-sensible identification for the rest of the
information in the entry."
::= { envMonSupplyStatusEntry 2 }
envMonSupplyState OBJECT-TYPE
SYNTAX EnvMonState
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"The mandatory state of the power supply being instrumented."
::= { envMonSupplyStatusEntry 3 }
envMonSupplySource OBJECT-TYPE
SYNTAX INTEGER {
unknown(1),
ac(2),
dc(3),
externalPowerSupply(4),
internalRedundant(5)
}
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"The power supply source.
unknown - Power supply source unknown
ac - AC power supply
dc - DC power supply
externalPowerSupply - External power supply
internalRedundant - Internal redundant power supply
"
::= { envMonSupplyStatusEntry 4 }
--
-- trap definitions
--
dell-VendorTraps OBJECT IDENTIFIER ::= { dellVendorNotifications 1 }
dell-VendorTrapsPrefix OBJECT IDENTIFIER ::= { dell-VendorTraps 0 }
productStatusGlobalStatusChange NOTIFICATION-TYPE
OBJECTS { productStatusGlobalStatus, productStatusLastGlobalStatus, productStatusTimeStamp }
STATUS current
DESCRIPTION "This trap is sent when the product global status changes."
--#TYPE "Product Global Status Change."
--#SUMMARY "The product global status has changed from %d to %d at time %d."
--#ARGUMENTS {1,0,2}
::= {dell-VendorTrapsPrefix 1 }
END

View File

@@ -43,7 +43,9 @@ $i = 0;
$device_query = mysql_query("SELECT * FROM `devices` WHERE `ignore` = '0' $where ORDER BY `device_id` ASC");
while ($device = mysql_fetch_array($device_query)) {
echo($device['hostname'] . " ".$device['device_id']." ".$device['os']."\n");
echo($device['hostname'] . " ".$device['device_id']." ".$device['os']." ");
if($os_groups[$device[os]]) {$device['os_group'] = $os_groups[$device[os]]; echo "(".$device['os_group'].")";}
echo("\n");
unset($update); unset($update_query); unset($seperator); unset($version); unset($uptime); unset($features);
unset($sysLocation); unset($hardware); unset($sysDescr); unset($sysContact); unset($sysName);
@@ -69,7 +71,7 @@ while ($device = mysql_fetch_array($device_query)) {
$status = '1';
$snmp_cmd = $config['snmpget'] . " -m SNMPv2-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
$snmp_cmd .= " sysUptime.0 sysLocation.0 sysContact.0 sysName.0";
$snmp_cmd .= " sysUpTime.0 sysLocation.0 sysContact.0 sysName.0";
$snmpdata = shell_exec($snmp_cmd);
#$snmpdata = preg_replace("/^.*IOS/","", $snmpdata);
$snmpdata = trim($snmpdata);
@@ -78,6 +80,7 @@ while ($device = mysql_fetch_array($device_query)) {
$sysDescr = trim(shell_exec($config['snmpget'] . " -m SNMPv2-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " sysDescr.0"));
$sysUptime = str_replace("(", "", $sysUptime);
$sysUptime = str_replace(")", "", $sysUptime);
$sysName = strtolower($sysName);
list($days, $hours, $mins, $secs) = explode(":", $sysUptime);
list($secs, $microsecs) = explode(".", $secs);
$hours = $hours + ($days * 24);
@@ -85,88 +88,34 @@ while ($device = mysql_fetch_array($device_query)) {
$secs = $secs + ($mins * 60);
$uptime = $secs;
switch ($device['os']) {
case "FreeBSD":
case "DragonFly":
case "OpenBSD":
case "Linux":
case "m0n0wall":
case "Voswall":
case "NetBSD":
case "pfSense":
include("includes/polling/device-unix.inc.php");
break;
if(is_file($config['install_dir'] . "/includes/polling/device-".$device['os'].".inc.php")) {
/// OS Specific
include($config['install_dir'] . "/includes/polling/device-".$device['os'].".inc.php");
}elseif($device['os_group'] && is_file($config['install_dir'] . "/includes/polling/device-".$device['os_group'].".inc.php")) {
/// OS Group Specific
include($config['install_dir'] . "/includes/polling/device-".$device['os_group'].".inc.php");
}else{
echo("Generic :(");
}
case "Windows":
include("includes/polling/device-windows.inc.php");
break;
case "ScreenOS":
include("includes/polling/device-screenos.inc.php");
break;
case "Fortigate":
include("includes/polling/device-fortigate.inc.php");
break;
case "JunOS":
include("includes/polling/device-junos.inc.php");
break;
case "IOS":
case "IOS XE":
case "ASA":
include("includes/polling/device-ios.inc.php");
break;
case "CatOS":
include("includes/polling/device-catos.inc.php");
break;
case "procurve":
include("includes/polling/device-procurve.inc.php");
break;
case "BCM96348":
include("includes/polling/adslline.inc.php");
break;
case "Snom":
include("includes/polling/device-snom.inc.php");
break;
default:
pollDevice();
}
$sysLocation = str_replace("\"","", $sysLocation);
include("includes/polling/temperatures.inc.php");
include("includes/polling/device-netstats.inc.php");
include("includes/polling/ipSystemStats.inc.php");
include("includes/polling/ports.inc.php");
include("includes/polling/cisco-mac-accounting.inc.php");
$update_uptime_attrib = mysql_query("UPDATE devices_attribs SET attrib_value = NOW() WHERE `device_id` = '" . $device['device_id'] . "' AND `attrib_type` = 'polled'");
if(mysql_affected_rows() == '0') {
$insert_uptime_attrib = mysql_query("INSERT INTO devices_attribs (`device_id`, `attrib_type`, `attrib_value`) VALUES ('" . $device['device_id'] . "', 'polled', NOW())");
}
} else {
$status = '0';
}
unset( $update ) ;
unset( $seperator) ;
if ( $sysContact && $sysContact != $device['sysContact'] ) {
$update .= $seperator . "`sysContact` = '$sysContact'";
$update .= $seperator . "`sysContact` = '".mres($sysContact)."'";
$seperator = ", ";
mysql_query("INSERT INTO eventlog (host, interface, datetime, message) VALUES ('" . $device['device_id'] . "', NULL, NOW(), 'Contact -> $sysContact')");
}
echo("$update\n");
$sysName = strtolower($sysName);
if ( $sysName && $sysName != $device['sysName'] ) {
$update .= $seperator . "`sysName` = '$sysName'";
$seperator = ", ";
@@ -217,11 +166,9 @@ while ($device = mysql_fetch_array($device_query)) {
if ($uptime) {
$old_uptime = @mysql_result(mysql_query("SELECT `attrib_value` FROM `devices_attribs` WHERE `device_id` = '" . $device['device_id'] . "' AND `attrib_type` = 'uptime'"), 0);
if( $uptime < $old_uptime ) {
if( $uptime < $device['uptime'] ) {
if($device['sysContact']) { $email = $device['sysContact']; } else { $email = $config['email_default']; }
mail($notify_email, "Device Rebooted: " . $device['hostname'], "Device Rebooted :" . $device['hostname'] . " at " . date('l dS F Y h:i:s A'), $config['email_headers']);
mail($email, "Device Rebooted: " . $device['hostname'], "Device Rebooted :" . $device['hostname'] . " at " . date('l dS F Y h:i:s A'), $config['email_headers']);
}
$uptimerrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/uptime.rrd";
@@ -236,28 +183,28 @@ while ($device = mysql_fetch_array($device_query)) {
}
rrdtool_update($uptimerrd, "N:$uptime");
$update_uptime_attrib = mysql_query("UPDATE devices_attribs SET attrib_value = '$uptime' WHERE `device_id` = '" . $device['device_id'] . "' AND `attrib_type` = 'uptime'");
if(mysql_affected_rows() == '0') {
$insert_uptime_attrib = mysql_query("INSERT INTO devices_attribs (`device_id`, `attrib_type`, `attrib_value`) VALUES ('" . $device['device_id'] . "', 'uptime', '$uptime')");
}
mysql_query("UPDATE `devices` SET `last_polled` = NOW() WHERE `device_id` = '". $device['device_id'] ."'");
} ## End if snmpable
$update .= $seperator . "`uptime` = '$uptime'";
$seperator = ", ";
}
$update .= $seperator . "`last_polled` = NOW()";
if ($update) {
$update_query = "UPDATE `devices` SET ";
$update_query .= $update;
$update_query .= " WHERE `device_id` = '" . $device['device_id'] . "'";
echo("Updating " . $device['hostname'] . "\n");
echo("Updating " . $device['hostname'] . " - $update_query \n");
$update_result = mysql_query($update_query);
} else {
echo("No Changes to " . $device['hostname'] . "\n");
}
$i++;
echo("\n");
} else {
$update_query = "UPDATE `devices` SET ";
$update .= " `status` = '0'";
$update_query .= " WHERE `device_id` = '" . $device['device_id'] . "'";
echo("Updating " . $device['hostname'] . "\n");
$update_result = mysql_query($update_query);
}
}
$poller_end = utime(); $poller_run = $poller_end - $poller_start; $poller_time = substr($poller_run, 0, 5);

View File

@@ -8,7 +8,7 @@ $device_query = mysql_query("SELECT device_id,hostname,os,community,snmpver,port
while ($device = mysql_fetch_array($device_query)) {
$os = getHostOS($device['hostname'], $device['community'], $device['snmpver'], $device['port']);
$os = getHostOS($device);
if($os != $device['os']) {
$sql = mysql_query("UPDATE `devices` SET `os` = '$os' WHERE `device_id` = '".$device['device_id']."'");