mirror of
https://github.com/librenms/librenms.git
synced 2024-09-21 10:28:13 +00:00
a million fixes. half way to 0.6.0! :D
git-svn-id: http://www.observium.org/svn/observer/trunk@407 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
parent
35bc68a0d9
commit
bc6ad69724
@ -18,7 +18,7 @@ while ($alert = mysql_fetch_array($alert_query)) {
|
||||
|
||||
if($alert_text) {
|
||||
echo("$alert_text");
|
||||
# `echo '$alert_text' | gnokii --sendsms 07885729982`;
|
||||
# `echo '$alert_text' | gnokii --sendsms <NUMBER>`;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
./process-syslog.php
|
||||
sleep 10
|
||||
./process-syslog.php &
|
||||
sleep 10
|
||||
./process-syslog.php &
|
||||
sleep 10
|
||||
./process-syslog.php &
|
||||
sleep 10
|
||||
./process-syslog.php &
|
||||
sleep 10
|
||||
./process-syslog.php &
|
||||
#sleep 10
|
||||
#./process-syslog.php &
|
||||
#sleep 10
|
||||
#./process-syslog.php &
|
||||
#sleep 10
|
||||
#./process-syslog.php &
|
||||
#sleep 10
|
||||
#./process-syslog.php &
|
||||
#sleep 10
|
||||
#./process-syslog.php &
|
||||
|
||||
|
9
cron.sh
9
cron.sh
@ -1,10 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
#./discovery.php --forced >> /var/log/observer.log
|
||||
./poll-mac_accounting.php >> /var/log/observer.log &
|
||||
./discover-bgp_peers.php >> /var/log/observer.log &
|
||||
|
||||
./poll-device.php --odd >> /var/log/observer.log &
|
||||
./poll-device.php --even >> /var/log/observer.log &
|
||||
|
||||
#./poll-device.php --odd3 >> /var/log/observer.log &
|
||||
#./poll-device.php --even3 >> /var/log/observer.log &
|
||||
#./poll-device.php --other3 >> /var/log/observer.log &
|
||||
|
||||
./poll-mac_accounting.php >> /var/log/observer.log
|
||||
./check-services.php
|
||||
#./alerts.php
|
||||
./poll-billing.php
|
||||
|
@ -23,7 +23,7 @@ $data = trim(`cat mac-accounting.txt`);
|
||||
|
||||
foreach( explode("\n", $data) as $peer_entry) {
|
||||
list($interface_ip, $peer_ip, $peer_desc, $peer_asn, $peer_mac, $in_oid, $out_oid) = explode(",", $peer_entry);
|
||||
$interface_id = mysql_result(mysql_query("SELECT interface_id FROM ipaddr WHERE addr = '$interface_ip'"),0);
|
||||
$interface_id = mysql_result(mysql_query("SELECT interface_id FROM ipv4_addresses WHERE ipv4_address = '$interface_ip'"),0);
|
||||
$device_id = mysql_result(mysql_query("SELECT device_id FROM interfaces WHERE interface_id = '$interface_id'"),0);
|
||||
|
||||
echo("PEER : $peer_ip AS$peer_asn ($peer_mac) int: $interface_id host: $device_id \n");
|
||||
|
@ -70,6 +70,7 @@ while ($device = mysql_fetch_array($device_query)) {
|
||||
include("includes/discovery/cisco-pw.php");
|
||||
include("includes/discovery/cisco-vrf.php");
|
||||
include("includes/discovery/cisco-processors.php");
|
||||
include("includes/discovery/cisco-mempool.php");
|
||||
}
|
||||
|
||||
echo("\n"); $devices_discovered++;
|
||||
|
@ -1,10 +1,12 @@
|
||||
<?php
|
||||
|
||||
if($_GET['debug']) {
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 0);
|
||||
ini_set('log_errors', 0);
|
||||
ini_set('allow_url_fopen', 0);
|
||||
# ini_set('error_reporting', E_ALL);
|
||||
ini_set('error_reporting', E_ALL);
|
||||
}
|
||||
|
||||
include("../config.php");
|
||||
include("../includes/functions.php");
|
||||
@ -26,7 +28,7 @@
|
||||
$device_id = getpeerhost($_GET['peer']);
|
||||
}
|
||||
|
||||
if($_GET['legend']) { $legend = $_GET['legend']; }
|
||||
if($_GET['legend']) { $legend = $_GET['legend']; } else { $legend = '1'; }
|
||||
if($_GET['inverse']) { $inverse = $_GET['inverse']; }
|
||||
if($device_id) { $hostname = gethostbyid($device_id); }
|
||||
|
||||
@ -152,17 +154,24 @@
|
||||
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 = memgraph ($hostname . "/mem.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||
$graph = graph_device_cempMemPool ($device_id, $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||
#$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);
|
||||
@ -224,8 +233,13 @@
|
||||
}
|
||||
break;
|
||||
default:
|
||||
echo("INCORRECT GRAPH TYPE");
|
||||
exit;
|
||||
if(is_file($config['install_dir'] . "/html/includes/graphs/$type.inc.php")) {
|
||||
include($config['install_dir'] . "/html/includes/graphs/$type.inc.php");
|
||||
} else {
|
||||
echo("INCORRECT GRAPH TYPE");
|
||||
exit;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if($graph) {
|
||||
|
@ -1,16 +1,24 @@
|
||||
<?php
|
||||
|
||||
$daily_traffic = "graph.php?host=" . $device['device_id'] . "&type=$graph_type&from=$day&to=$now&width=215&height=100";
|
||||
$daily_traffic .= $args;
|
||||
$daily_url = "graph.php?host=" . $device['device_id'] . "&type=$graph_type&from=$day&to=$now&width=400&height=150";
|
||||
$daily_url .= $args;
|
||||
|
||||
$weekly_traffic = "graph.php?host=" . $device['device_id'] . "&type=$graph_type&from=$week&to=$now&width=215&height=100";
|
||||
$weekly_traffic .= $args;
|
||||
$weekly_url = "graph.php?host=" . $device['device_id'] . "&type=$graph_type&from=$week&to=$now&width=400&height=150";
|
||||
$weekly_url .= $args;
|
||||
|
||||
$monthly_traffic = "graph.php?host=" . $device['device_id'] . "&type=$graph_type&from=$month&to=$now&width=215&height=100";
|
||||
$monthly_traffic .= $args;
|
||||
$monthly_url = "graph.php?host=" . $device['device_id'] . "&type=$graph_type&from=$month&to=$now&width=400&height=150";
|
||||
$monthly_url .= $args;
|
||||
|
||||
$yearly_traffic = "graph.php?host=" . $device['device_id'] . "&type=$graph_type&from=$year&to=$now&width=215&height=100";
|
||||
$yearly_url = "graph.php?host=" . $device['device_id'] . "&type=$graph_type&from=$year&to=$now&width=400&height=150";
|
||||
$yearly_traffic .= $args;
|
||||
$yearly_url = "graph.php?host=" . $device['device_id'] . "&type=$graph_type&from=$year&to=$now&width=400&height=150";
|
||||
$yearly_url .= $args;
|
||||
|
||||
echo("<a onmouseover=\"return overlib('<img src=\'$daily_url\'>', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\">
|
||||
<img src='$daily_traffic' border=0></a> ");
|
||||
|
@ -5,41 +5,31 @@
|
||||
$interface['device_id'] = $device['device_id'];
|
||||
$interface['hostname'] = $device['hostname'];
|
||||
|
||||
if(!$graph_type) { $graph_type = "bits"; }
|
||||
|
||||
$if_id = $interface['interface_id'];
|
||||
|
||||
|
||||
$ifDescr = fixifName($interface['ifDescr']);
|
||||
$ifIndex = $interface['ifIndex'];
|
||||
$ifAlias = $interface['ifAlias'];
|
||||
$ifSpeed = humanspeed($interface['ifSpeed']);
|
||||
$ifPhysAddress = $interface['ifPhysAddress'];
|
||||
$ifType = fixiftype($interface['ifType']);
|
||||
$ifHardType = $interface['ifHardType'];
|
||||
# $ifType = fixiftype($interface['ifType']);
|
||||
# $ifHardType = $interface['ifHardType'];
|
||||
|
||||
# if($ifAlias) {$ifAlias = $ifAlias . ;}
|
||||
#if($bg == "#ffffff") { $bg = "#e5e5e5"; } else { $bg="#ffffff"; }
|
||||
if($bg == "#e5e5e5") { $bg = "#ffffff"; } else { $bg="#e5e5e5"; }
|
||||
|
||||
if($interface['in_errors'] > 0 || $interface['out_errors'] > 0) {
|
||||
$error_img = generateiflink($interface,"<img src='images/16/chart_curve_error.png' alt='Interface Errors' border=0>",errors);
|
||||
} else { $error_img = ""; }
|
||||
|
||||
# $graph_url = "graph.php?if=$if_id&from=$twoday&to=$now&width=400&height=120&type=bits";
|
||||
|
||||
echo("<tr style=\"background-color: $bg; padding: 5px;\" valign=top onmouseover=\"this.style.backgroundColor='#fdd';\" onmouseout=\"this.style.backgroundColor='$bg';\" onclick=\"location.href='/device/".$device['device_id']."/interface/".$interface['interface_id']."/'\" style='cursor: hand;'>
|
||||
<td valign=top width=300>");
|
||||
|
||||
echo(" <span class=list-large>
|
||||
" . generateiflink($interface, "$i. $ifDescr") . " $error_img
|
||||
" . generateiflink($interface, "$i. ".fixifName($interface['ifDescr'])) . " $error_img
|
||||
|
||||
</span><br /><span class=interface-desc>$ifAlias</span>");
|
||||
</span><br /><span class=interface-desc>".$interface['ifAlias']."</span>");
|
||||
|
||||
if($ifAlias) { echo("<br />"); }
|
||||
if($interface['ifAlias']) { echo("<br />"); }
|
||||
|
||||
unset ($break);
|
||||
if(!$dographs) {
|
||||
if($port_details) {
|
||||
$ipdata = mysql_query("SELECT * FROM `ipv4_addresses` WHERE `interface_id` = '" . $interface['interface_id'] . "'");
|
||||
while($ip = mysql_fetch_Array($ipdata)) {
|
||||
echo("$break <a class=interface-desc href=\"javascript:popUp('/netcmd.php?cmd=whois&query=$ip[ipv4_address]')\">$ip[ipv4_address]/$ip[ipv4_prefixlen]</a>");
|
||||
@ -50,7 +40,8 @@
|
||||
echo("$break <a class=interface-desc href=\"javascript:popUp('/netcmd.php?cmd=whois&query=".$ip6['ipv6_address']."')\">".Net_IPv6::compress($ip6['ipv6_address'])."/".$ip6['ipv6_prefixlen']."</a>");
|
||||
$break = "<br />";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
echo("</span>");
|
||||
|
||||
echo("</td><td width=100>");
|
||||
@ -61,23 +52,21 @@
|
||||
|
||||
echo("</td><td width=120>");
|
||||
if($interface['ifOperStatus'] == "up") {
|
||||
|
||||
$in_perc = @round($interface['in_rate']/$interface['ifSpeed']*100);
|
||||
$out_perc = @round($interface['in_rate']/$interface['ifSpeed']*100);
|
||||
|
||||
echo("<img src='images/16/arrow_left.png' align=absmiddle> <span style='color: " . percent_colour($in_perc) . "'>" .
|
||||
formatRates($interface['in_rate']) . "</span><br />");
|
||||
echo("<img align=absmiddle src='images/16/arrow_out.png'> <span style='color: " . percent_colour($out_perc) . "'>" .
|
||||
formatRates($interface['out_rate']) . "</span>");
|
||||
|
||||
formatRates($interface['out_rate']) . "</span>");
|
||||
}
|
||||
echo("</td><td width=75Barbuda>");
|
||||
if($ifSpeed && $ifSpeed != "") { echo("<span class=box-desc>$ifSpeed</span>"); }
|
||||
|
||||
echo("</td><td width=75>");
|
||||
if($interface['ifSpeed'] && $interface['ifAlias'] != "") { echo("<span class=box-desc>".humanspeed($interface['ifSpeed'])."</span>"); }
|
||||
echo("<br />");
|
||||
|
||||
# if($interface[ifDuplex] != unknown) { echo("<span class=box-desc>Duplex " . $interface['ifDuplex'] . "</span>"); } else { echo("-"); }
|
||||
|
||||
if($device['os'] == "IOS" || $device['os'] == "IOS XE") {
|
||||
|
||||
if($interface['ifTrunk']) {
|
||||
echo("<span class=box-desc><span class=red>" . $interface['ifTrunk'] . "</span></span>");
|
||||
} elseif ($interface['ifVlan']) {
|
||||
@ -86,22 +75,22 @@
|
||||
$vrf = mysql_fetch_array(mysql_query("SELECT * FROM vrfs WHERE vrf_id = '".$interface['ifVrf']."'"));
|
||||
echo("<span style='color: green;'>" . $vrf['vrf_name'] . "</span>");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
echo("</td><td width=150>");
|
||||
if($ifType && $ifType != "") { echo("<span class=box-desc>" . $ifType . "</span>"); } else { echo("-"); }
|
||||
if($interface['ifType'] && $interface['ifType'] != "") { echo("<span class=box-desc>" . fixiftype($interface['ifType']) . "</span>"); } else { echo("-"); }
|
||||
echo("<br />");
|
||||
if($ifHardType && $ifHardType != "") { echo("<span class=box-desc>" . $ifHardType . "</span>"); } else { echo("-"); }
|
||||
echo("</td><td width=150>");
|
||||
if($interface['ifPhysAddress'] && $interface['ifPhysAddress'] != "") { echo("<span class=box-desc>" . $interface['ifPhysAddress'] . "</span>"); } else { echo("-"); }
|
||||
echo("<br />");
|
||||
if($interface['ifMtu'] && $interface['ifMtu'] != "") { echo("<span class=box-desc>MTU " . $interface['ifMtu'] . "</span>"); } else { echo("-"); }
|
||||
}
|
||||
|
||||
#}
|
||||
|
||||
echo("</td>");
|
||||
echo("<td width=375 valign=top class=interface-desc>");
|
||||
if ( strpos($ifDescr, "oopback") === false && !$dographs) {
|
||||
if ( strpos($interface['ifDescr'], "oopback") === false && !$graph_type) {
|
||||
$link_query = mysql_query("select * from links AS L, interfaces AS I, devices AS D WHERE L.src_if = '$if_id' AND L.dst_if = I.interface_id AND I.device_id = D.device_id");
|
||||
while($link = mysql_fetch_array($link_query)) {
|
||||
# echo("<img src='images/16/connect.png' align=absmiddle alt='Directly Connected' /> " . generateiflink($link, makeshortif($link['ifDescr'])) . " on " . generatedevicelink($link, shorthost($link['hostname'])) . "</a><br />");
|
||||
@ -112,6 +101,8 @@ echo("</td>");
|
||||
|
||||
unset($br);
|
||||
|
||||
if($port_details) { ## Show which other devices are on the same subnet as this interface
|
||||
|
||||
$sql = "SELECT `ipv4_network_id` FROM `ipv4_addresses` WHERE `interface_id` = '".$interface['interface_id']."' AND `ipv4_address` NOT LIKE '127.%'";
|
||||
$nets_query = mysql_query($sql);
|
||||
while($net = mysql_fetch_array($nets_query)) {
|
||||
@ -129,7 +120,6 @@ echo("</td>");
|
||||
$this_ifname = fixifName($new['ifDescr']);
|
||||
$int_links[$this_ifid] = $this_ifid;
|
||||
$int_links_v4[$this_ifid] = 1;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -152,6 +142,7 @@ echo("</td>");
|
||||
$int_links_v6[$this_ifid] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach($int_links as $int_link) {
|
||||
|
||||
@ -187,7 +178,7 @@ echo("</td>");
|
||||
echo("</td></tr>");
|
||||
|
||||
// If we're showing graphs, generate the graph and print the img tags
|
||||
if($dographs && is_file($config['rrd_dir'] . "/" . $hostname . "/". $ifIndex . ".rrd")) {
|
||||
if($graph_type && is_file($config['rrd_dir'] . "/" . $hostname . "/". $interface['ifIndex'] . ".rrd")) {
|
||||
|
||||
$type = $graph_type;
|
||||
|
||||
@ -203,7 +194,7 @@ echo("</td>");
|
||||
$yearly_traffic = "graph.php?if=$if_id&type=" . $graph_type . "&from=$year&to=$now&width=210&height=100";
|
||||
$yearly_url = "graph.php?if=$if_id&type=" . $graph_type . "&from=$year&to=$now&width=500&height=150";
|
||||
|
||||
echo("<tr style='background-color: $bg; padding: 5px;'><td colspan=3>");
|
||||
echo("<tr style='background-color: $bg; padding: 5px;'><td colspan=7>");
|
||||
|
||||
echo("<a href='?page=interface&id=" . $interface['interface_id'] . "' onmouseover=\"return overlib('<img src=\'$daily_url\'>', LEFT".$config['overlib_defaults'].");\"
|
||||
onmouseout=\"return nd();\"> <img src='$daily_traffic' border=0></a>");
|
||||
|
@ -37,6 +37,40 @@ echo("<li class=" . $select['graphs'] . ">
|
||||
</li>
|
||||
");
|
||||
|
||||
$health = mysql_result(mysql_query("select count(temp_id) from temperature WHERE temp_host = '" . $device['device_id'] . "'"), 0) +
|
||||
mysql_result(mysql_query("select count(*) from cempMemPool WHERE device_id = '" . $device['device_id'] . "'"), 0) +
|
||||
mysql_result(mysql_query("select count(*) from cpmCPU WHERE device_id = '" . $device['device_id'] . "'"), 0);
|
||||
|
||||
if($health) {
|
||||
echo("
|
||||
<li class=" . $select['health'] . ">
|
||||
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/health/'>
|
||||
<img src='images/16/chart_curve.png' align=absmiddle border=0> Health
|
||||
</a>
|
||||
</li>
|
||||
");
|
||||
}
|
||||
|
||||
if(is_dir($config['collectd_dir'] . "/" . $device['hostname'] ."/")) {
|
||||
echo("
|
||||
<li class=" . $select['collectd'] . ">
|
||||
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/collectd/'>
|
||||
<img src='images/16/chart_line.png' align=absmiddle border=0> CollectD
|
||||
</a>
|
||||
</li>
|
||||
");
|
||||
}
|
||||
|
||||
|
||||
if(@mysql_result(mysql_query("select count(interface_id) from interfaces WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0') {
|
||||
echo("
|
||||
<li class=" . $select['ports'] . ">
|
||||
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports/".$config['ports_page_default']."'>
|
||||
<img src='images/16/connect.png' align=absmiddle border=0> Ports
|
||||
</a>
|
||||
</li>");
|
||||
}
|
||||
|
||||
if(@mysql_result(mysql_query("select count(vlan_id) from vlans WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0') {
|
||||
echo("
|
||||
<li class=" . $select['vlans'] . ">
|
||||
@ -65,22 +99,17 @@ if($config['enable_bgp'] && $device['bgpLocalAs']) {
|
||||
</li>");
|
||||
}
|
||||
|
||||
if(@mysql_result(mysql_query("select count(interface_id) from interfaces WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0') {
|
||||
if(@mysql_result(mysql_query("SELECT count(*) FROM nagios_hosts WHERE address = '".$device['hostname']."'", $nagios_link), 0) > '0') {
|
||||
echo("
|
||||
<li class=" . $select['ifs'] . ">
|
||||
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports/'>
|
||||
<img src='images/16/connect.png' align=absmiddle border=0> Ports
|
||||
<li class=" . $select['nagios'] . ">
|
||||
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/nagios/'>
|
||||
<img src='images/16/transmit_blue.png' align=absmiddle border=0> Nagios
|
||||
</a>
|
||||
</li>");
|
||||
|
||||
#<li class=" . $select['ifgraphs'] . ">
|
||||
# <a href='".$config['base_url']."/device/" . $device['device_id'] . "/ifgraphs/'>
|
||||
# <img src='images/16/port_graphs.png' align=absmiddle border=0> Port Graphs
|
||||
# </a>
|
||||
#</li>");
|
||||
}
|
||||
|
||||
if($_SESSION[userlevel] >= "5") {
|
||||
|
||||
if($_SESSION[userlevel] >= "5" && mysql_result(mysql_query("SELECT count(*) FROM links AS L, interfaces AS I WHERE I.device_id = '".$device['device_id']."' AND I.interface_id = L.src_if"),0)) {
|
||||
echo("
|
||||
<li class=" . $select['map'] . ">
|
||||
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/map/'>
|
||||
@ -102,16 +131,6 @@ if($config['enable_inventory'] && @mysql_result(mysql_query("SELECT * FROM `entP
|
||||
|
||||
}
|
||||
|
||||
if(mysql_result(mysql_query("select count(temp_id) from temperature WHERE temp_host = '" . $device['device_id'] . "'"), 0) > '0') {
|
||||
echo("
|
||||
<li class=" . $select['temp'] . ">
|
||||
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/temp/'>
|
||||
<img src='images/16/weather_sun.png' align=absmiddle border=0> Temps
|
||||
</a>
|
||||
</li>
|
||||
");
|
||||
}
|
||||
|
||||
if(mysql_result(mysql_query("select count(storage_id) from storage WHERE host_id = '" . $device['device_id'] . "'"), 0) > '0') {
|
||||
echo("
|
||||
<li class=" . $select['storage'] . ">
|
||||
|
@ -7,6 +7,11 @@ 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");
|
||||
}
|
||||
|
||||
switch ($device['os']) {
|
||||
case "JunOS":
|
||||
echo("<div class=graphhead>Processor Utilisation</div>");
|
||||
@ -165,22 +170,8 @@ while($device = mysql_fetch_array($device_query)) {
|
||||
break;
|
||||
case "IOS":
|
||||
case "IOS XE":
|
||||
echo("<div class=graphhead>CPU Usage</div>");
|
||||
$graph_type = "cpu"; include ("includes/print-device-graph.php");
|
||||
echo("<br />");
|
||||
echo("<div class=graphhead>Memory Usage</div>");
|
||||
$graph_type = "mem"; 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 = "dev_temp"; include ("includes/print-device-graph.php");
|
||||
echo("<br />");
|
||||
}
|
||||
|
||||
include("graphs/netstats.inc.php");
|
||||
include("graphs/uptime.inc.php");
|
||||
break;
|
||||
case "Snom":
|
||||
case "Snom":
|
||||
echo("<div class=graphhead>Calls</div>");
|
||||
$graph_type = "calls"; include ("includes/print-device-graph.php");
|
||||
}
|
||||
|
@ -16,6 +16,11 @@ include_once($config['install_dir'] . "/includes/cisco-entities.php");
|
||||
include_once($config['install_dir'] . "/includes/syslog.php");
|
||||
include_once($config['install_dir'] . "/includes/rewrites.php");
|
||||
|
||||
function only_alphanumeric( $string )
|
||||
{
|
||||
return preg_replace('/[^a-zA-Z0-9]/', '', $string);
|
||||
}
|
||||
|
||||
|
||||
function mres($string) { // short function wrapper because the real one is stupidly long and ugly. aestetics.
|
||||
return mysql_real_escape_string($string);
|
||||
@ -142,9 +147,9 @@ function formatRates($rate)
|
||||
return $rate;
|
||||
}
|
||||
|
||||
function formatstorage($rate)
|
||||
function formatstorage($rate, $round = '2')
|
||||
{
|
||||
$rate = format_bi($rate) . "B";
|
||||
$rate = format_bi($rate, $round) . "B";
|
||||
return $rate;
|
||||
}
|
||||
|
||||
@ -157,12 +162,12 @@ function format_si($rate)
|
||||
return round($rate, $round[$i]).$ext;
|
||||
}
|
||||
|
||||
function format_bi($size)
|
||||
function format_bi($size, $round = '2')
|
||||
{
|
||||
$sizes = Array('', 'Ki', 'Mi', 'Gi', 'Ti', 'Pi', 'Ei');
|
||||
$sizes = Array('', 'K', 'M', 'G', 'T', 'P', 'E');
|
||||
$ext = $sizes[0];
|
||||
for ($i=1; (($i < count($sizes)) && ($size >= 1024)); $i++) { $size = $size / 1024; $ext = $sizes[$i]; }
|
||||
return round($size, 2).$ext;
|
||||
return round($size, $round).$ext;
|
||||
}
|
||||
|
||||
function arguments($argv)
|
||||
@ -203,11 +208,11 @@ function truncate($substring, $max = 50, $rep = '...')
|
||||
if(strlen($string) > $max){ return substr_replace($string, $rep, $leave); } else { return $string; }
|
||||
}
|
||||
|
||||
function interface_rates ($interface) // Returns the last in/out value in RRD
|
||||
function interface_rates ($rrd_file) // Returns the last in/out value in RRD
|
||||
{
|
||||
global $config;
|
||||
$rrdfile = $config['rrd_dir'] . "/" . $interface['hostname'] . "/" . $interface['ifIndex'] . ".rrd";
|
||||
$cmd = $config['rrdtool']." fetch -s -600s -e now ".$rrdfile." AVERAGE | grep : | cut -d\" \" -f 2,3 | grep e";
|
||||
#$rrdfile = $config['rrd_dir'] . "/" . $interface['hostname'] . "/" . $interface['ifIndex'] . ".rrd";
|
||||
$cmd = $config['rrdtool']." fetch -s -600s -e now $rrd_file AVERAGE | grep : | cut -d\" \" -f 2,3 | grep e";
|
||||
$data = trim(`$cmd`);
|
||||
foreach( explode("\n", $data) as $entry) {
|
||||
list($in, $out) = split(" ", $entry);
|
||||
@ -217,12 +222,12 @@ function interface_rates ($interface) // Returns the last in/out value in RRD
|
||||
return $rate;
|
||||
}
|
||||
|
||||
function interface_errors ($interface) // Returns the last in/out errors value in RRD
|
||||
function interface_errors ($rrd_file) // Returns the last in/out errors value in RRD
|
||||
{
|
||||
global $config;
|
||||
$rrdfile = $config['rrd_dir'] . "/" . $interface['hostname'] . "/" . $interface['ifIndex'] . ".rrd";
|
||||
$cmd = $config['rrdtool']." fetch -s -1d -e -300s $rrdfile AVERAGE | grep : | cut -d\" \" -f 4,5";
|
||||
$data = trim(`$cmd`);
|
||||
#$rrdfile = $config['rrd_dir'] . "/" . $interface['hostname'] . "/" . $interface['ifIndex'] . ".rrd";
|
||||
$cmd = $config['rrdtool']." fetch -s -1d -e -300s $rrd_file AVERAGE | grep : | cut -d\" \" -f 4,5";
|
||||
$data = trim(shell_exec($cmd));
|
||||
foreach( explode("\n", $data) as $entry) {
|
||||
list($in, $out) = explode(" ", $entry);
|
||||
$in_errors += ($in * 300);
|
||||
|
@ -4,8 +4,9 @@ include("graphing/screenos.php");
|
||||
include("graphing/fortigate.php");
|
||||
include("graphing/windows.php");
|
||||
include("graphing/unix.php");
|
||||
include("graphing/collectd.inc.php");
|
||||
|
||||
function graph_multi_bits ($interfaces, $graph, $from, $to, $width, $height, $title, $vertical, $inverse, $legend = '0') {
|
||||
function graph_multi_bits ($interfaces, $graph, $from, $to, $width, $height, $title, $vertical, $inverse, $legend = '1') {
|
||||
global $config, $installdir;
|
||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
||||
$options = "--alt-autoscale-max -E --start $from --end " . ($to - 150) . " --width $width --height $height";
|
||||
@ -25,17 +26,19 @@ function graph_multi_bits ($interfaces, $graph, $from, $to, $width, $height, $ti
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
if($inverse) { $in = 'out'; $out = 'in'; } else { $in = 'in'; $out = 'out'; }
|
||||
|
||||
$options .= " CDEF:".$in."octets=" . $in_thing . $pluses;
|
||||
$options .= " CDEF:".$out."octets=" . $out_thing . $pluses;
|
||||
$options .= " CDEF:doutoctets=outoctets,-1,*";
|
||||
$options .= " CDEF:inbits=inoctets,8,*";
|
||||
$options .= " CDEF:outbits=outoctets,8,*";
|
||||
$options .= " CDEF:doutbits=doutoctets,8,*";
|
||||
|
||||
if($legend) {
|
||||
if($legend == "no") {
|
||||
$options .= " AREA:inbits#CDEB8B:";
|
||||
$options .= " LINE1.25:inbits#006600:";
|
||||
$options .= " AREA:doutbits#C3D9FF:";
|
||||
$options .= " LINE1.25:doutbits#000099:";
|
||||
} else {
|
||||
$options .= " AREA:inbits#CDEB8B:";
|
||||
$options .= " COMMENT:BPS\ \ \ \ Current\ \ \ Average\ \ \ \ \ \ Max\\\\n";
|
||||
$options .= " LINE1.25:inbits#006600:In\ ";
|
||||
@ -47,11 +50,6 @@ function graph_multi_bits ($interfaces, $graph, $from, $to, $width, $height, $ti
|
||||
$options .= " GPRINT:outbits:LAST:%6.2lf%s";
|
||||
$options .= " GPRINT:outbits:AVERAGE:%6.2lf%s";
|
||||
$options .= " GPRINT:outbits:MAX:%6.2lf%s";
|
||||
} else {
|
||||
$options .= " AREA:inbits#CDEB8B:";
|
||||
$options .= " LINE1.25:inbits#006600:";
|
||||
$options .= " AREA:doutbits#C3D9FF:";
|
||||
$options .= " LINE1.25:doutbits#000099:";
|
||||
}
|
||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal"; }
|
||||
$thing = shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
||||
@ -94,6 +92,35 @@ function temp_graph ($temp, $graph, $from, $to, $width, $height, $title, $vertic
|
||||
return $imgfile;
|
||||
}
|
||||
|
||||
function graph_cpmCPU ($id, $graph, $from, $to, $width, $height, $title, $vertical) {
|
||||
global $config, $installdir;
|
||||
$options = "--start $from --end $to --width $width --height $height --vertical-label '$vertical' --alt-autoscale-max ";
|
||||
$options .= " -l 0 -E -b 1024 --title '$title' ";
|
||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||
$hostname = gethostbyid($device);
|
||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
||||
$iter = "1";
|
||||
$sql = mysql_query("SELECT * FROM `cpmCPU` AS C, `devices` AS D where C.`cpmCPU_id` = '$id' AND C.device_id = D.device_id");
|
||||
$options .= "COMMENT:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Cur\ \ \ \ Max\\\\n";
|
||||
while($proc = mysql_fetch_array($sql)) {
|
||||
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"; unset($iter); }
|
||||
$proc['descr_fixed'] = str_pad($proc['entPhysicalDescr'], 28);
|
||||
$proc['descr_fixed'] = substr($proc['descr_fixed'],0,28);
|
||||
$rrd = $config['rrd_dir'] . "/".$proc['hostname']."/cpmCPU-" . $proc['cpmCPU_oid'] . ".rrd";
|
||||
$options .= " DEF:proc" . $proc['cpmCPU_oid'] . "=$rrd:usage:AVERAGE ";
|
||||
$options .= " LINE1:proc" . $proc['cpmCPU_oid'] . "#" . $colour . ":'" . $proc['descr_fixed'] . "' ";
|
||||
$options .= " GPRINT:proc" . $proc['cpmCPU_oid'] . ":LAST:%3.0lf";
|
||||
$options .= " GPRINT:proc" . $proc['cpmCPU_oid'] . ":MAX:%3.0lf\\\l ";
|
||||
$iter++;
|
||||
}
|
||||
$thing = shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
||||
return $imgfile;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function graph_device_cpmCPU ($device, $graph, $from, $to, $width, $height, $title, $vertical) {
|
||||
global $config, $installdir;
|
||||
$options = "--start $from --end $to --width $width --height $height --vertical-label '$vertical' --alt-autoscale-max ";
|
||||
@ -121,6 +148,81 @@ function graph_device_cpmCPU ($device, $graph, $from, $to, $width, $height, $tit
|
||||
return $imgfile;
|
||||
}
|
||||
|
||||
function graph_device_cempMemPool ($device, $graph, $from, $to, $width, $height, $title, $vertical) {
|
||||
global $config, $installdir;
|
||||
$options = "--start $from --end $to --width $width --height $height --vertical-label '$vertical' --alt-autoscale-max ";
|
||||
$options .= " -l 0 -E -b 1024 --title '$title' ";
|
||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||
$hostname = gethostbyid($device);
|
||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
||||
$iter = "1";
|
||||
$sql = mysql_query("SELECT * FROM `cempMemPool` where `device_id` = '$device'");
|
||||
$options .= "COMMENT:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Cur\ \ \ \ Max\\\\n";
|
||||
while($mempool = mysql_fetch_array($sql)) {
|
||||
$entPhysicalName = mysql_result(mysql_query("SELECT entPhysicalName from entPhysical WHERE device_id = '".$device."'
|
||||
AND entPhysicalIndex = '".$mempool['entPhysicalIndex']."'"),0);
|
||||
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"; unset($iter); }
|
||||
$mempool['descr_fixed'] = $entPhysicalName . " " . $mempool['cempMemPoolName'];
|
||||
$mempool['descr_fixed'] = str_replace("Routing Processor", "RP", $mempool['descr_fixed']);
|
||||
$mempool['descr_fixed'] = str_replace("Switching Processor", "SP", $mempool['descr_fixed']);
|
||||
$mempool['descr_fixed'] = str_replace("Processor", "Proc", $mempool['descr_fixed']);
|
||||
$mempool['descr_fixed'] = str_pad($mempool['descr_fixed'], 28);
|
||||
$mempool['descr_fixed'] = substr($mempool['descr_fixed'],0,28);
|
||||
$oid = $mempool['entPhysicalIndex'] . "." . $mempool['Index'];
|
||||
$rrd = $config['rrd_dir'] . "/$hostname/cempMemPool-$oid.rrd";
|
||||
$id = $mempool['entPhysicalIndex'] . "-" . $mempool['Index'];
|
||||
$options .= " DEF:mempool" . $id . "free=$rrd:free:AVERAGE ";
|
||||
$options .= " DEF:mempool" . $id . "used=$rrd:used:AVERAGE ";
|
||||
$options .= " CDEF:mempool" . $id . "total=mempool" . $id . "used,mempool" . $id . "used,mempool" . $id . "free,+,/,100,* ";
|
||||
$options .= " LINE1:mempool" . $id . "total#" . $colour . ":'" . $mempool['descr_fixed'] . "' ";
|
||||
$options .= " GPRINT:mempool" . $id . "total:LAST:%3.0lf";
|
||||
$options .= " GPRINT:mempool" . $id . "total:MAX:%3.0lf\\\l ";
|
||||
$iter++;
|
||||
}
|
||||
$thing = shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
||||
return $imgfile;
|
||||
}
|
||||
|
||||
function graph_cempMemPool ($id, $graph, $from, $to, $width, $height, $title, $vertical) {
|
||||
global $config, $installdir;
|
||||
$options = "--start $from --end $to --width $width --height $height --vertical-label '$vertical' --alt-autoscale-max ";
|
||||
$options .= " -l 0 -E -b 1024 --title '$title' ";
|
||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||
$hostname = gethostbyid($device);
|
||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
||||
$iter = "1";
|
||||
$sql = mysql_query("SELECT * FROM `cempMemPool` AS C, `devices` AS D where C.`cempMemPool_id` = '$id' AND C.device_id = D.device_id");
|
||||
$options .= "COMMENT:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Cur\ \ \ \ Max\\\\n";
|
||||
while($mempool = mysql_fetch_array($sql)) {
|
||||
$entPhysicalName = mysql_result(mysql_query("SELECT entPhysicalName from entPhysical WHERE device_id = '".$mempool['device_id']."'
|
||||
AND entPhysicalIndex = '".$mempool['entPhysicalIndex']."'"),0);
|
||||
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"; unset($iter); }
|
||||
$mempool['descr_fixed'] = $entPhysicalName . " " . $mempool['cempMemPoolName'];
|
||||
$mempool['descr_fixed'] = str_replace("Routing Processor", "RP", $mempool['descr_fixed']);
|
||||
$mempool['descr_fixed'] = str_replace("Switching Processor", "SP", $mempool['descr_fixed']);
|
||||
$mempool['descr_fixed'] = str_replace("Processor", "Proc", $mempool['descr_fixed']);
|
||||
$mempool['descr_fixed'] = str_pad($mempool['descr_fixed'], 28);
|
||||
$mempool['descr_fixed'] = substr($mempool['descr_fixed'],0,28);
|
||||
$oid = $mempool['entPhysicalIndex'] . "." . $mempool['Index'];
|
||||
$rrd = $config['rrd_dir'] . "/".$mempool['hostname']."/cempMemPool-$oid.rrd";
|
||||
$id = $mempool['entPhysicalIndex'] . "-" . $mempool['Index'];
|
||||
$options .= " DEF:mempool" . $id . "free=$rrd:free:AVERAGE ";
|
||||
$options .= " DEF:mempool" . $id . "used=$rrd:used:AVERAGE ";
|
||||
$options .= " CDEF:mempool" . $id . "total=mempool" . $id . "used,mempool" . $id . "used,mempool" . $id . "free,+,/,100,* ";
|
||||
$options .= " LINE1:mempool" . $id . "total#" . $colour . ":'" . $mempool['descr_fixed'] . "' ";
|
||||
$options .= " GPRINT:mempool" . $id . "total:LAST:%3.0lf";
|
||||
$options .= " GPRINT:mempool" . $id . "total:MAX:%3.0lf\\\l ";
|
||||
$iter++;
|
||||
}
|
||||
|
||||
$thing = shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
||||
return $imgfile;
|
||||
}
|
||||
|
||||
|
||||
function temp_graph_dev ($device, $graph, $from, $to, $width, $height, $title, $vertical) {
|
||||
global $config, $installdir;
|
||||
@ -179,6 +281,7 @@ function graph_mac_acc ($id, $graph, $from, $to, $width, $height) {
|
||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
|
||||
if($height < "33") { $options .= " --only-graph"; }
|
||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||
|
||||
$options .= " DEF:inoctets=$database:IN:AVERAGE";
|
||||
$options .= " DEF:outoctets=$database:OUT:AVERAGE";
|
||||
$options .= " CDEF:octets=inoctets,outoctets,+";
|
||||
@ -390,22 +493,22 @@ function graph_cbgp_prefixes ($rrd, $graph, $from, $to, $width, $height) {
|
||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
|
||||
if($width <= "300") {$options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||
$options .= " DEF:Accepted=$database:AcceptedPrefixes:AVERAGE";
|
||||
$options .= " DEF:Denied=$database:DeniedPrefixes:AVERAGE";
|
||||
$options .= " DEF:Advertised=$database:AdvertisedPrefixes:AVERAGE";
|
||||
$options .= " DEF:Suppressed=$database:SuppressedPrefixes:AVERAGE";
|
||||
$options .= " DEF:Withdrawn=$database:WithdrawnPrefixes:AVERAGE";
|
||||
$options .= " CDEF:dAdvertised=Advertised,-1,*";
|
||||
#$options .= " DEF:Denied=$database:DeniedPrefixes:AVERAGE";
|
||||
#$options .= " DEF:Advertised=$database:AdvertisedPrefixes:AVERAGE";
|
||||
#$options .= " DEF:Suppressed=$database:SuppressedPrefixes:AVERAGE";
|
||||
#$options .= " DEF:Withdrawn=$database:WithdrawnPrefixes:AVERAGE";
|
||||
#$options .= " CDEF:dAdvertised=Advertised,-1,*";
|
||||
$options .= " COMMENT:Prefixes\ \ \ \ \ \ Current\ \ Minimum\ \ Maximum\\\\n";
|
||||
$options .= " AREA:Accepted#eeaaaa:";
|
||||
$options .= " LINE2:Accepted#cc0000:Accepted\ \ ";
|
||||
$options .= " GPRINT:Accepted:LAST:%6.2lf%s";
|
||||
$options .= " GPRINT:Accepted:MIN:%6.2lf%s";
|
||||
$options .= " GPRINT:Accepted:MAX:%6.2lf%s\\\\l";
|
||||
$options .= " AREA:dAdvertised#aaeeaa:";
|
||||
$options .= " LINE2:dAdvertised#00cc00:Advertised";
|
||||
$options .= " GPRINT:Advertised:LAST:%6.2lf%s";
|
||||
$options .= " GPRINT:Advertised:MIN:%6.2lf%s";
|
||||
$options .= " GPRINT:Advertised:MAX:%6.2lf%s\\\\l";
|
||||
#$options .= " AREA:dAdvertised#aaeeaa:";
|
||||
#$options .= " LINE2:dAdvertised#00cc00:Advertised";
|
||||
#$options .= " GPRINT:Advertised:LAST:%6.2lf%s";
|
||||
#$options .= " GPRINT:Advertised:MIN:%6.2lf%s";
|
||||
#$options .= " GPRINT:Advertised:MAX:%6.2lf%s\\\\l";
|
||||
$thing = shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
||||
# echo($config['rrdtool'] . " graph $imgfile $options");
|
||||
return $imgfile;
|
||||
|
@ -4,7 +4,7 @@ $query = "SELECT * FROM cpmCPU WHERE device_id = '" . $device['device_id'] . "'"
|
||||
$proc_data = mysql_query($query);
|
||||
while($processor = mysql_fetch_array($proc_data)) {
|
||||
|
||||
$proc_cmd = "snmpget -O Uqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " cpmCPUTotal5minRev." . $processor['cpmCPU_oid'];
|
||||
$proc_cmd = "snmpget -m CISCO-PROCESS-MIB -O Uqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " cpmCPUTotal5minRev." . $processor['cpmCPU_oid'];
|
||||
$proc = shell_exec($proc_cmd);
|
||||
|
||||
echo("Checking CPU " . $processor['entPhysicalDescr'] . "... ");
|
||||
@ -27,7 +27,6 @@ while($processor = mysql_fetch_array($proc_data)) {
|
||||
echo($proc . "%\n");
|
||||
|
||||
$updatecmd = $config['rrdtool'] ." update $procrrd N:$proc";
|
||||
echo("$updatecmd");
|
||||
shell_exec($updatecmd);
|
||||
|
||||
mysql_query("UPDATE `cpmCPU` SET `cpmCPUTotal5minRev` = '$proc' WHERE `cpmCPU_id` = '".$processor['cpmCPU_id']."'");
|
||||
|
@ -107,5 +107,6 @@
|
||||
|
||||
include("includes/polling/bgpPeer.inc.php");
|
||||
include("includes/polling/cisco-processors.inc.php");
|
||||
include("includes/polling/cisco-mempool.inc.php");
|
||||
|
||||
?>
|
||||
|
@ -14,7 +14,7 @@ if($device[os] != "Snom") {
|
||||
|
||||
$rrdfile = $config['rrd_dir'] . "/" . $device['hostname'] . "/netinfo.rrd";
|
||||
|
||||
$rrd_create = "rrdtool create $rrdfile ";
|
||||
$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";
|
||||
|
||||
@ -23,8 +23,10 @@ if($device[os] != "Snom") {
|
||||
$snmpstring .= " $oid.0";
|
||||
}
|
||||
|
||||
if(!file_exists($rrdfile)) { `$rrd_create`; }
|
||||
$snmpdata_cmd = "snmpget -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " $snmpstring";
|
||||
if(!file_exists($rrdfile)) {
|
||||
shell_exec($rrd_create);
|
||||
}
|
||||
$snmpdata_cmd = "snmpget -m IP-MIB:SNMPv2-MIB:UDP-MIB:TCP-MIB:IP-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " $snmpstring";
|
||||
$snmpdata = trim(`$snmpdata_cmd`);
|
||||
$rrdupdate = "N";
|
||||
foreach(explode("\n", $snmpdata) as $data) {
|
||||
|
@ -48,7 +48,7 @@ while ($dr = mysql_fetch_array($dq)) {
|
||||
$hrStorageAllocationUnits = $dr['hrStorageAllocationUnits'];
|
||||
$hrStorageSize = $dr['hrStorageAllocationUnits'] * $dr['hrStorageSize'];
|
||||
$hrStorageDescr = $dr['hrStorageDescr'];
|
||||
$cmd = "snmpget -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " hrStorageUsed.$hrStorageIndex";
|
||||
$cmd = "snmpget -m HOST-RESOURCES-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " hrStorageUsed.$hrStorageIndex";
|
||||
$used_units = trim(`$cmd`);
|
||||
$used = $used_units * $hrStorageAllocationUnits;
|
||||
$perc = round($used / $hrStorageSize * 100, 2);
|
||||
@ -78,14 +78,10 @@ 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');
|
||||
|
||||
mail($email, "Disk Alarm: " . $device['hostname'] . " " . $dr['hrStorageDescr'], $msg, $config['email_headers']);
|
||||
|
||||
echo("Alerting for " . $device['hostname'] . " " . $dr['hrStorageDescr'] . "/n");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -104,11 +100,11 @@ $oid_ssCpuUser = ".1.3.6.1.4.1.2021.11.9.0";
|
||||
$oid_ssCpuSystem = ".1.3.6.1.4.1.2021.11.10.0";
|
||||
|
||||
|
||||
$cpu_cmd = "snmpget -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
|
||||
$cpu_cmd = $config['snmpget'] ." -m UCD-SNMP-MIB:HOST-RESOURCES-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
|
||||
$cpu_cmd .= " $oid_ssCpuRawUser $oid_ssCpuRawSystem $oid_ssCpuRawNice $oid_ssCpuRawIdle $oid_hrSystemProcesses";
|
||||
$cpu_cmd .= " $oid_hrSystemNumUsers $oid_ssCpuUser $oid_ssCpuSystem .1.3.6.1.4.1.2021.1.101.1";
|
||||
$cpu_cmd .= " $oid_hrSystemNumUsers $oid_ssCpuUser $oid_ssCpuSystem";
|
||||
$cpu = `$cpu_cmd`;
|
||||
list ($cpuUser, $cpuSystem, $cpuNice, $cpuIdle, $procs, $users, $UsageUser, $UsageSystem, $cputemp) = explode("\n", $cpu);
|
||||
list ($cpuUser, $cpuSystem, $cpuNice, $cpuIdle, $procs, $users, $UsageUser, $UsageSystem) = explode("\n", $cpu);
|
||||
|
||||
$cpuUsage = $UsageUser + $UsageSystem;
|
||||
|
||||
@ -192,13 +188,14 @@ if($device[os] != "m0n0wall" && $device[os] != "Voswall" && $device[os] != "pfSe
|
||||
RRA:MAX:0.5:288:800");
|
||||
} // end create load rrd
|
||||
|
||||
$mem_get = "memTotalSwap.0 memAvailSwap.0 memTotalReal.0 memAvailReal.0 memTotalFree.0 memShared.0 memBuffer.0 memCached.0";
|
||||
$mem_cmd = "snmpget -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " " . $mem_get;
|
||||
$mem_raw = `$mem_cmd`;
|
||||
list($memTotalSwap, $memAvailSwap, $memTotalReal, $memAvailReal, $memTotalFree, $memShared, $memBuffer, $memCached) = explode("\n", $mem_raw);
|
||||
$mem_cmd = $config['snmpget'] . " -m UCD-SNMP-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
|
||||
$mem_cmd .= " memTotalSwap.0 memAvailSwap.0 memTotalReal.0 memAvailReal.0 memTotalFree.0 memShared.0 memBuffer.0 memCached.0";
|
||||
|
||||
$mem_raw = shell_exec($mem_cmd);
|
||||
list($memTotalSwap, $memAvailSwap, $memTotalReal, $memAvailReal, $memTotalFree, $memShared, $memBuffer, $memCached) = explode("\n", str_replace(" kB", "", $mem_raw));
|
||||
|
||||
$load_get = "laLoadInt.1 laLoadInt.2 laLoadInt.3";
|
||||
$load_cmd = "snmpget -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " " . $load_get;
|
||||
$load_cmd = "snmpget -m UCD-SNMP-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " " . $load_get;
|
||||
$load_raw = `$load_cmd`;
|
||||
list ($load1, $load5, $load10) = explode ("\n", $load_raw);
|
||||
|
||||
@ -206,16 +203,4 @@ if($device[os] != "m0n0wall" && $device[os] != "Voswall" && $device[os] != "pfSe
|
||||
rrdtool_update($loadrrd, "N:$load1:$load5:$load10");
|
||||
rrdtool_update($memrrd, "N:$memTotalSwap:$memAvailSwap:$memTotalReal:$memAvailReal:$memTotalFree:$memShared:$memBuffer:$memCached");
|
||||
|
||||
if($device['courier']) {
|
||||
include("includes/polling/courierstats.inc.php");
|
||||
}
|
||||
|
||||
if($device['postfix']) {
|
||||
include("includes/polling/mailstats.inc.php");
|
||||
}
|
||||
|
||||
if($device['apache']) {
|
||||
include("includes/polling/apachestats.inc.php");
|
||||
}
|
||||
|
||||
} // end Non-m0n0wall
|
||||
|
@ -18,7 +18,7 @@ while ($interface = mysql_fetch_array($interface_query)) {
|
||||
|
||||
echo("Looking at " . $interface['ifDescr'] . " on " . $device['hostname'] . "\n");
|
||||
|
||||
$snmp_cmd = $config['snmpget'] . " -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
|
||||
$snmp_cmd = $config['snmpget'] . " -m IF-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
|
||||
$snmp_cmd .= " ifAdminStatus." . $interface['ifIndex'] . " ifOperStatus." . $interface['ifIndex'] . " ifAlias." . $interface['ifIndex'];
|
||||
|
||||
$snmp_output = trim(`$snmp_cmd`);
|
||||
@ -93,8 +93,8 @@ while ($interface = mysql_fetch_array($interface_query)) {
|
||||
|
||||
if($ifOperStatus == "up") {
|
||||
|
||||
$snmp_data_cmd = "snmpget -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
|
||||
$snmp_data_cmd = "snmpget -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
|
||||
# $snmp_data_cmd = "snmpget -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
|
||||
$snmp_data_cmd = "snmpget -m IF-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
|
||||
$snmp_data_cmd .= " ifHCInOctets." . $interface['ifIndex'] . " ifHCOutOctets." . $interface['ifIndex'] . " ifInErrors." . $interface['ifIndex'];
|
||||
$snmp_data_cmd .= " ifOutErrors." . $interface['ifIndex'] . " ifInUcastPkts." . $interface['ifIndex'] . " ifOutUcastPkts." . $interface['ifIndex'];
|
||||
$snmp_data_cmd .= " ifInNUcastPkts." . $interface['ifIndex'] . " ifOutNUcastPkts." . $interface['ifIndex'];
|
||||
@ -119,7 +119,7 @@ while ($interface = mysql_fetch_array($interface_query)) {
|
||||
}
|
||||
}
|
||||
|
||||
$rates = interface_rates ($interface);
|
||||
$rates = interface_rates ($rrdfile);
|
||||
mysql_query("UPDATE `interfaces` SET in_rate = '" . $rates['in'] . "', out_rate = '" . $rates['out'] . "' WHERE interface_id= '" . $interface['interface_id'] . "'");
|
||||
|
||||
}
|
||||
|
@ -19,12 +19,20 @@ $config['afi']['ipv6']['multicast'] = "IPv6 Multicast";
|
||||
|
||||
$config['version'] = "0.5.1";
|
||||
|
||||
### Connect to database
|
||||
if (!@mysql_connect($config['db_host'], $config['db_user'], $config['db_pass'])) {
|
||||
echo "<h2>MySQL Error</h2>";
|
||||
$nagios_link = mysql_connect($config['nagios_db_host'], $config['nagios_db_user'], $config['nagios_db_pass']);
|
||||
if (!$nagios_link) {
|
||||
echo "<h2>Nagios MySQL Error</h2>";
|
||||
die;
|
||||
}
|
||||
mysql_select_db($config['db_name']);
|
||||
$nagios_db = mysql_select_db($config['nagios_db_name'], $nagios_link);
|
||||
|
||||
### Connect to database
|
||||
$observer_link = mysql_connect($config['db_host'], $config['db_user'], $config['db_pass']);
|
||||
if (!$observer_link) {
|
||||
echo "<h2>Observer MySQL Error</h2>";
|
||||
die;
|
||||
}
|
||||
$observer_db = mysql_select_db($config['db_name'], $observer_link);
|
||||
|
||||
# Set some times needed by loads of scripts (it's dynamic, so we do it here!)
|
||||
|
||||
|
@ -15,7 +15,7 @@ function process_syslog ($entry, $update) {
|
||||
if($device_id_host) {
|
||||
$device_id = $device_id_host;
|
||||
} else {
|
||||
$device_id_ip = @mysql_result(mysql_query("SELECT D.device_id as device_id FROM ipaddr AS A, interfaces AS I, devices AS D WHERE A.addr = '" . $entry['host']."' AND I.interface_id = A.interface_id AND D.device_id = I.device_id"),0);
|
||||
$device_id_ip = @mysql_result(mysql_query("SELECT D.device_id as device_id FROM ipv4_addresses AS A, interfaces AS I, devices AS D WHERE A.ipv4_address = '" . $entry['host']."' AND I.interface_id = A.interface_id AND D.device_id = I.device_id"),0);
|
||||
if($device_id_ip) {
|
||||
$device_id = $device_id_ip;
|
||||
}
|
||||
@ -23,8 +23,10 @@ function process_syslog ($entry, $update) {
|
||||
|
||||
if($device_id && !$delete) {
|
||||
$entry['device_id'] = $device_id;
|
||||
if(mysql_result(mysql_query("SELECT `os` FROM `devices` WHERE `device_id` = '$device_id'"),0) == "IOS") {
|
||||
$os = mysql_result(mysql_query("SELECT `os` FROM `devices` WHERE `device_id` = '$device_id'"),0);
|
||||
if($os == "IOS" || $os == "IOS XE") {
|
||||
if(strstr($entry[msg], "%")) {
|
||||
$entry['msg'] = preg_replace("/^%(.+?):\ /", "\\1||", $entry['msg']);
|
||||
list(,$entry[msg]) = split(": %", $entry['msg']);
|
||||
$entry['msg'] = "%" . $entry['msg'];
|
||||
$entry['msg'] = preg_replace("/^%(.+?):\ /", "\\1||", $entry['msg']);
|
||||
|
515
mysql-schema.sql
515
mysql-schema.sql
@ -1,70 +1,56 @@
|
||||
-- phpMyAdmin SQL Dump
|
||||
-- version 2.11.3deb1ubuntu1.1
|
||||
-- http://www.phpmyadmin.net
|
||||
-- MySQL dump 10.11
|
||||
--
|
||||
-- Host: localhost
|
||||
-- Generation Time: Mar 23, 2009 at 05:29 PM
|
||||
-- Server version: 5.0.51
|
||||
-- PHP Version: 5.2.4-2ubuntu5.5
|
||||
|
||||
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
|
||||
|
||||
--
|
||||
-- Database: `observer`
|
||||
--
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `adjacencies`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `adjacencies` (
|
||||
`adj_id` int(11) NOT NULL auto_increment,
|
||||
`network_id` int(11) NOT NULL default '0',
|
||||
`interface_id` int(11) NOT NULL default '0',
|
||||
PRIMARY KEY (`adj_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
-- Host: localhost Database: observer
|
||||
-- ------------------------------------------------------
|
||||
-- Server version 5.0.67-0ubuntu6-log
|
||||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
||||
/*!40103 SET TIME_ZONE='+00:00' */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
|
||||
--
|
||||
-- Table structure for table `alerts`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `alerts` (
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
CREATE TABLE `alerts` (
|
||||
`id` int(11) NOT NULL,
|
||||
`importance` int(11) NOT NULL default '0',
|
||||
`device_id` int(11) NOT NULL,
|
||||
`message` text NOT NULL,
|
||||
`time_logged` timestamp NOT NULL default CURRENT_TIMESTAMP,
|
||||
`alerted` smallint(6) NOT NULL default '0',
|
||||
KEY `id` (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
);
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
--
|
||||
-- Table structure for table `authlog`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `authlog` (
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
CREATE TABLE `authlog` (
|
||||
`id` int(11) NOT NULL,
|
||||
`datetime` timestamp NOT NULL default CURRENT_TIMESTAMP,
|
||||
`user` text NOT NULL,
|
||||
`address` text NOT NULL,
|
||||
`result` text NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
);
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
--
|
||||
-- Table structure for table `bgpPeers`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `bgpPeers` (
|
||||
`bgpPeer_id` int(11) NOT NULL auto_increment,
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
CREATE TABLE `bgpPeers` (
|
||||
`bgpPeer_id` int(11) NOT NULL,
|
||||
`device_id` int(11) NOT NULL,
|
||||
`astext` varchar(64) NOT NULL,
|
||||
`bgpPeerIdentifier` text NOT NULL,
|
||||
@ -81,31 +67,31 @@ CREATE TABLE IF NOT EXISTS `bgpPeers` (
|
||||
`bgpPeerInUpdateElapsedTime` int(11) NOT NULL,
|
||||
PRIMARY KEY (`bgpPeer_id`),
|
||||
KEY `device_id` (`device_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
);
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
--
|
||||
-- Table structure for table `bills`
|
||||
-- Table structure for table `bgpPeers_cbgp`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `bills` (
|
||||
`bill_id` int(11) NOT NULL auto_increment,
|
||||
`bill_name` text NOT NULL,
|
||||
`bill_type` text NOT NULL,
|
||||
`bill_cdr` int(11) default NULL,
|
||||
`bill_day` int(11) NOT NULL default '1',
|
||||
`bill_gb` int(11) default NULL,
|
||||
UNIQUE KEY `bill_id` (`bill_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
CREATE TABLE `bgpPeers_cbgp` (
|
||||
`device_id` int(11) NOT NULL,
|
||||
`bgpPeerIdentifier` varchar(64) NOT NULL,
|
||||
`afi` varchar(8) NOT NULL,
|
||||
`safi` varchar(8) NOT NULL,
|
||||
KEY `device_id` (`device_id`,`bgpPeerIdentifier`)
|
||||
);
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
--
|
||||
-- Table structure for table `bill_data`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `bill_data` (
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
CREATE TABLE `bill_data` (
|
||||
`bill_id` int(11) NOT NULL,
|
||||
`timestamp` datetime NOT NULL,
|
||||
`period` int(11) NOT NULL,
|
||||
@ -113,54 +99,116 @@ CREATE TABLE IF NOT EXISTS `bill_data` (
|
||||
`in_delta` bigint(11) NOT NULL,
|
||||
`out_delta` bigint(11) NOT NULL,
|
||||
KEY `bill_id` (`bill_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
);
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
--
|
||||
-- Table structure for table `bill_perms`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `bill_perms` (
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
CREATE TABLE `bill_perms` (
|
||||
`user_id` int(11) NOT NULL,
|
||||
`bill_id` int(11) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
);
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
--
|
||||
-- Table structure for table `bill_ports`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `bill_ports` (
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
CREATE TABLE `bill_ports` (
|
||||
`bill_id` int(11) NOT NULL,
|
||||
`port_id` int(11) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
);
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
--
|
||||
-- Table structure for table `bills`
|
||||
--
|
||||
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
CREATE TABLE `bills` (
|
||||
`bill_id` int(11) NOT NULL,
|
||||
`bill_name` text NOT NULL,
|
||||
`bill_type` text NOT NULL,
|
||||
`bill_cdr` int(11) default NULL,
|
||||
`bill_day` int(11) NOT NULL default '1',
|
||||
`bill_gb` int(11) default NULL,
|
||||
UNIQUE KEY `bill_id` (`bill_id`)
|
||||
);
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
--
|
||||
-- Table structure for table `cempMemPool`
|
||||
--
|
||||
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
CREATE TABLE `cempMemPool` (
|
||||
`cempMemPool_id` int(11) NOT NULL,
|
||||
`Index` varchar(8) NOT NULL,
|
||||
`entPhysicalIndex` int(11) NOT NULL,
|
||||
`cempMemPoolType` varchar(32) NOT NULL,
|
||||
`cempMemPoolName` varchar(32) NOT NULL,
|
||||
`cempMemPoolValid` tinyint(4) NOT NULL,
|
||||
`device_id` int(11) NOT NULL,
|
||||
`cempMemPoolUsed` int(11) NOT NULL,
|
||||
`cempMemPoolFree` int(11) NOT NULL,
|
||||
`cempMemPoolLargestFree` int(11) NOT NULL,
|
||||
`cempMemPoolLowestFree` int(11) NOT NULL,
|
||||
PRIMARY KEY (`cempMemPool_id`),
|
||||
KEY `device_id` (`device_id`)
|
||||
);
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
--
|
||||
-- Table structure for table `cpmCPU`
|
||||
--
|
||||
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
CREATE TABLE `cpmCPU` (
|
||||
`cpmCPU_id` int(11) NOT NULL,
|
||||
`entPhysicalIndex` int(11) NOT NULL,
|
||||
`device_id` int(11) NOT NULL,
|
||||
`cpmCPU_oid` int(11) NOT NULL,
|
||||
`cpmCPUTotal5minRev` int(11) NOT NULL,
|
||||
`entPhysicalDescr` varchar(64) NOT NULL,
|
||||
PRIMARY KEY (`cpmCPU_id`),
|
||||
KEY `cpuCPU_id` (`cpmCPU_id`,`device_id`)
|
||||
);
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
--
|
||||
-- Table structure for table `customers`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `customers` (
|
||||
`customer_id` int(11) NOT NULL auto_increment,
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
CREATE TABLE `customers` (
|
||||
`customer_id` int(11) NOT NULL,
|
||||
`username` char(64) NOT NULL,
|
||||
`password` char(32) NOT NULL,
|
||||
`string` char(64) NOT NULL,
|
||||
`level` tinyint(4) NOT NULL default '0',
|
||||
PRIMARY KEY (`customer_id`),
|
||||
UNIQUE KEY `username` (`username`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
);
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
--
|
||||
-- Table structure for table `devices`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `devices` (
|
||||
`device_id` int(11) NOT NULL auto_increment,
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
CREATE TABLE `devices` (
|
||||
`device_id` int(11) NOT NULL,
|
||||
`hostname` varchar(128) NOT NULL,
|
||||
`sysName` varchar(128) default NULL,
|
||||
`community` varchar(32) NOT NULL,
|
||||
@ -177,7 +225,8 @@ CREATE TABLE IF NOT EXISTS `devices` (
|
||||
`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,
|
||||
`lastchange` timestamp NOT NULL default 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',
|
||||
PRIMARY KEY (`device_id`),
|
||||
@ -185,44 +234,47 @@ CREATE TABLE IF NOT EXISTS `devices` (
|
||||
KEY `hostname` (`hostname`),
|
||||
KEY `sysName` (`sysName`),
|
||||
KEY `os` (`os`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
);
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
--
|
||||
-- Table structure for table `devices_attribs`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `devices_attribs` (
|
||||
`attrib_id` int(11) NOT NULL auto_increment,
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
CREATE TABLE `devices_attribs` (
|
||||
`attrib_id` int(11) NOT NULL,
|
||||
`device_id` int(11) NOT NULL,
|
||||
`attrib_type` varchar(32) NOT NULL,
|
||||
`attrib_value` text NOT NULL,
|
||||
`updated` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
|
||||
`updated` timestamp NOT NULL default CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`attrib_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
);
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
--
|
||||
-- Table structure for table `devices_perms`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `devices_perms` (
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
CREATE TABLE `devices_perms` (
|
||||
`user_id` int(11) NOT NULL,
|
||||
`device_id` int(11) NOT NULL,
|
||||
`access_level` int(4) NOT NULL default '0',
|
||||
KEY `user_id` (`user_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
);
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
--
|
||||
-- Table structure for table `entPhysical`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `entPhysical` (
|
||||
`entPhysical_id` int(11) NOT NULL auto_increment,
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
CREATE TABLE `entPhysical` (
|
||||
`entPhysical_id` int(11) NOT NULL,
|
||||
`device_id` int(11) NOT NULL,
|
||||
`entPhysicalIndex` int(11) NOT NULL,
|
||||
`entPhysicalDescr` text NOT NULL,
|
||||
@ -237,15 +289,16 @@ CREATE TABLE IF NOT EXISTS `entPhysical` (
|
||||
`ifIndex` int(11) default NULL,
|
||||
PRIMARY KEY (`entPhysical_id`),
|
||||
KEY `device_id` (`device_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
);
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
--
|
||||
-- Table structure for table `eventlog`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `eventlog` (
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
CREATE TABLE `eventlog` (
|
||||
`id` int(11) NOT NULL default '0',
|
||||
`host` int(11) NOT NULL default '0',
|
||||
`interface` int(11) default NULL,
|
||||
@ -253,16 +306,17 @@ CREATE TABLE IF NOT EXISTS `eventlog` (
|
||||
`message` text NOT NULL,
|
||||
`type` int(11) NOT NULL,
|
||||
KEY `host` (`host`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
);
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
--
|
||||
-- Table structure for table `interfaces`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `interfaces` (
|
||||
`interface_id` int(11) NOT NULL auto_increment,
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
CREATE TABLE `interfaces` (
|
||||
`interface_id` int(11) NOT NULL,
|
||||
`device_id` int(11) NOT NULL default '0',
|
||||
`ifDescr` varchar(128) NOT NULL,
|
||||
`ifIndex` int(11) default '0',
|
||||
@ -275,7 +329,7 @@ CREATE TABLE IF NOT EXISTS `interfaces` (
|
||||
`ifAlias` text,
|
||||
`ifPhysAddress` text,
|
||||
`ifHardType` varchar(64) default NULL,
|
||||
`ifLastChange` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
|
||||
`ifLastChange` timestamp NOT NULL default CURRENT_TIMESTAMP,
|
||||
`ifVlan` varchar(8) NOT NULL default '',
|
||||
`ifTrunk` varchar(8) default '',
|
||||
`ifVrf` int(11) NOT NULL,
|
||||
@ -292,88 +346,90 @@ CREATE TABLE IF NOT EXISTS `interfaces` (
|
||||
KEY `host` (`device_id`),
|
||||
KEY `snmpid` (`ifIndex`),
|
||||
KEY `if_2` (`ifDescr`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
);
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
--
|
||||
-- Table structure for table `interfaces_perms`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `interfaces_perms` (
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
CREATE TABLE `interfaces_perms` (
|
||||
`user_id` int(11) NOT NULL,
|
||||
`interface_id` int(11) NOT NULL,
|
||||
`access_level` int(11) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
);
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
--
|
||||
-- Table structure for table `ip6addr`
|
||||
-- Table structure for table `ipv4_addresses`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `ip6addr` (
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`addr` varchar(128) NOT NULL,
|
||||
`comp_addr` text NOT NULL,
|
||||
`cidr` smallint(6) NOT NULL default '0',
|
||||
`origin` text NOT NULL,
|
||||
`network` varchar(64) NOT NULL default '',
|
||||
`interface_id` int(11) NOT NULL default '0',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `addr` (`addr`,`cidr`,`interface_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
CREATE TABLE `ipv4_addresses` (
|
||||
`ipv4_address_id` int(11) NOT NULL,
|
||||
`ipv4_address` varchar(32) NOT NULL,
|
||||
`ipv4_prefixlen` int(11) NOT NULL,
|
||||
`ipv4_network_id` varchar(32) NOT NULL,
|
||||
`interface_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`ipv4_address_id`)
|
||||
);
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
--
|
||||
-- Table structure for table `ip6adjacencies`
|
||||
-- Table structure for table `ipv4_networks`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `ip6adjacencies` (
|
||||
`adj_id` int(11) NOT NULL auto_increment,
|
||||
`network_id` int(11) NOT NULL default '0',
|
||||
`interface_id` int(11) NOT NULL default '0',
|
||||
PRIMARY KEY (`adj_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
CREATE TABLE `ipv4_networks` (
|
||||
`ipv4_network_id` int(11) NOT NULL,
|
||||
`ipv4_network` varchar(64) NOT NULL,
|
||||
PRIMARY KEY (`ipv4_network_id`)
|
||||
);
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
--
|
||||
-- Table structure for table `ip6networks`
|
||||
-- Table structure for table `ipv6_addresses`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `ip6networks` (
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`cidr` varchar(32) NOT NULL default '',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `cidr` (`cidr`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
CREATE TABLE `ipv6_addresses` (
|
||||
`ipv6_address_id` int(11) NOT NULL,
|
||||
`ipv6_address` varchar(128) NOT NULL,
|
||||
`ipv6_compressed` varchar(128) NOT NULL,
|
||||
`ipv6_prefixlen` int(11) NOT NULL,
|
||||
`ipv6_origin` varchar(16) NOT NULL,
|
||||
`ipv6_network_id` varchar(128) NOT NULL,
|
||||
`interface_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`ipv6_address_id`)
|
||||
);
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
--
|
||||
-- Table structure for table `ipaddr`
|
||||
-- Table structure for table `ipv6_networks`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `ipaddr` (
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`addr` varchar(32) NOT NULL default '',
|
||||
`cidr` smallint(6) NOT NULL default '0',
|
||||
`network` varchar(64) NOT NULL default '',
|
||||
`interface_id` int(11) NOT NULL default '0',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `addr` (`addr`,`cidr`,`interface_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
CREATE TABLE `ipv6_networks` (
|
||||
`ipv6_network_id` int(11) NOT NULL,
|
||||
`ipv6_network` varchar(64) NOT NULL,
|
||||
PRIMARY KEY (`ipv6_network_id`)
|
||||
);
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
--
|
||||
-- Table structure for table `links`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `links` (
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
CREATE TABLE `links` (
|
||||
`id` int(11) NOT NULL,
|
||||
`src_if` int(11) default NULL,
|
||||
`dst_if` int(11) default NULL,
|
||||
`active` tinyint(4) NOT NULL default '1',
|
||||
@ -381,16 +437,17 @@ CREATE TABLE IF NOT EXISTS `links` (
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `src_if` (`src_if`),
|
||||
KEY `dst_if` (`dst_if`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
);
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
--
|
||||
-- Table structure for table `mac_accounting`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mac_accounting` (
|
||||
`ma_id` int(11) NOT NULL auto_increment,
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
CREATE TABLE `mac_accounting` (
|
||||
`ma_id` int(11) NOT NULL,
|
||||
`interface_id` int(11) NOT NULL,
|
||||
`peer_ip` varchar(32) NOT NULL,
|
||||
`peer_desc` varchar(64) NOT NULL,
|
||||
@ -398,74 +455,67 @@ CREATE TABLE IF NOT EXISTS `mac_accounting` (
|
||||
`peer_mac` varchar(32) NOT NULL,
|
||||
`in_oid` varchar(128) NOT NULL,
|
||||
`out_oid` varchar(128) NOT NULL,
|
||||
`bps_out` int(11) NOT NULL,
|
||||
`bps_in` int(11) NOT NULL,
|
||||
PRIMARY KEY (`ma_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `networks`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `networks` (
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`cidr` varchar(32) NOT NULL default '',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `cidr` (`cidr`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
);
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
--
|
||||
-- Table structure for table `port_in_measurements`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `port_in_measurements` (
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
CREATE TABLE `port_in_measurements` (
|
||||
`port_id` int(11) NOT NULL,
|
||||
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
|
||||
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP,
|
||||
`counter` bigint(11) NOT NULL,
|
||||
`delta` bigint(11) NOT NULL,
|
||||
KEY `port_id` (`port_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
);
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
--
|
||||
-- Table structure for table `port_out_measurements`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `port_out_measurements` (
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
CREATE TABLE `port_out_measurements` (
|
||||
`port_id` int(11) NOT NULL,
|
||||
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
|
||||
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP,
|
||||
`counter` bigint(11) NOT NULL,
|
||||
`delta` bigint(11) NOT NULL,
|
||||
KEY `port_id` (`port_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
);
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
--
|
||||
-- Table structure for table `pseudowires`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `pseudowires` (
|
||||
`pseudowire_id` int(11) NOT NULL auto_increment,
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
CREATE TABLE `pseudowires` (
|
||||
`pseudowire_id` int(11) NOT NULL,
|
||||
`interface_id` int(11) NOT NULL,
|
||||
`peer_device_id` int(11) NOT NULL,
|
||||
`peer_ldp_id` int(11) NOT NULL,
|
||||
`cpwVcID` int(11) NOT NULL,
|
||||
`cpwOid` int(11) NOT NULL,
|
||||
PRIMARY KEY (`pseudowire_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
);
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
--
|
||||
-- Table structure for table `services`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `services` (
|
||||
`service_id` int(11) NOT NULL auto_increment,
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
CREATE TABLE `services` (
|
||||
`service_id` int(11) NOT NULL,
|
||||
`service_host` int(11) NOT NULL,
|
||||
`service_ip` text NOT NULL,
|
||||
`service_type` varchar(16) NOT NULL,
|
||||
@ -479,16 +529,17 @@ CREATE TABLE IF NOT EXISTS `services` (
|
||||
`service_disabled` tinyint(1) NOT NULL default '0',
|
||||
PRIMARY KEY (`service_id`),
|
||||
KEY `service_host` (`service_host`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
);
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
--
|
||||
-- Table structure for table `storage`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `storage` (
|
||||
`storage_id` int(11) NOT NULL auto_increment,
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
CREATE TABLE `storage` (
|
||||
`storage_id` int(11) NOT NULL,
|
||||
`host_id` int(11) NOT NULL,
|
||||
`hrStorageIndex` int(11) NOT NULL,
|
||||
`hrStorageDescr` text NOT NULL,
|
||||
@ -497,15 +548,16 @@ CREATE TABLE IF NOT EXISTS `storage` (
|
||||
`hrStorageUsed` int(11) NOT NULL,
|
||||
`storage_perc` text NOT NULL,
|
||||
PRIMARY KEY (`storage_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
);
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
--
|
||||
-- Table structure for table `syslog`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `syslog` (
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
CREATE TABLE `syslog` (
|
||||
`host` varchar(64) NOT NULL,
|
||||
`device_id` int(11) default NULL,
|
||||
`facility` varchar(10) default NULL,
|
||||
@ -515,22 +567,23 @@ CREATE TABLE IF NOT EXISTS `syslog` (
|
||||
`datetime` datetime default NULL,
|
||||
`program` varchar(32) default NULL,
|
||||
`msg` text,
|
||||
`seq` bigint(20) unsigned NOT NULL auto_increment,
|
||||
`seq` bigint(20) unsigned NOT NULL,
|
||||
`processed` tinyint(1) NOT NULL default '0',
|
||||
PRIMARY KEY (`seq`),
|
||||
KEY `datetime` (`datetime`),
|
||||
KEY `device_id` (`device_id`),
|
||||
KEY `processed` (`processed`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
);
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
--
|
||||
-- Table structure for table `temperature`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `temperature` (
|
||||
`temp_id` int(11) NOT NULL auto_increment,
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
CREATE TABLE `temperature` (
|
||||
`temp_id` int(11) NOT NULL,
|
||||
`temp_host` int(11) NOT NULL default '0',
|
||||
`temp_oid` varchar(64) NOT NULL,
|
||||
`temp_descr` varchar(32) NOT NULL default '',
|
||||
@ -539,16 +592,17 @@ CREATE TABLE IF NOT EXISTS `temperature` (
|
||||
`temp_limit` tinyint(4) NOT NULL default '60',
|
||||
PRIMARY KEY (`temp_id`),
|
||||
KEY `temp_host` (`temp_host`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
);
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
--
|
||||
-- Table structure for table `users`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `users` (
|
||||
`user_id` int(11) NOT NULL auto_increment,
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
CREATE TABLE `users` (
|
||||
`user_id` int(11) NOT NULL,
|
||||
`username` char(30) NOT NULL,
|
||||
`password` char(32) NOT NULL,
|
||||
`realname` text NOT NULL,
|
||||
@ -557,47 +611,50 @@ CREATE TABLE IF NOT EXISTS `users` (
|
||||
`level` tinyint(4) NOT NULL default '0',
|
||||
PRIMARY KEY (`user_id`),
|
||||
UNIQUE KEY `username` (`username`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
);
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
--
|
||||
-- Table structure for table `users_prefs`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `users_prefs` (
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
CREATE TABLE `users_prefs` (
|
||||
`user_id` int(16) NOT NULL,
|
||||
`pref` varchar(32) NOT NULL,
|
||||
`value` varchar(128) NOT NULL,
|
||||
PRIMARY KEY (`user_id`),
|
||||
UNIQUE KEY `user_id.pref` (`user_id`,`pref`),
|
||||
KEY `pref` (`pref`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
);
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
--
|
||||
-- Table structure for table `vlans`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `vlans` (
|
||||
`vlan_id` int(11) NOT NULL auto_increment,
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
CREATE TABLE `vlans` (
|
||||
`vlan_id` int(11) NOT NULL,
|
||||
`device_id` int(11) default NULL,
|
||||
`vlan_vlan` int(11) default NULL,
|
||||
`vlan_domain` text,
|
||||
`vlan_descr` text,
|
||||
PRIMARY KEY (`vlan_id`),
|
||||
KEY `device_id` (`device_id`,`vlan_vlan`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
);
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
--
|
||||
-- Table structure for table `vrfs`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `vrfs` (
|
||||
`vrf_id` int(11) NOT NULL auto_increment,
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
CREATE TABLE `vrfs` (
|
||||
`vrf_id` int(11) NOT NULL,
|
||||
`vrf_oid` varchar(64) NOT NULL,
|
||||
`vrf_name` varchar(32) NOT NULL,
|
||||
`mplsVpnVrfRouteDistinguisher` varchar(16) NOT NULL,
|
||||
@ -605,5 +662,13 @@ CREATE TABLE IF NOT EXISTS `vrfs` (
|
||||
`device_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`vrf_id`),
|
||||
KEY `device_id` (`device_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
);
|
||||
SET character_set_client = @saved_cs_client;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2009-04-23 21:06:10
|
||||
|
@ -12,8 +12,15 @@ if($argv[1] == "--device" && $argv[2]) {
|
||||
$where = "AND MOD(device_id,2) = 1";
|
||||
} elseif ($argv[1] == "--even") {
|
||||
$where = "AND MOD(device_id,2) = 0";
|
||||
} elseif ($argv[1] == "--odd3") {
|
||||
$where = "AND MOD(device_id,2) = 1 AND device_id NOT LIKE '%1'";
|
||||
} elseif ($argv[1] == "--even3") {
|
||||
$where = "AND MOD(device_id,2) = 0 AND device_id NOT LIKE '%2'";
|
||||
} elseif ($argv[1] == "--other3") {
|
||||
$where = "AND (device_id LIKE '%1' OR device_id LIKE '%2')";
|
||||
|
||||
} elseif ($argv[1] == "--all") {
|
||||
$where = "";
|
||||
|
||||
} else {
|
||||
echo("--device <device id> Poll single device\n");
|
||||
echo("--all Poll all devices\n\n");
|
||||
@ -56,11 +63,11 @@ while ($device = mysql_fetch_array($device_query)) {
|
||||
} else {
|
||||
$uptimeoid = "1.3.6.1.2.1.1.3.0";
|
||||
}
|
||||
$snmp_cmd = $config['snmpget'] . " -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
|
||||
$snmp_cmd = $config['snmpget'] . " -m SNMPv2-MIB:HOST-RESOURCES-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
|
||||
$snmp_cmd .= " $uptimeoid sysLocation.0 sysContact.0 sysName.0";
|
||||
#$snmp_cmd .= " | grep -v 'Cisco Internetwork Operating System Software'";
|
||||
if($device['os'] == "IOS" || $device['os'] == "IOS XE") {
|
||||
$snmp_cmdb = $config['snmpget'] . " -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
|
||||
$snmp_cmdb = $config['snmpget'] . " -m ENTITY-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
|
||||
$snmp_cmdb .= " .1.3.6.1.2.1.47.1.1.1.1.13.1";
|
||||
$snmp_cmdb .= " | grep -v 'Cisco Internetwork Operating System Software'";
|
||||
$ciscomodel = str_replace("\"", "", trim(`$snmp_cmdb`));
|
||||
@ -71,7 +78,7 @@ while ($device = mysql_fetch_array($device_query)) {
|
||||
$snmpdata = trim($snmpdata);
|
||||
$snmpdata = str_replace("\"", "", $snmpdata);
|
||||
list($sysUptime, $sysLocation, $sysContact, $sysName) = explode("\n", $snmpdata);
|
||||
$sysDescr = trim(shell_exec($config['snmpget'] . " -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " sysDescr.0"));
|
||||
$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);
|
||||
list($days, $hours, $mins, $secs) = explode(":", $sysUptime);
|
||||
|
@ -1,5 +1,6 @@
|
||||
#!/usr/bin/php
|
||||
<?php
|
||||
|
||||
//
|
||||
// Interface Status Poller
|
||||
//
|
||||
@ -9,7 +10,6 @@
|
||||
|
||||
$interface_query = mysql_query("SELECT *, I.interface_id AS sqlid FROM `interfaces` AS I, `devices` AS D where I.device_id = D.device_id AND D.status = '1' AND I.device_id LIKE '%" . $argv[1] . "' ORDER BY I.device_id DESC");
|
||||
|
||||
var_dump($interface_query);
|
||||
while ($interface = mysql_fetch_array($interface_query)) {
|
||||
$hostname = $interface['hostname'];
|
||||
$host = $interface['host'];
|
||||
@ -24,10 +24,12 @@
|
||||
$old_mac = $interface['mac'];
|
||||
$old_up_admin = $interface['up_admin'];
|
||||
$snmpver = $interface['snmpver'];
|
||||
$snmp_cmd = "snmpget -O qv -".$interface['snmpver']." -c ".$interface['community']." ".$interface['hostname'].":".$interface['port']." ifDescr.$ifIndex ifAdminStatus.$ifIndex ifOperStatus.$ifIndex ";
|
||||
$snmp_cmd .= "ifAlias.$ifIndex 1.3.6.1.2.1.10.7.2.1.$ifIndex ifName.$ifIndex";
|
||||
$snmp_cmd = "snmpget -m IF-MIB -O qv -".$interface['snmpver']." -c ".$interface['community']." ".$interface['hostname'].":".$interface['port']." ifDescr.$ifIndex ifAdminStatus.$ifIndex ifOperStatus.$ifIndex ";
|
||||
$snmp_cmd .= "ifAlias.$ifIndex ifName.$ifIndex";
|
||||
$snmp_output = trim(shell_exec($snmp_cmd));
|
||||
list($ifDescr, $ifAdminStatus, $ifOperStatus, $ifAlias, $ifDuplex, $ifName) = explode("\n", $snmp_output);
|
||||
list($ifDescr, $ifAdminStatus, $ifOperStatus, $ifAlias, $ifName) = explode("\n", $snmp_output);
|
||||
|
||||
## DUPLEX IS AT .1.3.6.1.4.1.9.5.1.4.1.1.10 <-- DUPLEX, K? BUT ONLY CATALYFAILS!
|
||||
|
||||
$ifDescr = trim(str_replace("\"", "", $ifDescr));
|
||||
$name = $ifDescr;
|
||||
|
@ -7,9 +7,9 @@
|
||||
$mac_accounting_query = mysql_query("SELECT * FROM `mac_accounting` as A, `interfaces` AS I, `devices` AS D where A.interface_id = I.interface_id AND I.device_id = D.device_id AND D.status = '1'");
|
||||
while ($acc = mysql_fetch_array($mac_accounting_query)) {
|
||||
|
||||
echo("Polling :" . $acc['peer_ip']. " " . $acc['ifDescr']. " " . $acc['hostname'] . "\n");
|
||||
echo("Polling :" . $acc['peer_ip']. " " . $acc['ifDescr']. " " . $acc['hostname'] . " ");
|
||||
|
||||
$snmp_cmd = $config['snmpget'] . " -O Uqnv -" . $acc['snmpver'] . " -c " . $acc['community'] . " " . $acc['hostname'];
|
||||
$snmp_cmd = $config['snmpget'] . " -m CISCO-IP-STAT-MIB -O Uqnv -" . $acc['snmpver'] . " -c " . $acc['community'] . " " . $acc['hostname'];
|
||||
$snmp_cmd .= " " . $acc['in_oid'] . " " . $acc['out_oid'];
|
||||
|
||||
$snmp_output = trim(`$snmp_cmd`);
|
||||
@ -37,5 +37,10 @@
|
||||
$woo = "N:$in:$out";
|
||||
$ret = rrdtool_update("$rrdfile", $woo);
|
||||
|
||||
$rates = interface_rates ($rrdfile);
|
||||
mysql_query("UPDATE `mac_accounting` SET bps_in = '" . $rates['in'] . "', bps_out = '" . $rates['out'] . "' WHERE ma_id= '" . $acc['ma_id'] . "'");
|
||||
|
||||
echo(formatRates($rates['in']) . " in " . formatRates($rates['out']) . " out \n");
|
||||
|
||||
}
|
||||
?>
|
||||
|
@ -23,13 +23,9 @@ while ($device = mysql_fetch_array($device_query)) {
|
||||
$status = trim($status);
|
||||
|
||||
if(strstr($status, "alive")) {
|
||||
$pos = shell_exec($config['snmpget'] . " -$snmpver -c $community -t 1 $hostname:$port sysDescr.0");
|
||||
$pos = shell_exec($config['snmpget'] . " -m SNMPv2-MIB -$snmpver -c $community -t 1 $hostname:$port sysDescr.0");
|
||||
if($pos == '') {
|
||||
$status='0';
|
||||
$posb = shell_exec($config['snmpget'] . " -$snmpver -c $community -t 1 $hostname:$port 1.3.6.1.2.1.7526.2.4");
|
||||
if($posb == '') { } else {
|
||||
$status='1';
|
||||
}
|
||||
} else {
|
||||
$status='1';
|
||||
}
|
||||
|
@ -6,7 +6,8 @@ include("includes/functions.php");
|
||||
|
||||
mysql_query("DELETE FROM `syslog` WHERE `processed` = '0' AND `msg` LIKE '%last message repeated%'");
|
||||
mysql_query("DELETE FROM `syslog` WHERE `processed` = '0' AND `msg` LIKE '%Connection from UDP: [%]:%'");
|
||||
mysql_query("DELETE FROM `syslog` WHERE `processed` = '0' AND `program` LIKE 'Traceback%'");
|
||||
mysql_query("DELETE FROM `syslog` WHERE `processed` = '0' AND `msg` LIKE '%Traceback%'");
|
||||
mysql_query("DELETE FROM `syslog` WHERE `processed` = '0' AND `msg` LIKE '%PM-3-INVALID_BRIDGE_PORT%'");
|
||||
|
||||
|
||||
|
||||
|
@ -20,9 +20,9 @@ while ($interface = mysql_fetch_array($interface_query)) {
|
||||
|
||||
echo("Looking at " . $interface['ifDescr'] . " on " . $device['hostname'] . "\n");
|
||||
|
||||
$snmp_cmd = $config['snmpget'] . " -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " ifName." . $interface['ifIndex'];
|
||||
$snmp_cmd = $config['snmpget'] . " -m IF-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " ifName." . $interface['ifIndex'];
|
||||
$snmp_cmd .= " ifDescr." . $interface['ifIndex'] . " ifAdminStatus." . $interface['ifIndex'] . " ifOperStatus." . $interface['ifIndex'] . " ";
|
||||
$snmp_cmd .= "ifAlias." . $interface['ifIndex'] . " ifSpeed." . $interface['ifIndex'] . " 1.3.6.1.2.1.10.7.2.1." . $interface['ifIndex'];
|
||||
$snmp_cmd .= "ifAlias." . $interface['ifIndex'] . " ifSpeed." . $interface['ifIndex'];
|
||||
$snmp_cmd .= " ifType." . $interface['ifIndex'] . " ifMtu." . $interface['ifIndex'] . " ifPhysAddress." . $interface['ifIndex'];
|
||||
|
||||
$snmp_output = trim(`$snmp_cmd`);
|
||||
@ -32,7 +32,7 @@ while ($interface = mysql_fetch_array($interface_query)) {
|
||||
|
||||
if($device['os'] == "IOS") {
|
||||
|
||||
$snmp_cmdb = $config['snmpget'] . " -m +CISCO-VLAN-MEMBERSHIP-MIB:CISCO-VTP-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
|
||||
$snmp_cmdb = $config['snmpget'] . " -m CISCO-SMI:CISCO-VLAN-MEMBERSHIP-MIB:CISCO-VTP-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
|
||||
$snmp_cmdb .= " .1.3.6.1.4.1.9.2.2.1.1.1." . $interface['ifIndex'];
|
||||
$snmp_cmdb .= " .1.3.6.1.4.1.9.9.68.1.2.2.1.2." . $interface['ifIndex'];
|
||||
$snmp_cmdb .= " .1.3.6.1.4.1.9.9.46.1.6.1.1.16." . $interface['ifIndex'];
|
||||
@ -55,7 +55,7 @@ while ($interface = mysql_fetch_array($interface_query)) {
|
||||
|
||||
if ( $interface['ifVlan'] != $this['ifVlan']) {
|
||||
$update .= $seperator . "`ifVlan` = '" . $this['ifVlan'] . "'";
|
||||
echo($update);
|
||||
#echo($update);
|
||||
$seperator = ", ";
|
||||
mysql_query("INSERT INTO eventlog (`host`, `interface`, `datetime`, `message`) VALUES ('" . $interface['device_id'] . "', '" . $interface['interface_id'] . "', NOW(), 'VLAN Vlan -> " . $this['ifVlan'] . "')");
|
||||
}
|
||||
@ -65,7 +65,7 @@ while ($interface = mysql_fetch_array($interface_query)) {
|
||||
|
||||
}
|
||||
|
||||
list($ifName, $ifDescr, $ifAdminStatus, $ifOperStatus, $ifAlias, $ifSpeed, $ifDuplex, $ifType, $ifMtu, $ifPhysAddress) = explode("\n", $snmp_output);
|
||||
list($ifName, $ifDescr, $ifAdminStatus, $ifOperStatus, $ifAlias, $ifSpeed, $ifType, $ifMtu, $ifPhysAddress) = explode("\n", $snmp_output);
|
||||
$ifDescr = trim(str_replace("\"", "", $ifDescr));
|
||||
if ($ifDuplex == 3) { $ifDuplex = "half"; } elseif ($ifDuplex == 2) { $ifDuplex = "full"; } else { $ifDuplex = "unknown"; }
|
||||
$ifDescr = strtolower($ifDescr);
|
||||
@ -73,7 +73,7 @@ while ($interface = mysql_fetch_array($interface_query)) {
|
||||
$ifAlias = trim(str_replace("\"", "", $ifAlias));
|
||||
$ifAlias = trim($ifAlias);
|
||||
|
||||
echo("\n$ifName\n");
|
||||
#echo("\n$ifName\n");
|
||||
$ifDescr = fixifname($ifDescr);
|
||||
|
||||
$ifPhysAddress = strtolower(str_replace("\"", "", $ifPhysAddress));
|
||||
|
Loading…
Reference in New Issue
Block a user