mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Updates
git-svn-id: http://www.observium.org/svn/observer/trunk@125 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
1
cron.sh
1
cron.sh
@@ -11,3 +11,4 @@ wget -O /var/sites/network.vostron.net/rrd/dill.vostron.net-mail_virus.rrd http:
|
||||
wget -O /var/sites/network.vostron.net/rrd/dill.vostron.net-mail.rrd http://dill.vostron.net/rrd/mailgraph.rrd
|
||||
wget -O /var/sites/network.vostron.net/rrd/dill.vostron.net-courier.rrd http://dill.vostron.net/rrd/couriergraph.rrd
|
||||
|
||||
./poll-billing.php
|
||||
|
@@ -10,3 +10,6 @@ RewriteCond %{REQUEST_URI} !^(.*)\.png$
|
||||
|
||||
RewriteRule ^([a-z]+)$ ?page=$1
|
||||
|
||||
RewriteRule ^bills/([0-9]+) ?page=bills&bill=$1
|
||||
RewriteRule ^device/([0-9]+) ?page=device&id=$1
|
||||
|
||||
|
@@ -13,13 +13,16 @@ A.green:visited, A.green, .green {color: #008C00;}
|
||||
A.blue:visited, A.blue, .blue {color: #0000ff;}
|
||||
A.orange:visited, a.orange, .orange {color: #FF7400;}
|
||||
|
||||
|
||||
.pinkbg { background-color: #ffbbbb; }
|
||||
.redbg { background-color: #ff8585; }
|
||||
.bluebg { background-color: #aaaaff; }
|
||||
.greenbg { background-color: #aaffaa; }
|
||||
.greybg { background-color: #dddddd; }
|
||||
|
||||
.selector {
|
||||
width:275px;
|
||||
}
|
||||
|
||||
.page-h2 {
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
|
@@ -10,6 +10,11 @@
|
||||
include("../includes/functions.php");
|
||||
include("includes/authenticate.inc");
|
||||
|
||||
if($_GET['params']) {
|
||||
list($_GET['host'], $_GET['if'], $_GET['from'], $_GET['to'], $_GET['width'], $_GET['height'], $_GET['title'], $_GET['vertical'], $_GET['type'], $_GET['interfaces']) = explode("||", mcrypt_ecb(MCRYPT_DES, $key_value, $_GET['params'], MCRYPT_DECRYPT));
|
||||
}
|
||||
|
||||
|
||||
if($_GET['host']) {
|
||||
$device_id = $_GET['host'];
|
||||
} elseif($_GET['device']) {
|
||||
@@ -28,7 +33,6 @@
|
||||
$height = $_GET['height'];
|
||||
$title = $_GET['title'];
|
||||
$vertical = $_GET['vertical'];
|
||||
|
||||
$type = $_GET['type'];
|
||||
|
||||
$graphfile = strgen() . ".png";
|
||||
|
@@ -108,6 +108,9 @@ if($_SESSION['userlevel'] >= '10') {
|
||||
if($_SESSION['userlevel'] >= '5') {
|
||||
echo("<li><hr width=140 /></li>");
|
||||
if($show_if_customers) { echo("<li><a href='?page=customers'><img src='/images/16/group_link.png' border=0 align=absmiddle> Customers</a></li>"); $ifbreak = 1;}
|
||||
|
||||
if($show_if_bills) { echo("<li><a href='?page=bills'><img src='/images/16/money_pound.png' border=0 align=absmiddle> Traffic Bills</a></li>"); $ifbreak = 1;}
|
||||
|
||||
if($show_if_l2tp) { echo("<li><a href='?page=iftype&type=l2tp'><img src='/images/16/user.png'border=0 align=absmiddle> L2TP</a></li>"); $ifbreak = 1; }
|
||||
|
||||
if($show_if_transit) { echo("<li><a href='?page=iftype&type=transit'><img src='/images/16/world_link.png' border=0 align=absmiddle> Transit</a></li>"); $ifbreak = 1; }
|
||||
|
@@ -28,6 +28,7 @@ if($_GET[debug]) {
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
||||
<head>
|
||||
<title><?php echo("$page_title"); ?></title>
|
||||
<base href="<?php echo("$base_url"); ?>" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<!-- <meta http-equiv="refresh" content="300"> -->
|
||||
<link href="<?php echo($stylesheet); ?>" rel="stylesheet" type="text/css">
|
||||
|
@@ -23,7 +23,7 @@ while($device = mysql_fetch_array($sql)){
|
||||
}
|
||||
|
||||
|
||||
$sql = mysql_query("SELECT * FROM `devices` WHERE `status` = '0'");
|
||||
$sql = mysql_query("SELECT * FROM `devices` WHERE `status` = '0' AND `ignore` = '0'");
|
||||
while($device = mysql_fetch_array($sql)){
|
||||
unset($already);
|
||||
$i = 0;
|
||||
@@ -37,7 +37,7 @@ while($device = mysql_fetch_array($sql)){
|
||||
if(!$already) { $nodes[] = $device['device_id']; }
|
||||
}
|
||||
|
||||
$sql = mysql_query("SELECT * FROM `interfaces` AS I, `devices` AS D WHERE I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up'");
|
||||
$sql = mysql_query("SELECT * FROM `interfaces` AS I, `devices` AS D WHERE I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0'");
|
||||
while($device = mysql_fetch_array($sql)){
|
||||
unset($already);
|
||||
$i = 0;
|
||||
@@ -51,7 +51,7 @@ while($device = mysql_fetch_array($sql)){
|
||||
if(!$already) { $nodes[] = $device['device_id']; }
|
||||
}
|
||||
|
||||
$sql = mysql_query("SELECT D.device_id FROM `services` AS S, `devices` AS D WHERE S.service_host = D.device_id AND service_status = 'down'");
|
||||
$sql = mysql_query("SELECT D.device_id FROM `services` AS S, `devices` AS D WHERE S.service_host = D.device_id AND service_status = 'down' AND D.ignore = '0' AND S.service_ignore = '0'");
|
||||
while($device = mysql_fetch_array($sql)){
|
||||
unset($already);
|
||||
$i = 0;
|
||||
|
@@ -34,7 +34,7 @@ echo("<table cellpadding=0 cellspacing=0><tr><td>
|
||||
<table width='200' border='0'>
|
||||
<tr>
|
||||
<td width='300'><div align='right'>Description</div></td>
|
||||
<td colspan='3'><textarea name='descr' cols='50'>$descr</textarea></td>
|
||||
<td colspan='3'><input name='descr' width='50'>$descr</textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
|
@@ -6,7 +6,7 @@
|
||||
<tr>
|
||||
<td><div align='right'><img src='/images/password.png' width='128' height='128'></div></td>
|
||||
<td>
|
||||
<form action='index.php' method=post>
|
||||
<form action='". $_SERVER['REQUEST_URI'] ."' method=post>
|
||||
<h3>Please log in:</h3>
|
||||
|
||||
<div style='height: 0px;'></div>
|
||||
|
@@ -8,6 +8,8 @@ include("procurve.php");
|
||||
include("snom.php");
|
||||
include("graphing.php");
|
||||
include("print-functions.php");
|
||||
include("billing-functions.php");
|
||||
|
||||
|
||||
function strgen ($length = 8)
|
||||
{
|
||||
@@ -27,13 +29,34 @@ function strgen ($length = 8)
|
||||
return $string;
|
||||
}
|
||||
|
||||
function interfacepermitted($interface_id) {
|
||||
function billpermitted($bill_id) {
|
||||
|
||||
return devicepermitted(mysql_result(mysql_query("SELECT device_id FROM interface WHERE interface_id = '$interface_id'"),0));
|
||||
global $_SESSION;
|
||||
if($_SESSION['userlevel'] >= "5") {
|
||||
$allowed = TRUE;
|
||||
} elseif (@mysql_result(mysql_query("SELECT count(*) FROM bill_perms WHERE `user_id` = '" . $_SESSION['user_id'] . "' AND `bill_id` = $bill_id"), 0) > '0') {
|
||||
$allowed = TRUE;
|
||||
} else {
|
||||
$allowed = FALSE;
|
||||
}
|
||||
return $allowed;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function interfacepermitted($interface_id) {
|
||||
|
||||
global $_SESSION;
|
||||
if($_SESSION['userlevel'] >= "5") {
|
||||
$allowed = true;
|
||||
} elseif ( devicepermitted(mysql_result(mysql_query("SELECT device_id FROM interface WHERE interface_id = '$interface_id'"),0))) {
|
||||
$allowed = true;
|
||||
} elseif ( @mysql_result(mysql_query("SELECT count(*) FROM interface_perms WHERE `user_id` = '" . $_SESSION['user_id'] . "' AND `interface_id` = $interface_id"), 0) > '0') {
|
||||
$allowed = true;
|
||||
} else { $allowed = FALSE; }
|
||||
return $allowed;
|
||||
}
|
||||
|
||||
function devicepermitted($device_id) {
|
||||
global $_SESSION;
|
||||
if($_SESSION['userlevel'] >= "5") { $allowed = true;
|
||||
@@ -287,9 +310,11 @@ function humanspeed($speed) {
|
||||
$speed = preg_replace("/^0$/", "-", $speed);
|
||||
$speed = preg_replace("/^9000$/", "9Kbps", $speed);
|
||||
$speed = preg_replace("/^48000$/", "48Kbps", $speed);
|
||||
$speed = preg_replace("/^56000$/", "56Kbps", $speed);
|
||||
$speed = preg_replace("/^64000$/", "64Kbps", $speed);
|
||||
$speed = preg_replace("/^128000$/", "128Kbps", $speed);
|
||||
$speed = preg_replace("/^256000$/", "256Kbps", $speed);
|
||||
$speed = preg_replace("/^448000$/", "448Kbps", $speed);
|
||||
$speed = preg_replace("/^512000$/", "512Kbps", $speed);
|
||||
$speed = preg_replace("/^768000$/", "768Kbps", $speed);
|
||||
$speed = preg_replace("/^1024000$/", "1Mbps", $speed);
|
||||
@@ -297,6 +322,8 @@ function humanspeed($speed) {
|
||||
$speed = preg_replace("/^4192000$/", "4Mbps", $speed);
|
||||
$speed = preg_replace("/^10000000$/", "10Mbps", $speed);
|
||||
$speed = preg_replace("/^34000000$/", "34Mbps", $speed);
|
||||
$speed = preg_replace("/^45000000$/", "45Mbps", $speed);
|
||||
$speed = preg_replace("/^54000000$/", "54Mbps", $speed);
|
||||
$speed = preg_replace("/^100000000$/", "100Mbps", $speed);
|
||||
$speed = preg_replace("/^155000000$/", "155Mbps", $speed);
|
||||
$speed = preg_replace("/^622000000$/", "622Mbps", $speed);
|
||||
@@ -428,6 +455,7 @@ function fixifName ($inf) {
|
||||
$inf = str_replace("gig", "Gig", $inf);
|
||||
$inf = str_replace("fast", "Fast", $inf);
|
||||
$inf = str_replace("ten", "Ten", $inf);
|
||||
$inf = str_replace("bvi", "BVI", $inf);
|
||||
$inf = str_replace("vlan", "Vlan", $inf);
|
||||
$inf = str_replace("ether", "Ether", $inf);
|
||||
$inf = str_replace("-802.1q Vlan subif", "", $inf);
|
||||
@@ -446,6 +474,8 @@ function fixifName ($inf) {
|
||||
|
||||
|
||||
function fixIOSFeatures($features){
|
||||
$features = str_replace("LANBASEK9", "Lan Base Crypto", $features);
|
||||
$features = str_replace("LANBASE", "Lan Base", $features);
|
||||
$features = str_replace("ADVSECURITYK9", "Advanced Security Crypto", $features);
|
||||
$features = str_replace("K91P", "Provider Crypto", $features);
|
||||
$features = str_replace("K4P", "Provider Crypto", $features);
|
||||
@@ -483,6 +513,7 @@ function fixIOSHardware($hardware){
|
||||
$hardware = str_replace("C3550", "Cisco Catalyst 3550", $hardware);
|
||||
$hardware = str_replace("C2950", "Cisco Catalyst 2950", $hardware);
|
||||
$hardware = str_replace("C7301", "Cisco 7301", $hardware);
|
||||
$hardware = str_replace("CE500", "Catalyst Express 500", $hardware);
|
||||
return $hardware;
|
||||
|
||||
}
|
||||
|
@@ -58,14 +58,27 @@ $oid_ssCpuRawUser = ".1.3.6.1.4.1.2021.11.50.0";
|
||||
$oid_ssCpuRawNice = ".1.3.6.1.4.1.2021.11.51.0";
|
||||
$oid_ssCpuRawSystem = ".1.3.6.1.4.1.2021.11.52.0";
|
||||
$oid_ssCpuRawIdle = ".1.3.6.1.4.1.2021.11.53.0";
|
||||
|
||||
$oid_hrSystemProcesses = ".1.3.6.1.2.1.25.1.6.0";
|
||||
$oid_hrSystemNumUsers = ".1.3.6.1.2.1.25.1.5.0";
|
||||
|
||||
$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'];
|
||||
$cpu_cmd .= " $oid_ssCpuRawUser $oid_ssCpuRawSystem $oid_ssCpuRawNice $oid_ssCpuRawIdle $oid_hrSystemProcesses";
|
||||
$cpu_cmd .= " $oid_hrSystemNumUsers .1.3.6.1.4.1.2021.1.101.1";
|
||||
$cpu_cmd .= " $oid_hrSystemNumUsers $oid_ssCpuUser $oid_ssCpuSystem .1.3.6.1.4.1.2021.1.101.1";
|
||||
$cpu = `$cpu_cmd`;
|
||||
list ($cpuUser, $cpuSystem, $cpuNice, $cpuIdle, $procs, $users, $cputemp) = explode("\n", $cpu);
|
||||
list ($cpuUser, $cpuSystem, $cpuNice, $cpuIdle, $procs, $users, $UsageUser, $UsageSystem, $cputemp) = explode("\n", $cpu);
|
||||
|
||||
$cpuUsage = $usageUser + $usageSystem;
|
||||
|
||||
$update_usage = mysql_query("UPDATE devices_attribs SET attrib_value = '$cpuUsage' WHERE `device_id` = '" . $device['device_id'] . "' AND `attrib_type` = 'cpuusage'");
|
||||
|
||||
if(mysql_affected_rows() == '0') {
|
||||
$insert_usage = mysql_query("INSERT INTO devices_attribs (`device_id`, `attrib_type`, `attrib_value`) VALUES ('" . $device['device_id'] . "', 'cpuusage', '$cpuUsage')");
|
||||
}
|
||||
|
||||
## Create CPU RRD if it doesn't already exist
|
||||
if (!is_file($cpurrd)) {
|
||||
|
Reference in New Issue
Block a user