mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-12 16:06:25 +02:00
graphing improvements
git-svn-id: http://www.observium.org/svn/observer/trunk@427 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
+1
-1
@@ -52,7 +52,7 @@ $config['mono_font'] = $config['install_dir'] . "/fonts/DejaVuSansMono.ttf";
|
||||
$config['favicon'] = "favicon.ico";
|
||||
$config['header_color'] = "#1F334E";
|
||||
|
||||
$config['page_refresh'] = "30"; ## Refresh the page every xx seconds
|
||||
$config['page_refresh'] = "0"; ## Refresh the page every xx seconds
|
||||
$config['front_page'] = "pages/front/default.php";
|
||||
|
||||
$config['email_default'] = "you@yourdomain";
|
||||
|
||||
+3
-1
@@ -9,8 +9,10 @@ if($_GET['debug']) {
|
||||
}
|
||||
|
||||
include("../config.php");
|
||||
include("../includes/functions.php");
|
||||
include("../includes/common.php");
|
||||
include("../includes/graphing.php");
|
||||
include("includes/authenticate.inc");
|
||||
|
||||
if(!$_SESSION['authenticated']) { echo("not authenticated"); exit; }
|
||||
|
||||
if($_GET['params']) {
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
<?
|
||||
|
||||
## Common Functions
|
||||
|
||||
function gethostbyid($id) {
|
||||
$sql = mysql_query("SELECT `hostname` FROM `devices` WHERE `device_id` = '$id'");
|
||||
$result = @mysql_result($sql, 0);
|
||||
return $result;
|
||||
}
|
||||
|
||||
function strgen ($length = 16)
|
||||
{
|
||||
$entropy = array(0,1,2,3,4,5,6,7,8,9,'a','A','b','B','c','C','d','D','e',
|
||||
'E','f','F','g','G','h','H','i','I','j','J','k','K','l','L','m','M','n',
|
||||
'N','o','O','p','P','q','Q','r','R','s','S','t','T','u','U','v','V','w',
|
||||
'W','x','X','y','Y','z','Z');
|
||||
$string = "";
|
||||
for ($i=0; $i<$length; $i++) {
|
||||
$key = mt_rand(0,61);
|
||||
$string .= $entropy[$key];
|
||||
}
|
||||
return $string;
|
||||
}
|
||||
|
||||
function getpeerhost($id) {
|
||||
$sql = mysql_query("SELECT `device_id` from `bgpPeers` WHERE `bgpPeer_id` = '$id'");
|
||||
$result = @mysql_result($sql, 0);
|
||||
return $result;
|
||||
}
|
||||
|
||||
function getifindexbyid($id) {
|
||||
$sql = mysql_query("SELECT `ifIndex` FROM `interfaces` WHERE `interface_id` = '$id'");
|
||||
$result = @mysql_result($sql, 0);
|
||||
return $result;
|
||||
}
|
||||
|
||||
function getifbyid($id) {
|
||||
$sql = mysql_query("SELECT `ifDescr` FROM `interfaces` WHERE `interface_id` = '$id'");
|
||||
$result = @mysql_result($sql, 0);
|
||||
return $result;
|
||||
}
|
||||
|
||||
function getidbyname($domain){
|
||||
$sql = mysql_query("SELECT `device_id` FROM `devices` WHERE `hostname` = '$domain'");
|
||||
$result = @mysql_result($sql, 0);
|
||||
return $result;
|
||||
}
|
||||
|
||||
function gethostosbyid($id) {
|
||||
$sql = mysql_query("SELECT `os` FROM `devices` WHERE `device_id` = '$id'");
|
||||
$result = @mysql_result($sql, 0);
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
+2
-81
@@ -7,6 +7,8 @@ include_once("Net/IPv6.php");
|
||||
|
||||
## Observer Includes
|
||||
|
||||
include_once($config['install_dir'] . "/includes/common.php");
|
||||
|
||||
include_once($config['install_dir'] . "/includes/generic.php");
|
||||
include_once($config['install_dir'] . "/includes/procurve.php");
|
||||
include_once($config['install_dir'] . "/includes/graphing.php");
|
||||
@@ -22,36 +24,6 @@ require('collectd/config.php');
|
||||
require('collectd/functions.php');
|
||||
require('collectd/definitions.php');
|
||||
|
||||
function entPhysical_scale($value, $scale) {
|
||||
|
||||
switch ($scale) {
|
||||
case "nano":
|
||||
$value = $value / 1000000000;
|
||||
break;
|
||||
case "micro":
|
||||
$value = $value / 1000000;
|
||||
break;
|
||||
case "milli":
|
||||
$value = $value / 1000;
|
||||
break;
|
||||
case "units":
|
||||
break;
|
||||
case "kilo":
|
||||
$value = $value * 1000;
|
||||
break;
|
||||
case "mega":
|
||||
$value = $value * 1000000;
|
||||
break;
|
||||
case "giga":
|
||||
$value = $value * 1000000000;
|
||||
break;
|
||||
}
|
||||
|
||||
return $value;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function mac_clean_to_readable($mac){
|
||||
|
||||
$r = substr($mac, 0, 2);
|
||||
@@ -143,21 +115,6 @@ function getHostOS($hostname, $community, $snmpver, $port) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
function strgen ($length = 16)
|
||||
{
|
||||
$entropy = array(0,1,2,3,4,5,6,7,8,9,'a','A','b','B','c','C','d','D','e',
|
||||
'E','f','F','g','G','h','H','i','I','j','J','k','K','l','L','m','M','n',
|
||||
'N','o','O','p','P','q','Q','r','R','s','S','t','T','u','U','v','V','w',
|
||||
'W','x','X','y','Y','z','Z');
|
||||
$string = "";
|
||||
for ($i=0; $i<$length; $i++) {
|
||||
$key = mt_rand(0,61);
|
||||
$string .= $entropy[$key];
|
||||
}
|
||||
return $string;
|
||||
}
|
||||
|
||||
function billpermitted($bill_id)
|
||||
{
|
||||
global $_SESSION;
|
||||
@@ -677,48 +634,12 @@ function hoststatus($id) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
function gethostbyid($id) {
|
||||
$sql = mysql_query("SELECT `hostname` FROM `devices` WHERE `device_id` = '$id'");
|
||||
$result = @mysql_result($sql, 0);
|
||||
return $result;
|
||||
}
|
||||
|
||||
function getifhost($id) {
|
||||
$sql = mysql_query("SELECT `device_id` from `interfaces` WHERE `interface_id` = '$id'");
|
||||
$result = @mysql_result($sql, 0);
|
||||
return $result;
|
||||
}
|
||||
|
||||
function getpeerhost($id) {
|
||||
$sql = mysql_query("SELECT `device_id` from `bgpPeers` WHERE `bgpPeer_id` = '$id'");
|
||||
$result = @mysql_result($sql, 0);
|
||||
return $result;
|
||||
}
|
||||
|
||||
function getifindexbyid($id) {
|
||||
$sql = mysql_query("SELECT `ifIndex` FROM `interfaces` WHERE `interface_id` = '$id'");
|
||||
$result = @mysql_result($sql, 0);
|
||||
return $result;
|
||||
}
|
||||
|
||||
function getifbyid($id) {
|
||||
$sql = mysql_query("SELECT `ifDescr` FROM `interfaces` WHERE `interface_id` = '$id'");
|
||||
$result = @mysql_result($sql, 0);
|
||||
return $result;
|
||||
}
|
||||
|
||||
function getidbyname($domain){
|
||||
$sql = mysql_query("SELECT `device_id` FROM `devices` WHERE `hostname` = '$domain'");
|
||||
$result = @mysql_result($sql, 0);
|
||||
return $result;
|
||||
}
|
||||
|
||||
function gethostosbyid($id) {
|
||||
$sql = mysql_query("SELECT `os` FROM `devices` WHERE `device_id` = '$id'");
|
||||
$result = @mysql_result($sql, 0);
|
||||
return $result;
|
||||
}
|
||||
|
||||
function match_network ($nets, $ip, $first=false) {
|
||||
$return = false;
|
||||
if (!is_array ($nets)) $nets = array ($nets);
|
||||
|
||||
+46
-11
@@ -1,7 +1,44 @@
|
||||
<?php
|
||||
|
||||
$rewrite_entSensorType = array (
|
||||
'celsius' => 'C',
|
||||
'unknown' => '',
|
||||
'specialEnum' => 'C',
|
||||
'watts' => 'W',
|
||||
'truthvalue' => '',
|
||||
);
|
||||
|
||||
$translate_ifOperStatus = array(
|
||||
|
||||
function entPhysical_scale($value, $scale) {
|
||||
|
||||
switch ($scale) {
|
||||
case "nano":
|
||||
$value = $value / 1000000000;
|
||||
break;
|
||||
case "micro":
|
||||
$value = $value / 1000000;
|
||||
break;
|
||||
case "milli":
|
||||
$value = $value / 1000;
|
||||
break;
|
||||
case "units":
|
||||
break;
|
||||
case "kilo":
|
||||
$value = $value * 1000;
|
||||
break;
|
||||
case "mega":
|
||||
$value = $value * 1000000;
|
||||
break;
|
||||
case "giga":
|
||||
$value = $value * 1000000000;
|
||||
break;
|
||||
}
|
||||
|
||||
return $value;
|
||||
|
||||
}
|
||||
|
||||
$translate_ifOperStatus = array(
|
||||
"1" => "up",
|
||||
"2" => "down",
|
||||
"3" => "testing",
|
||||
@@ -9,33 +46,31 @@
|
||||
"5" => "dormant",
|
||||
"6" => "notPresent",
|
||||
"7" => "lowerLayerDown",
|
||||
);
|
||||
);
|
||||
|
||||
function translate_ifOperStatus ($ifOperStatus) {
|
||||
function translate_ifOperStatus ($ifOperStatus) {
|
||||
global $translate_ifOperStatus;
|
||||
if($translate_ifOperStatus['$ifOperStatus']) {
|
||||
$ifOperStatus = $translate_ifOperStatus['$ifOperStatus'];
|
||||
}
|
||||
return $ifOperStatus;
|
||||
}
|
||||
}
|
||||
|
||||
$translate_ifAdminStatus = array(
|
||||
$translate_ifAdminStatus = array(
|
||||
"1" => "up",
|
||||
"2" => "down",
|
||||
"3" => "testing",
|
||||
);
|
||||
);
|
||||
|
||||
function translate_ifAdminStatus ($ifAdminStatus) {
|
||||
function translate_ifAdminStatus ($ifAdminStatus) {
|
||||
global $translate_ifAdminStatus;
|
||||
if($translate_ifAdminStatus['$ifAdminStatus']) {
|
||||
$ifAdminStatus = $translate_ifAdminStatus['$ifAdminStatus'];
|
||||
}
|
||||
return $ifAdminStatus;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$rewrite_ios_features = array(
|
||||
$rewrite_ios_features = array(
|
||||
"PK9S" => "IP w/SSH LAN Only",
|
||||
"LANBASEK9" => "Lan Base Crypto",
|
||||
"LANBASE" => "Lan Base",
|
||||
|
||||
+2
-1
@@ -2,7 +2,8 @@
|
||||
<?php
|
||||
|
||||
include("config.php");
|
||||
include("includes/functions.php");
|
||||
|
||||
include("includes/syslog.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: [%]:%'");
|
||||
|
||||
Reference in New Issue
Block a user