mirror of
https://github.com/librenms/librenms.git
synced 2024-09-21 10:28:13 +00:00
HURRAH FOR SID3WINDR
git-svn-id: http://www.observium.org/svn/observer/trunk@560 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
parent
03f45837ac
commit
211e9d0283
@ -213,14 +213,14 @@ CREATE TABLE `devices` (
|
||||
`hardware` text,
|
||||
`features` text,
|
||||
`location` text,
|
||||
`os` varchar(8) default NULL,
|
||||
`os` varchar(12) default NULL,
|
||||
`status` tinyint(4) NOT NULL default '0',
|
||||
`ignore` tinyint(4) NOT NULL default '0',
|
||||
`disabled` tinyint(1) NOT NULL default '0',
|
||||
`lastchange` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
|
||||
`last_polled` timestamp NOT NULL default '0000-00-00 00:00:00',
|
||||
`purpose` varchar(64) default NULL,
|
||||
`type` varchar(8) NOT NULL default 'other',
|
||||
`type` varchar(8) NOT NULL default 'unknown',
|
||||
PRIMARY KEY (`device_id`),
|
||||
KEY `status` (`status`),
|
||||
KEY `hostname` (`hostname`),
|
||||
|
@ -58,7 +58,7 @@ ALTER TABLE `interfaces` ADD `ifPromiscuousMode` VARCHAR( 12 ) NULL DEFAULT NUL
|
||||
ALTER TABLE `interfaces` ADD `ifConnectorPresent` VARCHAR( 12 ) NULL DEFAULT NULL AFTER `ifSpeed`;
|
||||
ALTER TABLE `interfaces` ADD `ifName` VARCHAR( 64 ) NULL DEFAULT NULL AFTER `ifDescr`;
|
||||
ALTER TABLE `interfaces` ADD `portName` VARCHAR( 128 ) NULL DEFAULT NULL AFTER `ifName`;
|
||||
ALTER TABLE `interfaces` ADD `ifHighSpeed` INT ( 11 ) NULL DEFAULT NULL AFTER `ifSpeed`;
|
||||
ALTER TABLE `interfaces` ADD `ifHighSpeed` BIGINT ( 20 ) NULL DEFAULT NULL AFTER `ifSpeed`;
|
||||
ALTER TABLE `interfaces` DROP `in_rate`;
|
||||
ALTER TABLE `interfaces` DROP `out_rate`;
|
||||
ALTER TABLE `interfaces` DROP `in_errors`;
|
||||
|
@ -77,10 +77,13 @@ while ($device = mysql_fetch_array($device_query)) {
|
||||
## hr-device.inc.php
|
||||
include("includes/discovery/hr-device.inc.php");
|
||||
|
||||
if($device['os'] == "netscreen") { }
|
||||
if($device['os'] == "netscreen") {
|
||||
if ($device['type'] == "unknown") { $device['type'] = 'firewall'; }
|
||||
}
|
||||
|
||||
if($device['os'] == "junos") {
|
||||
include("includes/discovery/bgp-peers.php");
|
||||
if ($device['type'] == "unknown") { $device['type'] = 'network'; } # FIXME: could also be a Netscreen...
|
||||
}
|
||||
|
||||
if($device['os'] == "powerconnect" || $device['os'] == "ios" || $device['os'] == "iosxe" || $device['os'] == "catos" || $device['os'] == "asa" || $device['os'] == "pix") {
|
||||
@ -93,10 +96,22 @@ while ($device = mysql_fetch_array($device_query)) {
|
||||
include("includes/discovery/cemp-mib.php");
|
||||
include("includes/discovery/cmp-mib.php");
|
||||
include("includes/discovery/cisco-cdp.inc.php");
|
||||
|
||||
if ($device['type'] == "unknown") { $device['type'] = 'network'; };
|
||||
}
|
||||
|
||||
if ($device['os'] == "procurve")
|
||||
{
|
||||
if ($device['type'] == "unknown") { $device['type'] = 'network'; };
|
||||
}
|
||||
|
||||
if ($device['os'] == "asa" || $device['os'] == "pix")
|
||||
{
|
||||
if ($device['type'] == "unknown") { $device['type'] = 'firewall'; }
|
||||
}
|
||||
|
||||
$update_query = "UPDATE `devices` SET ";
|
||||
$update .= " `last_discovered` = NOW()";
|
||||
$update_query .= " `last_discovered` = NOW(), `type` = '" . $device['type'] . "'";
|
||||
$update_query .= " WHERE `device_id` = '" . $device['device_id'] . "'";
|
||||
$update_result = mysql_query($update_query);
|
||||
|
||||
|
@ -23,8 +23,7 @@
|
||||
|
||||
<div class="menu2">
|
||||
<ul>
|
||||
<li><a><img src='images/16/lightbulb.png' border=0 align=absmiddle> Status
|
||||
<!--[if IE 7]><!--></a><!--<![endif]-->
|
||||
<li><a class='menu2four' href='overview/'><img src='images/16/lightbulb.png' border=0 align=absmiddle> Status</a>
|
||||
<table><tr><td>
|
||||
<ul>
|
||||
<li><a href="overview/"><img src='images/16/zoom.png' border=0 align=absmiddle> Overview</a></li>
|
||||
@ -46,13 +45,11 @@ if($_SESSION['userlevel'] >= '10') {
|
||||
?>
|
||||
</ul>
|
||||
</td></tr></table>
|
||||
<!--[if lte IE 6]></a><![endif]-->
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li><a><img src='images/16/server.png' border=0 align=absmiddle> Devices
|
||||
<!--[if IE 7]><!--></a><!--<![endif]-->
|
||||
<li><a class='menu2four' href='devices/'><img src='images/16/server.png' border=0 align=absmiddle> Devices</a>
|
||||
<table><tr><td>
|
||||
<ul>
|
||||
<li><a href='devices/'><img src='images/16/server.png' border=0 align=absmiddle> All Devices</a></li>
|
||||
@ -77,10 +74,8 @@ if($_SESSION['userlevel'] >= '10') {
|
||||
|
||||
</ul>
|
||||
</td></tr></table>
|
||||
<!--[if lte IE 6]></a><![endif]-->
|
||||
</li>
|
||||
<li><a><img src='images/16/cog.png' border=0 align=absmiddle> Services
|
||||
<!--[if IE 7]><!--></a><!--<![endif]-->
|
||||
<li><a class='menu2four' href='services/'><img src='images/16/cog.png' border=0 align=absmiddle> Services</a>
|
||||
<table><tr><td>
|
||||
<ul>
|
||||
<li><a href="services/"><img src='images/16/cog.png' border=0 align=absmiddle> All Services </a></li>
|
||||
@ -100,7 +95,6 @@ if($_SESSION['userlevel'] >= '10') {
|
||||
?>
|
||||
</ul>
|
||||
</td></tr></table>
|
||||
<!--[if lte IE 6]></a><![endif]-->
|
||||
</li>
|
||||
|
||||
<?php
|
||||
@ -109,8 +103,7 @@ if($config['show_locations']) { echo("<li><a class='menu2four' href='locations/'
|
||||
?>
|
||||
|
||||
|
||||
<li><a><img src='images/16/connect.png' border=0 align=absmiddle> Ports
|
||||
<!--[if IE 7]><!--></a><!--<![endif]-->
|
||||
<li><a class='menu2four' href='interfaces/'><img src='images/16/connect.png' border=0 align=absmiddle> Ports</a>
|
||||
|
||||
<table><tr><td>
|
||||
<ul>
|
||||
@ -161,7 +154,6 @@ echo("<li><a href='?page=interfaces&status=0'><img src='images/16/link_error.png
|
||||
|
||||
</ul></td></tr></table>
|
||||
|
||||
<!--[if lte IE 6]></a><![endif]-->
|
||||
</li>
|
||||
|
||||
<li><a class="menu2four" href="?page=temperatures"><img src='images/16/weather_sun.png' border=0 align=absmiddle> Temps</a></li>
|
||||
@ -174,8 +166,7 @@ echo("<li><a href='?page=interfaces&status=0'><img src='images/16/link_error.png
|
||||
|
||||
if($_SESSION['userlevel'] >= '5') {
|
||||
echo("
|
||||
<li><a><img src='images/16/link.png' border=0 align=absmiddle> BGP Sessions
|
||||
<!--[if IE 7]><!--></a><!--<![endif]-->
|
||||
<li><a class='menu2four' href='bgp/'><img src='images/16/link.png' border=0 align=absmiddle> BGP Sessions</a>
|
||||
<table><tr><td>
|
||||
<ul>
|
||||
<li><a href='bgp/'><img src='images/16/link.png' border=0 align=absmiddle> All Sessions </a></li>
|
||||
@ -194,7 +185,6 @@ echo(" <li><hr /></li>
|
||||
|
||||
</ul>
|
||||
</td></tr></table>
|
||||
<!--[if lte IE 6]></a><![endif]-->
|
||||
</li>
|
||||
");
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ if($device['type'] == 'server') { $server_select = "selected"; }
|
||||
if($device['type'] == 'network') { $network_select = "selected"; }
|
||||
if($device['type'] == 'firewall') { $firewall_select = "selected"; }
|
||||
if($device['type'] == 'workstation') { $workstation_select = "selected"; }
|
||||
if($device['type'] == 'other') { $other_select = "selected"; }
|
||||
if($device['type'] == 'other' || $device['type'] == 'unknown') { $other_select = "selected"; }
|
||||
|
||||
echo("<table cellpadding=0 cellspacing=0><tr><td>
|
||||
|
||||
|
@ -34,8 +34,8 @@ echo("<table cellpadding=7 cellspacing=0 class=devicetable width=100%>");
|
||||
while($interface = mysql_fetch_array($query)) {
|
||||
$done = "yes";
|
||||
unset($class);
|
||||
$interface['ifAlias'] = str_replace($type . ": ", "", $interface['ifAlias']);
|
||||
$interface['ifAlias'] = str_replace("[PNI]", "Private", $interface['ifAlias']);
|
||||
$interface['ifAlias'] = str_ireplace($type . ": ", "", $interface['ifAlias']);
|
||||
$interface['ifAlias'] = str_ireplace("[PNI]", "Private", $interface['ifAlias']);
|
||||
$ifclass = ifclass($interface['ifOperStatus'], $interface['ifAdminStatus']);
|
||||
if($bg == "#ffffff") { $bg = "#e5e5e5"; } else { $bg="#ffffff"; }
|
||||
echo("<tr bgcolor='$bg'>
|
||||
|
@ -1,4 +1,4 @@
|
||||
\<?php
|
||||
<?php
|
||||
|
||||
if($_SESSION['userlevel'] >= '5') {
|
||||
$sql = "SELECT * FROM `storage` AS S, `devices` AS D WHERE S.host_id = D.device_id ORDER BY D.hostname, S.hrStorageDescr";
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
$cmd = $config['snmpbulkwalk'] . " -m IF-MIB -O nsq -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
|
||||
$cmd .= " ifDescr";
|
||||
echo("$cmd");
|
||||
if ($debug) echo("$cmd");
|
||||
$interfaces = trim(shell_exec($cmd));
|
||||
$interfaces = str_replace("\"", "", $interfaces);
|
||||
$interfaces = str_replace("ifDescr.", "", $interfaces);
|
||||
@ -39,7 +39,7 @@
|
||||
if (preg_match('/ng[0-9]+$/', $if)) { $nullintf = 1; }
|
||||
}
|
||||
if ($nullintf == 0) {
|
||||
echo("$if\n");
|
||||
if ($debug) echo("$if\n");
|
||||
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `interfaces` WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'"), 0) == '0') {
|
||||
mysql_query("INSERT INTO `interfaces` (`device_id`,`ifIndex`,`ifDescr`) VALUES ('".$device['device_id']."','$ifIndex','$ifDescr')");
|
||||
# Add Interface
|
||||
|
@ -16,9 +16,9 @@
|
||||
list($descr, $units, $size, $fstype) = explode("\n", $temp);
|
||||
list($units) = explode(" ", $units);
|
||||
$allow = 1;
|
||||
foreach($config['ignore_mount'] as $bi) { if($bi == $descr) { $allow = 0; echo("$bi == $descr \n"); } }
|
||||
foreach($config['ignore_mount_string'] as $bi) { if(strpos($descr, $bi) !== FALSE) { $allow = 0; echo("$descr, $bi \n"); } }
|
||||
foreach($config['ignore_mount_regexp'] as $bi) { if(preg_match($bi, $descr)) { $allow = 0; echo("$bi, $descr \n"); } }
|
||||
foreach($config['ignore_mount'] as $bi) { if($bi == $descr) { $allow = 0; if ($debug) echo("$bi == $descr \n"); } }
|
||||
foreach($config['ignore_mount_string'] as $bi) { if(strpos($descr, $bi) !== FALSE) { $allow = 0; if ($debug) echo("$descr, $bi \n"); } }
|
||||
foreach($config['ignore_mount_regexp'] as $bi) { if(preg_match($bi, $descr)) { $allow = 0; if ($debug) echo("$bi, $descr \n"); } }
|
||||
$descr = str_replace("mounted on: ", "", $descr);
|
||||
$descr = str_replace(": var file system", "", $descr);
|
||||
|
||||
|
@ -36,7 +36,7 @@ while ($dr = mysql_fetch_array($dq)) {
|
||||
if($dr['storage_perc'] < '40' && $perc >= '40') {
|
||||
if($device['sysContact']) { $email = $device['sysContact']; } else { $email = $config['email_default']; }
|
||||
$msg = "Disk Alarm: " . $device['hostname'] . " " . $dr['hrStorageDescr'] . " is " . $perc;
|
||||
$msg .= " at " . date('l dS F Y h:i:s A');
|
||||
$msg .= "% at " . date('l dS F Y h:i:s A');
|
||||
mail($email, "Disk Alarm: " . $device['hostname'] . " " . $dr['hrStorageDescr'], $msg, $config['email_headers']);
|
||||
echo("Alerting for " . $device['hostname'] . " " . $dr['hrStorageDescr'] . "/n");
|
||||
}
|
||||
|
@ -200,7 +200,7 @@ while ($device = mysql_fetch_array($device_query)) {
|
||||
echo("\n");
|
||||
} else {
|
||||
$update_query = "UPDATE `devices` SET ";
|
||||
$update .= " `status` = '0'";
|
||||
$update_query .= " `status` = '0'";
|
||||
$update_query .= " WHERE `device_id` = '" . $device['device_id'] . "'";
|
||||
echo("Updating " . $device['hostname'] . "\n");
|
||||
$update_result = mysql_query($update_query);
|
||||
@ -210,7 +210,7 @@ while ($device = mysql_fetch_array($device_query)) {
|
||||
$poller_end = utime(); $poller_run = $poller_end - $poller_start; $poller_time = substr($poller_run, 0, 5);
|
||||
|
||||
$string = $argv[0] . " $doing " . date("F j, Y, G:i") . " - $i devices polled in $poller_time secs";
|
||||
echo("$string\n");
|
||||
if ($debug) echo("$string\n");
|
||||
shell_exec("echo '".$string."' >> ".$config['install_dir']."/observer.log");
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user