Rebased SQL file

This commit is contained in:
laf
2015-11-18 23:55:00 +00:00
47 changed files with 551 additions and 86 deletions
+2
View File
@@ -69,4 +69,6 @@ Contributors to LibreNMS:
- Rob Gormley <robert@gormley.me> (rgormley)
- Richard Kojedzinszky <krichy@nmdps.net> (rkojedzinszky)
- Tony Murray <murraytony@gmail.com> (murrant)
- Peter Lamperud <peter.lamperud@gmail.com> (vizay)
- Louis Bailleul <louis.bailleul@gmail.com> (alucardfh)
[1]: http://observium.org/ "Observium web site"
+1 -1
View File
@@ -18,7 +18,7 @@ This will determine the default config option for `$config['alert']['tolerance_w
If the sub-section you want to add the new config option already exists then update the relevant file within
`html/pages/settings/` otherwise you will need to create the new sub-section page. Here's an example of this:
[Commit example](https://github.com/librenm/librenms/commit/c5998f9ee27acdac0c0f7d3092fc830c51ff684c)
[Commit example](https://github.com/librenms/librenms/commit/c5998f9ee27acdac0c0f7d3092fc830c51ff684c)
```php
<?php
+2 -2
View File
@@ -108,7 +108,7 @@ Config option: `active_directory`
This is similar to LDAP Authentication. Install __php_ldap__ for CentOS/RHEL or __php5-ldap__ for Debian/Ubuntu.
If you have issues with secure LDAP try setting `$config['auth_ad_dont_check_certificates']` to `1`.
If you have issues with secure LDAP try setting `$config['auth_ad_check_certificates']` to `0`.
##### Require actual membership of the configured groups
@@ -118,7 +118,7 @@ If you set ```$config['auth_ad_require_groupmembership']``` to 1, the authentica
```
$config['auth_ad_url'] = "ldaps://your-domain.controll.er";
$config['auth_ad_dont_check_certificates'] = 1; // or 0
$config['auth_ad_check_certificates'] = 1; // or 0
$config['auth_ad_domain'] = "your-domain.com";
$config['auth_ad_base_dn'] = "dc=your-domain,dc=com";
$config['auth_ad_groups']['admin']['level'] = 10;
@@ -99,7 +99,8 @@ Note if not using HTTPd (Apache): RHEL requires `httpd` to be installed regardle
**CentOS 7**
```bash
yum install php php-cli php-gd php-mysql php-snmp php-pear php-curl httpd net-snmp graphviz graphviz-php mariadb ImageMagick jwhois nmap mtr rrdtool MySQL-python net-snmp-utils vixie-cron php-mcrypt fping git
yum install epel-release
yum install php php-cli php-gd php-mysql php-snmp php-pear php-curl httpd net-snmp graphviz graphviz-php mariadb ImageMagick jwhois nmap mtr rrdtool MySQL-python net-snmp-utils cronie php-mcrypt fping git
pear install Net_IPv4-1.3.4
pear install Net_IPv6-1.2.2b2
```
+109
View File
@@ -0,0 +1,109 @@
Here's a bref list of supported vendors, some might be missing.
If you are unsure of whether your device is supported or not, feel free to ask us.
### Vendors
3Com
Aerohive
AKCP
Alcatel-Lucent
Allied Telesis
APC
Apple
Areca
Arista
Aruba
Avaya
Avocent
Axis
Barracuda
BCM963
BNT
Brocade
Brother
Canopy
Cisco
CiscoSB
Citrix
Cometsystem
Comware
D-Link
Datacom
Dell
Delta Power Solutions
Eaton
Engenius
Enterasys
Epson
Extreme Networks
F5
FiberHome
Force10
Fortigate
FreeBSD
Gamatronic
Hikvision
HP
Huawei
IBM
iPoMan
ITWatchDogs
Juniper
Konica Minolta
Kyocera
Liebert
Linux
Mellanox
Meraki
MGE
Mikrotic
MRVLD
Multimatic
NetApp
NetBSD
Netgear
NetMan
Netonix
Netopia
NetVision
NetWare
NRG
OKI
OpenBSD
PacketShaper
Palo Alto Networks
Papouch
PBN
Perle
Powercode
Prestige
Proxim
Proxmox
Radlan
Raritan
Redback
Ricoh
Riverbed
Ruckus
SAF
Siklu
Sentry3
Solaris
SonicWALL
SpeedTouch
Supermicro
Symbol
TPLink
Tranzeo
Triplite
Ubiquiti
VMware
VRP
Vyatta
VyOS
Watchguard
WebPower
Windows
Xerox
ZTE
Zyxel
@@ -3,8 +3,8 @@
// easier to rewrite for Active Directory than to bash it into existing LDAP implementation
// disable certificate checking before connect if required
if (isset($config['auth_ad_dont_check_certificates']) &&
$config['auth_ad_dont_check_certificates'] > 0) {
if (isset($config['auth_ad_check_certificates']) &&
$config['auth_ad_check_certificates'] == 0) {
putenv('LDAPTLS_REQCERT=never');
};
@@ -35,6 +35,7 @@ function authenticate($username, $password) {
if (isset($config['auth_ad_groups'][$group_cn]['level'])) {
// user is in one of the defined groups
$user_authenticated = 1;
adduser($username);
}
}
@@ -43,6 +44,7 @@ function authenticate($username, $password) {
}
else {
// group membership is not required and user is valid
adduser($username);
return 1;
}
}
@@ -81,11 +83,20 @@ function auth_usermanagement() {
}
function adduser() {
// not supported so return 0
return 0;
function adduser($username) {
// Check to see if user is already added in the database
if (!user_exists_in_db($username)) {
return dbInsert(array('username' => $username, 'user_id' => get_userid($username), 'level' => "0", 'can_modify_passwd' => 0, 'twofactor' => 0), 'users');
}
else {
return false;
}
}
function user_exists_in_db($username) {
$return = dbFetchCell('SELECT COUNT(*) FROM users WHERE username = ?', array($username), true);
return $return;
}
function user_exists($username) {
global $config, $ds;
+35 -5
View File
@@ -30,7 +30,7 @@ if ($config['map']['engine'] == 'leaflet') {
<div class="col-sm-4">
<label for="init_lat" class="control-label">Initial Latitude: </label>
</div>
<div class="col-sm-6">
<div class="col-sm-8">
<input class="form-control" name="init_lat" id="input_lat_'.$unique_id.'" value="'.$widget_settings['init_lat'].'" placeholder="ie. 51.4800 for Greenwich">
</div>
</div>
@@ -46,7 +46,7 @@ if ($config['map']['engine'] == 'leaflet') {
<div class="col-sm-4">
<label for="init_zoom" class="control-label">Initial Zoom: </label>
</div>
<div class="col-sm-6">
<div class="col-sm-8">
<select class="form-control" name="init_zoom" id="select_zoom'.$unique_id.'">
';
for ($i=0; $i<19; $i++) {
@@ -65,10 +65,35 @@ if ($config['map']['engine'] == 'leaflet') {
<div class="col-sm-4">
<label for="group_radius" class="control-label">Grouping radius: </label>
</div>
<div class="col-sm-4">
<div class="col-sm-8">
<input class="form-control" name="group_radius" id="input_radius_'.$unique_id.'" value="'.$widget_settings['group_radius'].'" placeholder="default 80">
</div>
</div>
<div class="form-group">
<div class="col-sm-4">
<label for="status" class="control-label">Show devices: </label>
</div>
<div class="col-sm-8">
<select class="form-control" name="status" id="status_'.$unique_id.'">';
$temp_output .= '<option value="0,1"';
if ($widget_settings['status'] == '0,1') {
$temp_output .= ' selected';
}
$temp_output .= '>Up + Down</option>
<option value="1"';
if ($widget_settings['status'] == '1') {
$temp_output .= ' selected';
}
$temp_output .= '>Up</option>
<option value="0"';
if ($widget_settings['status'] == '0') {
$temp_output .= ' selected';
}
$temp_output .= '>Down</option>
</select>
</div>
</div>
<div class="form-group">
<div class="col-sm-2">
<button type="submit" class="btn btn-default">Set</button>
@@ -101,6 +126,9 @@ if ($config['map']['engine'] == 'leaflet') {
else {
$group_radius = 80;
}
if (empty($widget_settings['status']) && $widget_settings['status'] != '0') {
$widget_settings['status'] = '0,1';
}
$map_init = "[" . $init_lat . ", " . $init_lng . "], " . sprintf("%01.0f", $init_zoom);
$temp_output .= 'var map = L.map(\'leaflet-map\').setView('.$map_init.');
L.tileLayer(\'//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png\', {
@@ -125,6 +153,7 @@ var greenMarker = L.AwesomeMarkers.icon({
$sql = "SELECT DISTINCT(`device_id`),`hostname`,`os`,`status`,`lat`,`lng` FROM `devices`
LEFT JOIN `locations` ON `devices`.`location`=`locations`.`location`
WHERE `disabled`=0 AND `ignore`=0 AND `lat` != '' AND `lng` != ''
AND `status` IN (".$widget_settings['status'].")
ORDER BY `status` ASC, `hostname`";
}
else {
@@ -134,10 +163,11 @@ var greenMarker = L.AwesomeMarkers.icon({
LEFT JOIN `locations` ON `devices`.`location`=`locations`.`location`
WHERE `disabled`=0 AND `ignore`=0 AND `lat` != '' AND `lng` != ''
AND `devices`.`device_id` = `devices_perms`.`device_id`
AND `devices_perms`.`user_id` = ?
AND `devices_perms`.`user_id` = ? AND `status` IN (".$widget_settings['status'].")
ORDER BY `status` ASC, `hostname`";
$param[] = $_SESSION['user_id'];
}
foreach (dbFetchRows($sql, array($_SESSION['user_id'])) as $map_devices) {
foreach (dbFetchRows($sql, $param) as $map_devices) {
$icon = 'greenMarker';
$z_offset = 0;
if ($map_devices['status'] == 0) {
@@ -0,0 +1,30 @@
<?php
/*
* LibreNMS
*
* Copyright (c) 2015 Søren Friis Rosiak <sorenrosiak@gmail.com>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
$status = 'error';
$message = 'unknown error';
$parameter = mres($_POST['parameter']);
if (isset($parameter)) {
$status = 'ok';
$message = 'Queried';
$output = get_ripe_api_whois_data_json($parameter);
}
else {
$status = 'error';
$message = 'ERROR: Could not query';
}
die(json_encode(array(
'status' => $status,
'message' => $message,
'parameter' => $parameter,
'output' => $output
)));
+9
View File
@@ -1178,6 +1178,9 @@ function dynamic_override_config($type, $name, $device) {
if ($type == 'checkbox') {
return '<input type="checkbox" id="override_config" name="override_config" data-attrib="'.$name.'" data-device_id="'.$device['device_id'].'" data-size="small" '.$checked.'>';
}
elseif ($type == 'text') {
return '<input type="text" id="override_config_text" name="override_config_text" data-attrib="'.$name.'" data-device_id="'.$device['device_id'].'" value="'.$attrib_val.'">';
}
}//end dynamic_override_config()
function generate_dynamic_config_panel($title,$end_panel=true,$config_groups,$items=array(),$transport='') {
@@ -1249,3 +1252,9 @@ function generate_dynamic_config_panel($title,$end_panel=true,$config_groups,$it
}
return $output;
}//end generate_dynamic_config_panel()
function get_ripe_api_whois_data_json($ripe_parameter) {
$ripe_whois_url = 'https://stat.ripe.net/data/whois/data.json?resource=' . $ripe_parameter;
return json_decode(file_get_contents($ripe_whois_url) , true);
}//end get_ripe_api_whois_data_json()
@@ -39,7 +39,7 @@ $rrd_options .= ' GPRINT:availreal:LAST:\ \ \ %7.2lf%sB';
$rrd_options .= ' GPRINT:availreal:AVERAGE:%7.2lf%sB';
$rrd_options .= " GPRINT:availreal:MAX:%7.2lf%sB\\\\n";
$rrd_options .= ' LINE1:usedreal#d0b080:';
$rrd_options .= ' AREA:shared#afeced::';
$rrd_options .= ' AREA:shared#afeced:';
$rrd_options .= ' AREA:buffered#cc0000::STACK';
$rrd_options .= ' AREA:cached#ffaa66::STACK';
$rrd_options .= ' LINE1.25:shared#008fea:shared';
@@ -53,14 +53,14 @@ else {
foreach ($rrd_list as $rrd) {
$colours = (isset($rrd['colour']) ? $rrd['colour'] : 'default');
$strlen = ((strlen($rrd['descr']) < $descr_len) ? ($descr_len - strlen($rrd['descr'])) : '0');
$descr = (isset($rrd['descr']) ? rrdtool_escape($rrd['descr'], ($desc_len + $strlen)) : 'Unkown');
$descr = (isset($rrd['descr']) ? rrdtool_escape($rrd['descr'], ($desc_len + $strlen)) : 'Unknown');
for ($z = 0; $z < $strlen;
$z++) {
$descr .= ' ';
}
if ($i) {
$stack = 'STACK';
$stack = ':STACK';
}
$colour = $config['graph_colours'][$colours][$x];
@@ -68,7 +68,7 @@ foreach ($rrd_list as $rrd) {
$rrd_options .= ' DEF:peak'.$x.'='.$rrd['filename'].':peak:MAX';
$rrd_options .= ' DEF:unique'.$x.'='.$rrd['filename'].':unique:AVERAGE';
$rrd_options .= ' VDEF:avg'.$x.'=cur'.$x.',AVERAGE';
$rrd_options .= ' AREA:cur'.$x.'#'.$colour.':"'.$descr."\":$stack";
$rrd_options .= ' AREA:cur'.$x.'#'.$colour.":'".$descr."'$stack";
$rrd_options .= ' GPRINT:cur'.$x.':LAST:"%6.2lf"';
$rrd_options .= ' GPRINT:unique'.$x.':LAST:"%6.2lf%s"';
$rrd_options .= ' GPRINT:avg'.$x.':"%6.2lf"';
@@ -97,7 +97,7 @@ if (!$nototal) {
$rrd_options .= ' CDEF:totunique=unique0'.$totunique;
$rrd_options .= ' CDEF:totpeak=peak0'.$totpeak;
$rrd_options .= ' VDEF:totavg=totcur,AVERAGE';
$rrd_options .= ' LINE2:totcur#'.$colour.':"'.$descr.'"';
$rrd_options .= ' LINE2:totcur#'.$colour.":'".$descr."'";
$rrd_options .= ' GPRINT:totcur:LAST:"%6.2lf"';
$rrd_options .= ' GPRINT:totunique:LAST:"%6.2lf%s"';
$rrd_options .= ' GPRINT:totavg:"%6.2lf"';
+1 -1
View File
@@ -46,7 +46,7 @@ foreach (dbFetchRows('SELECT * FROM `mempools` where `device_id` = ?', array($de
$rrd_optionsb .= " LINE1:mempooltotal$i#".$colour.":'".$descr."' ";
$rrd_optionsb .= " GPRINT:mempooltotal$i:MIN:%3.0lf%%";
$rrd_optionsb .= " GPRINT:mempooltotal$i:LAST:%3.0lf%%";
$rrd_optionsb .= " GPRINT:mempooltotal$i:MAX:%3.0lf%%\\\l ";
$rrd_optionsb .= " GPRINT:mempooltotal$i:MAX:%3.0lf%%\\l ";
$iter++;
$i++;
}
@@ -37,6 +37,7 @@ foreach ($smokeping_files[$direction][$device['hostname']] as $source => $filena
$colour = $config['graph_colours'][$colourset][$iter];
$iter++;
// FIXME: $descr unused? -- PDG 2015-11-14
$descr = rrdtool_escape($source, $descr_len);
$filename = generate_smokeping_file($device,$filename);
+1 -1
View File
@@ -42,6 +42,6 @@ foreach (dbFetchRows('SELECT * FROM storage where device_id = ?', array($device[
$rrd_options .= " LINE1.25:$storage[storage_id]perc#".$colour.":'$descr'";
$rrd_options .= " GPRINT:$storage[storage_id]size:LAST:%6.2lf%sB";
$rrd_options .= " GPRINT:$storage[storage_id]used:LAST:%6.2lf%sB";
$rrd_options .= " GPRINT:$storage[storage_id]perc:LAST:%5.2lf%%\\\\l";
$rrd_options .= " GPRINT:$storage[storage_id]perc:LAST:%5.2lf%%\\l";
$iter++;
}//end foreach
+2 -2
View File
@@ -14,12 +14,12 @@ $rrd_options .= ' CDEF:b=5min,100,/';
$rrd_options .= ' CDEF:c=15min,100,/';
$rrd_options .= ' CDEF:cdefd=a,b,c,+,+';
$rrd_options .= " COMMENT:'Load Average Current Average Maximum\\n'";
$rrd_options .= " AREA:a#ffeeaa:'1 Min':";
$rrd_options .= " AREA:a#ffeeaa:'1 Min'";
$rrd_options .= ' LINE1:a#c5aa00:';
$rrd_options .= " GPRINT:a:LAST:' %7.2lf'";
$rrd_options .= " GPRINT:a:AVERAGE:' %7.2lf'";
$rrd_options .= " GPRINT:a:MAX:' %7.2lf\\n'";
$rrd_options .= " LINE1.25:b#ea8f00:'5 Min':";
$rrd_options .= " LINE1.25:b#ea8f00:'5 Min'";
$rrd_options .= " GPRINT:b:LAST:' %7.2lf'";
$rrd_options .= " GPRINT:b:AVERAGE:' %7.2lf'";
$rrd_options .= " GPRINT:b:MAX:' %7.2lf\\n'";
@@ -73,7 +73,7 @@ $rrd_options .= " 'COMMENT: \\n'";
$rrd_options .= " 'LINE1:usedreal#d0b080:'";
$rrd_options .= " 'AREA:shared#afeced::'";
$rrd_options .= " 'AREA:shared#afeced:'";
$rrd_options .= " 'AREA:buffered#cc0000::STACK'";
$rrd_options .= " 'AREA:cached#ffaa66::STACK'";
+3 -3
View File
@@ -107,7 +107,7 @@ $rrd_options .= ' LINE:in'.$format."#608720:'In '";
$rrd_options .= ' GPRINT:in'.$format.':LAST:%6.2lf%s';
$rrd_options .= ' GPRINT:in'.$format.':AVERAGE:%6.2lf%s';
$rrd_options .= ' GPRINT:in'.$format.'_max:MAX:%6.2lf%s';
$rrd_options .= " GPRINT:95thin:%6.2lf%s\\\\n";
$rrd_options .= " GPRINT:95thin:%6.2lf%s\\n";
$rrd_options .= ' AREA:dout'.$format.'_max#E0E0FF:';
$rrd_options .= ' AREA:dout'.$format.'#8080C0:';
@@ -116,7 +116,7 @@ $rrd_options .= ' LINE:dout'.$format."#606090:'Out'";
$rrd_options .= ' GPRINT:out'.$format.':LAST:%6.2lf%s';
$rrd_options .= ' GPRINT:out'.$format.':AVERAGE:%6.2lf%s';
$rrd_options .= ' GPRINT:out'.$format.'_max:MAX:%6.2lf%s';
$rrd_options .= " GPRINT:95thout:%6.2lf%s\\\\n";
$rrd_options .= " GPRINT:95thout:%6.2lf%s\\n";
if ($config['rrdgraph_real_95th']) {
$rrd_options .= ' HRULE:95thhigh#FF0000:"Highest"';
@@ -125,7 +125,7 @@ if ($config['rrdgraph_real_95th']) {
$rrd_options .= " GPRINT:tot:'Total %6.2lf%s'";
$rrd_options .= " GPRINT:totin:'(In %6.2lf%s'";
$rrd_options .= " GPRINT:totout:'Out %6.2lf%s)\\\\l'";
$rrd_options .= " GPRINT:totout:'Out %6.2lf%s)\\l'";
$rrd_options .= ' LINE1:95thin#aa0000';
$rrd_options .= ' LINE1:d95thout#aa0000';
+5 -5
View File
@@ -11,7 +11,7 @@ else {
}
if ($nototal) {
$descrlen += '2';
$descr_len += '2';
$unitlen += '2';
}
@@ -57,16 +57,16 @@ foreach ($rrd_list as $rrd) {
if ($rrd['invert']) {
$rrd_options .= ' CDEF:'.$id.'i='.$id.',-1,*';
$rrd_optionsc .= ' AREA:'.$id.'i#'.$colour.":'$descr':".$cstack;
$rrd_optionsc .= ' AREA:'.$id.'i#'.$colour.":'$descr'".$cstack;
$rrd_optionsc .= ' GPRINT:'.$id.':LAST:%5.1lf%s GPRINT:'.$id.'min:MIN:%5.1lf%s';
$rrd_optionsc .= ' GPRINT:'.$id.'max:MAX:%5.1lf%s GPRINT:'.$id.":AVERAGE:'%5.1lf%s\\n'";
$cstack = 'STACK';
$cstack = ':STACK';
}
else {
$rrd_optionsb .= ' AREA:'.$id.'#'.$colour.":'$descr':".$bstack;
$rrd_optionsb .= ' AREA:'.$id.'#'.$colour.":'$descr'".$bstack;
$rrd_optionsb .= ' GPRINT:'.$id.':LAST:%5.1lf%s GPRINT:'.$id.'min:MIN:%5.1lf%s';
$rrd_optionsb .= ' GPRINT:'.$id.'max:MAX:%5.1lf%s GPRINT:'.$id.":AVERAGE:'%5.1lf%s\\n'";
$bstack = 'STACK';
$bstack = ':STACK';
}
$i++;
@@ -49,9 +49,6 @@ foreach ($rrd_list as $rrd) {
}
$descr_out = rrdtool_escape($rrd['descr_out'], $descr_len).' Out';
$descr = str_replace("'", '', $descr);
// FIXME does this mean ' should be filtered in rrdtool_escape? probably...
$descr_out = str_replace("'", '', $descr_out);
}
$rrd_options .= ' DEF:'.$in.$i.'='.$rrd['filename'].':'.$ds_in.':AVERAGE ';
@@ -68,10 +65,10 @@ foreach ($rrd_list as $rrd) {
}
if ($i) {
$stack = 'STACK';
$stack = ':STACK';
}
$rrd_options .= ' AREA:inB'.$i.'#'.$colour_in.":'".$descr."':$stack";
$rrd_options .= ' AREA:inB'.$i.'#'.$colour_in.":'".$descr."'$stack";
if (!$nodetails) {
$rrd_options .= ' GPRINT:inB'.$i.":LAST:%6.2lf%s$units";
$rrd_options .= ' GPRINT:inB'.$i.":AVERAGE:%6.2lf%s$units";
@@ -84,7 +81,7 @@ foreach ($rrd_list as $rrd) {
}
$rrd_options .= " 'HRULE:0#".$colour_out.':'.$descr_out."'";
$rrd_optionsb .= " 'AREA:outB".$i.'_neg#'.$colour_out."::$stack'";
$rrd_optionsb .= " 'AREA:outB".$i.'_neg#'.$colour_out.":$stack'";
if (!$nodetails) {
$rrd_options .= ' GPRINT:outB'.$i.":LAST:%6.2lf%s$units";
@@ -45,9 +45,6 @@ foreach ($rrd_list as $rrd) {
}
$descr_out = rrdtool_escape($rrd['descr_out'], $descr_len).' Out';
$descr = str_replace("'", '', $descr);
// FIXME does this mean ' should be filtered in rrdtool_escape? probably...
$descr_out = str_replace("'", '', $descr_out);
$rrd_options .= ' DEF:'.$in.$i.'='.$rrd['filename'].':'.$ds_in.':AVERAGE ';
$rrd_options .= ' DEF:'.$out.$i.'='.$rrd['filename'].':'.$ds_out.':AVERAGE ';
@@ -69,10 +66,10 @@ foreach ($rrd_list as $rrd) {
}
if ($i) {
$stack = 'STACK';
$stack = ':STACK';
}
$rrd_options .= ' AREA:inB'.$i.'#'.$colour_in.":'".$descr."':$stack";
$rrd_options .= ' AREA:inB'.$i.'#'.$colour_in.":'".$descr."'$stack";
$rrd_options .= ' GPRINT:inB'.$i.":LAST:%6.2lf%s$units";
$rrd_options .= ' GPRINT:inB'.$i.":AVERAGE:%6.2lf%s$units";
$rrd_options .= ' GPRINT:inB'.$i.":MAX:%6.2lf%s$units\l";
@@ -82,7 +79,7 @@ foreach ($rrd_list as $rrd) {
}
$rrd_options .= " 'HRULE:0#".$colour_out.':'.$descr_out."'";
$rrd_optionsb .= " 'AREA:outB".$i.'_neg#'.$colour_out."::$stack'";
$rrd_optionsb .= " 'AREA:outB".$i.'_neg#'.$colour_out.":$stack'";
$rrd_options .= ' GPRINT:outB'.$i.":LAST:%6.2lf%s$units";
$rrd_options .= ' GPRINT:outB'.$i.":AVERAGE:%6.2lf%s$units";
$rrd_options .= ' GPRINT:outB'.$i.":MAX:%6.2lf%s$units\l";
@@ -117,7 +114,7 @@ if (!$nototal) {
$rrd_options .= ' VDEF:totout=outoctets,TOTAL';
$rrd_options .= ' VDEF:tot=octets,TOTAL';
// $rrd_options .= " AREA:totin#" . $colour_in . ":'" . $descr . "':$stack";
// $rrd_options .= " AREA:totin#" . $colour_in . ":'" . $descr . "'$stack";
// $rrd_options .= " GPRINT:totin:LAST:%6.2lf%s$units";
// $rrd_options .= " GPRINT:totin:AVERAGE:%6.2lf%s$units";
// $rrd_options .= " GPRINT:totin:MAX:%6.2lf%s$units\l";
@@ -11,7 +11,7 @@ else {
}
if ($nototal) {
$descrlen += '2';
$descr_len += '2';
$unitlen += '2';
}
@@ -71,7 +71,7 @@ foreach ($rrd_list as $rrd) {
}
if ($i) {
$stack = 'STACK';
$stack = ':STACK';
}
$rrd_options .= ' AREA:inbits'.$i.'#'.$colour_in.":'".rrdtool_escape($rrd['descr'], 9)."In '$stack";
@@ -84,7 +84,7 @@ foreach ($rrd_list as $rrd) {
}
$rrd_options .= " COMMENT:'\\n'";
$rrd_optionsb .= ' AREA:outbits'.$i.'_neg#'.$colour_out.":$stack";
$rrd_optionsb .= ' AREA:outbits'.$i.'_neg#'.$colour_out."$stack";
$rrd_options .= ' HRULE:999999999999999#'.$colour_out.":'".str_pad('', 10)."Out'";
$rrd_options .= ' GPRINT:outbits'.$i.':LAST:%6.2lf%s';
$rrd_options .= ' GPRINT:outbits'.$i.':AVERAGE:%6.2lf%s';
@@ -12,7 +12,7 @@ else {
}
if ($nototal) {
$descrlen += '2';
$descr_len += '2';
$unitlen += '2';
}
@@ -32,7 +32,7 @@ else {
$unitlen = '10';
if ($nototal) {
$descrlen += '2';
$descr_len += '2';
$unitlen += '2';
}
@@ -81,7 +81,7 @@ foreach ($rrd_list as $i => $rrd) {
// This this not the first entry?
if ($i) {
$stack = 'STACK';
$stack = ':STACK';
}
// if we've been passed a multiplier we must make a CDEF based on it!
@@ -109,13 +109,13 @@ foreach ($rrd_list as $i => $rrd) {
$t_defname = $g_defname;
}
$rrd_options .= ' AREA:'.$g_defname.$i.'#'.$colour.":'".$descr."':$stack";
$rrd_options .= ' AREA:'.$g_defname.$i.'#'.$colour.":'".$descr."'$stack";
$rrd_options .= ' GPRINT:'.$t_defname.$i.':LAST:%5.2lf%s GPRINT:'.$t_defname.$i.'min:MIN:%5.2lf%s';
$rrd_options .= ' GPRINT:'.$t_defname.$i.'max:MAX:%5.2lf%s GPRINT:'.$t_defname.$i.":AVERAGE:'%5.2lf%s\\n'";
if (!$nototal) {
$rrd_options .= ' GPRINT:tot'.$rrd['ds'].$i.':%6.2lf%s'.rrdtool_escape($total_units).'';
$rrd_options .= ' GPRINT:tot'.$rrd['ds'].$i.":%6.2lf%s'".rrdtool_escape($total_units)."'";
}
$rrd_options .= " COMMENT:'\\n'";
+1 -1
View File
@@ -50,7 +50,7 @@ foreach ($dbq as $ds) {
$descr = rrdtool_escape($ds['ds_label'], $descr_len);
$cmd_graph .= ' '.$ds['ds_draw'].':'.$ds_name.'#'.$colour.':"'.$descr.'"';
$cmd_graph .= ' '.$ds['ds_draw'].':'.$ds_name.'#'.$colour.":'".$descr."'";
$cmd_graph .= ' GPRINT:'.$ds_name.':LAST:"%6.2lf%s"';
$cmd_graph .= ' GPRINT:'.$ds_name.':AVERAGE:"%6.2lf%s"';
$cmd_graph .= ' GPRINT:'.$ds_name.':MAX:"%6.2lf%s\\n"';
@@ -20,7 +20,7 @@ else {
}
if ($print_total) {
$rrd_options .= ' VDEF:'.$ds.'_total=ds,TOTAL';
$rrd_options .= ' VDEF:'.$ds.'_total='.$ds.',TOTAL';
}
if ($percentile) {
@@ -43,7 +43,7 @@ if ($_GET['previous'] == 'yes') {
}
if ($print_total) {
$rrd_options .= ' VDEF:'.$ds.'_totalX=ds,TOTAL';
$rrd_options .= ' VDEF:'.$ds.'_totalX='.$ds.',TOTAL';
}
if ($percentile) {
@@ -74,11 +74,11 @@ if ($percentile) {
$rrd_options .= ' GPRINT:'.$ds.'_percentile:%6.2lf%s';
}
$rrd_options .= "\\\\n";
$rrd_options .= " COMMENT:\\\\n";
$rrd_options .= "\\n";
$rrd_options .= " COMMENT:\\n";
if ($print_total) {
$rrd_options .= ' GPRINT:'.$ds.'_tot:Total\ %6.2lf%s\)\\\\l';
$rrd_options .= ' GPRINT:'.$ds.'_total:Total" %6.2lf%s"\\l';
}
if ($percentile) {
@@ -86,6 +86,6 @@ if ($percentile) {
}
if ($_GET['previous'] == 'yes') {
$rrd_options .= ' LINE1.25:'.$ds."X#666666:'Prev \\\\n'";
$rrd_options .= ' LINE1.25:'.$ds."X#666666:'Prev \\n'";
$rrd_options .= ' AREA:'.$ds.'X#99999966:';
}
@@ -5,6 +5,7 @@ $scale_max = '100';
$ds = 'usage';
// FIXME: As far as I can tell, $descr is never mentioned in includes/graphs/generic_simplex.inc.php -- PDG 2015-11-14
$descr = rrdtool_escape(short_hrDeviceDescr($proc['processor_descr']), 28);
$colour_line = 'cc0000';
@@ -19,7 +19,7 @@ $rrd_options .= ' AREA:sensor_diff#c5c5c5::STACK';
$rrd_options .= " LINE1.5:sensor#cc0000:'".rrdtool_escape($sensor['sensor_descr'], 21)."'";
$rrd_options .= ' GPRINT:sensor_min:MIN:%4.1lfC';
$rrd_options .= ' GPRINT:sensor:LAST:%4.1lfC';
$rrd_options .= ' GPRINT:sensor_max:MAX:%4.1lfC\\\\l';
$rrd_options .= ' GPRINT:sensor_max:MAX:%4.1lfC\\l';
if (is_numeric($sensor['sensor_limit'])) {
$rrd_options .= ' HRULE:'.$sensor['sensor_limit'].'#999999::dashes';
+32 -11
View File
@@ -36,8 +36,8 @@ else {
$mac = '';
}
echo "<tr style=\"background-color: $row_colour;\" valign=top onmouseover=\"this.style.backgroundColor='$list_highlight';\" onmouseout=\"this.style.backgroundColor='$row_colour';\" onclick=\"location.href='".generate_port_url($port)."'\" style='cursor: pointer;'>
<td valign=top width=350>";
echo "<tr style=\"background-color: $row_colour;\" valign=top onmouseover=\"this.style.backgroundColor='$list_highlight';\" onmouseout=\"this.style.backgroundColor='$row_colour';\" style='cursor: pointer;'>
<td valign=top width=350 onclick=\"location.href='".generate_port_url($port)."'\">";
echo ' <span class=list-large>
'.generate_port_link($port, $port['ifIndex'].'. '.$port['label'])." $error_img $mac
</span><br /><span class=interface-desc>".$port['ifAlias'].'</span>';
@@ -62,7 +62,7 @@ if ($port_details) {
echo '</span>';
echo '</td><td width=100>';
echo "</td><td width=100 onclick=\"location.href='".generate_port_url($port)."'\" >";
if ($port_details) {
$port['graph_type'] = 'port_bits';
@@ -73,7 +73,7 @@ if ($port_details) {
echo generate_port_link($port, "<img src='graph.php?type=port_errors&amp;id=".$port['port_id'].'&amp;from='.$config['time']['day'].'&amp;to='.$config['time']['now'].'&amp;width=100&amp;height=20&amp;legend=no&amp;bg='.str_replace('#', '', $row_colour)."'>");
}
echo '</td><td width=120>';
echo "</td><td width=120 onclick=\"location.href='".generate_port_url($port)."'\" >";
if ($port['ifOperStatus'] == 'up') {
$port['in_rate'] = ($port['ifInOctets_rate'] * 8);
@@ -86,7 +86,7 @@ if ($port['ifOperStatus'] == 'up') {
<img src='images/icons/arrow_pps_out.png' align=absmiddle> ".format_bi($port['ifOutUcastPkts_rate']).'pps</span>';
}
echo '</td><td width=75>';
echo "</td><td width=75 onclick=\"location.href='".generate_port_url($port)."'\" >";
if ($port['ifSpeed']) {
echo '<span class=box-desc>'.humanspeed($port['ifSpeed']).'</span>';
}
@@ -130,19 +130,19 @@ if ($device['os'] == 'ios' || $device['os'] == 'iosxe') {
}//end if
if ($port_adsl['adslLineCoding']) {
echo '</td><td width=150>';
echo "</td><td width=150 onclick=\"location.href='".generate_port_url($port)."'\" >";
echo $port_adsl['adslLineCoding'].'/'.rewrite_adslLineType($port_adsl['adslLineType']);
echo '<br />';
echo 'Sync:'.formatRates($port_adsl['adslAtucChanCurrTxRate']).'/'.formatRates($port_adsl['adslAturChanCurrTxRate']);
echo '<br />';
echo 'Max:'.formatRates($port_adsl['adslAtucCurrAttainableRate']).'/'.formatRates($port_adsl['adslAturCurrAttainableRate']);
echo '</td><td width=150>';
echo "</td><td width=150 onclick=\"location.href='".generate_port_url($port)."'\" >";
echo 'Atten:'.$port_adsl['adslAtucCurrAtn'].'dB/'.$port_adsl['adslAturCurrAtn'].'dB';
echo '<br />';
echo 'SNR:'.$port_adsl['adslAtucCurrSnrMgn'].'dB/'.$port_adsl['adslAturCurrSnrMgn'].'dB';
}
else {
echo '</td><td width=150>';
echo "</td><td width=150 onclick=\"location.href='".generate_port_url($port)."'\" >";
if ($port['ifType'] && $port['ifType'] != '') {
echo '<span class=box-desc>'.fixiftype($port['ifType']).'</span>';
}
@@ -158,7 +158,7 @@ else {
echo '-';
}
echo '</td><td width=150>';
echo "</td><td width=150 onclick=\"location.href='".generate_port_url($port)."'\" >";
if ($port['ifPhysAddress'] && $port['ifPhysAddress'] != '') {
echo '<span class=box-desc>'.formatMac($port['ifPhysAddress']).'</span>';
}
@@ -176,13 +176,17 @@ else {
}//end if
echo '</td>';
echo '<td width=375 valign=top class=interface-desc>';
echo '<td width=375 valign=top class="interface-desc">';
$neighborsCount=0;
$nbLinks=0;
if (strpos($port['label'], 'oopback') === false && !$graph_type) {
foreach (dbFetchRows('SELECT * FROM `links` AS L, `ports` AS I, `devices` AS D WHERE L.local_port_id = ? AND L.remote_port_id = I.port_id AND I.device_id = D.device_id', array($if_id)) as $link) {
// echo("<img src='images/16/connect.png' align=absmiddle alt='Directly Connected' /> " . generate_port_link($link, makeshortif($link['label'])) . " on " . generate_device_link($link, shorthost($link['hostname'])) . "</a><br />");
// $br = "<br />";
$int_links[$link['port_id']] = $link['port_id'];
$int_links_phys[$link['port_id']] = 1;
$nbLinks++;
}
unset($br);
@@ -233,10 +237,23 @@ if (strpos($port['label'], 'oopback') === false && !$graph_type) {
}//end foreach
}//end if
if(count($int_links) > 3)
{
echo '<div class="collapse-neighbors"><span class="neighbors-button glyphicon glyphicon-plus" aria-hidden="true"></span>
<span class="neighbors-interface-list-firsts" style="display: inline;">';
}
if ($port_details && $config['enable_port_relationship'] === true && port_permitted($int_link,$device['device_id'])) {
foreach ($int_links as $int_link) {
$neighborsCount++;
if($neighborsCount == 4)
{
echo '<span class="neighbors-list-continued" style="display: inline;"></br>[...]</span>';
echo '</span>';
echo '<span class="neighbors-interface-list" style="display: none;">';
}
$link_if = dbFetchRow('SELECT * from ports AS I, devices AS D WHERE I.device_id = D.device_id and I.port_id = ?', array($int_link));
echo "$br";
if ($int_links_phys[$int_link]) {
@@ -304,6 +321,10 @@ if ($port_details && $config['enable_port_relationship'] === true && port_permit
unset($int_links, $int_links_v6, $int_links_v4, $int_links_phys, $br);
if($nbLinks > 3)
{
echo '</span></div>';
}
echo '</td></tr>';
// If we're showing graphs, generate the graph and print the img tags
+1 -1
View File
@@ -218,7 +218,7 @@ echo $edges;
var network = new vis.Network(container, data, options);
network.on('click', function (properties) {
if (properties.nodes > 0) {
window.location.href = "/device/device="+properties.nodes+"/tab=map/"
window.location.href = "device/device="+properties.nodes+"/tab=map/"
}
});
</script>
+6
View File
@@ -74,6 +74,12 @@ if ($_SESSION['userlevel'] >= '10') {
<li><a href="<?php echo(generate_url(array('page'=>'availability-map'))); ?>"><i class="fa fa-arrow-circle-up fa-fw fa-lg"></i> Availability</a></li>
<li><a href="<?php echo(generate_url(array('page'=>'map'))); ?>"><i class="fa fa-desktop fa-fw fa-lg"></i> Network</a></li>
</ul>
</li>
<li class="dropdown-submenu">
<a href="<?php echo(generate_url(array('page'=>'overview'))); ?>"><i class="fa fa-wrench fa-fw fa-lg"></i> Tools</a>
<ul class="dropdown-menu scrollable-menu">
<li><a href="<?php echo(generate_url(array('page'=>'ripenccapi'))); ?>"><i class="fa fa-arrow-circle-up fa-fw fa-lg"></i> RIPE NCC API</a></li>
</ul>
</li>
<li role="presentation" class="divider"></li>
<li><a href="<?php echo(generate_url(array('page'=>'eventlog'))); ?>"><i class="fa fa-book fa-fw fa-lg"></i> Eventlog</a></li>
+1 -1
View File
@@ -29,7 +29,7 @@ if (isset($searchPhrase) && !empty($searchPhrase)) {
$sql .= " AND (`D`.`hostname` LIKE '%$searchPhrase%' OR `E`.`datetime` LIKE '%$searchPhrase%' OR `E`.`message` LIKE '%$searchPhrase%' OR `E`.`type` LIKE '%$searchPhrase%')";
}
$count_sql = "SELECT COUNT(datetime) $sql";
$count_sql = "SELECT COUNT(event_id) $sql";
$total = dbFetchCell($count_sql, $param);
if (empty($total)) {
$total = 0;
+46
View File
@@ -25,6 +25,32 @@ $(document).ready(function() {
});
});
// Device override for text inputs
$(document).on('blur', 'input[name="override_config_text"]', function(event) {
event.preventDefault();
var $this = $(this);
var attrib = $this.data('attrib');
var device_id = $this.data('device_id');
var value = $this.val();
$.ajax({
type: 'POST',
url: 'ajax_form.php',
data: { type: 'override-config', device_id: device_id, attrib: attrib, state: value },
dataType: 'json',
success: function(data) {
if (data.status == 'ok') {
toastr.success(data.message);
}
else {
toastr.error(data.message);
}
},
error: function() {
toastr.error('Could not set this override');
}
});
});
// Checkbox config ajax calls
$("[name='global-config-check']").bootstrapSwitch('offColor','danger');
$('input[name="global-config-check"]').on('switchChange.bootstrapSwitch', function(event, state) {
@@ -96,6 +122,7 @@ $(document).ready(function() {
}
});
});
});
function submitCustomRange(frmdata) {
@@ -109,3 +136,22 @@ function submitCustomRange(frmdata) {
return true;
}
$(document).on("click", '.collapse-neighbors', function(event)
{
var caller = $(this);
var button = caller.find('.neighbors-button');
var list = caller.find('.neighbors-interface-list');
var continued = caller.find('.neighbors-list-continued');
if(button.hasClass("glyphicon-plus"))
{
button.addClass('glyphicon-minus').removeClass('glyphicon-plus');
}else
{
button.addClass('glyphicon-plus').removeClass('glyphicon-minus');
}
list.toggle();
continued.toggle();
});
+2 -2
View File
@@ -36,7 +36,7 @@ if ($_POST['device']) {
foreach ($enabled as $app) {
if (!in_array($app, $app_in_db)) {
$updated += dbInsert(array('device_id' => $device['device_id'], 'app_type' => $app), 'applications');
$updated += dbInsert(array('device_id' => $device['device_id'], 'app_type' => $app, 'app_status' => '', 'app_instance' => ''), 'applications');
}
}
@@ -99,4 +99,4 @@ echo '<div class="row">
';
echo '</form>';
echo '</div>';
echo '</div>';
echo '</div>';
+6
View File
@@ -14,6 +14,12 @@ echo '
'.dynamic_override_config('checkbox','override_Oxidized_disable', $device).'
</div>
</div>
<div class="form-group">
<label for="unixagent" class="col-sm-2 control-label">Unix agent port</label>
<div class="col-sm-10">
'.dynamic_override_config('text','override_Unixagent_port', $device).'
</div>
</div>
</form>
';
+15
View File
@@ -62,6 +62,21 @@ foreach ($menu_options as $option => $text) {
<div style="float: right;">
<select name='type' id='type'
onchange="window.open(this.options[this.selectedIndex].value,'_top')" >
<?php
$type = 'device';
foreach (get_graph_subtypes($type) as $avail_type) {
echo("<option value='".generate_url($vars, array('format' => 'graph_'.$avail_type))."'");
if ('graph_'.$avail_type == $vars['format']) {
echo(" selected");
}
$display_type = is_mib_graph($type, $avail_type) ? $avail_type : nicecase($avail_type);
echo(">$display_type</option>");
}
?>
</select>
<?php
if (isset($vars['searchbar']) && $vars['searchbar'] == "hide") {
+51
View File
@@ -0,0 +1,51 @@
<?php
/*
* LibreNMS
*
* Copyright (c) 2015 Søren Friis Rosiak <sorenrosiak@gmail.com>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
$pagetitle[] = 'RIPE NCC - API Tools';
?>
<h3> RIPE NCC API Tools </h3>
<hr>
<h4> Whois </h4>
<form class="form-horizontal" action="" method="post">
<div class="input-group">
<input type="text" class="form-control" id="input-parameter" placeholder="IP, ASN etc.">
<span class="input-group-btn">
<button type="submit" name="btn-query" id="btn-query" class="btn btn-primary">Query</button>
</span>
</div>
</form>
<br />
<div id="ripe-output" style="font-family: Courier New; background-color: lightgray;"></div>
<br />
<script>
$("[name='btn-query']").on('click', function(event) {
event.preventDefault();
var $this = $(this);
var parameter = $("#input-parameter").val();
$.ajax({
type: 'POST',
url: 'ajax_form.php',
data: { type: "query-ripenccapi", parameter: parameter},
dataType: "json",
success: function(data){
$('#ripe-output').empty();
if (data.output.data.records) {
$.each(data.output.data.records[0], function (row,value) {
$('#ripe-output').append(value['key'] + ' = ' + value['value'] +'<br />');
});
}
},
error:function(){
toastr.error('Error');
}
});
});
</script>
+16
View File
@@ -19,12 +19,28 @@ $oxidized_conf = array(
),
);
$unixagent_conf = array(
array('name' => 'unix-agent.port',
'descr' => 'Default unix-agent port',
'type' => 'text',
),
array('name' => 'unix-agent.connection-timeout',
'descr' => 'Connection timeout',
'type' => 'text',
),
array('name' => 'unix-agent.read-timeout',
'descr' => 'Read timeout',
'type' => 'text',
),
);
echo '
<div class="panel-group" id="accordion">
<form class="form-horizontal" role="form" action="" method="post">
';
echo generate_dynamic_config_panel('Oxidized integration',true,$config_groups,$oxidized_conf);
echo generate_dynamic_config_panel('Unix-agent integration',true,$config_groups,$unixagent_conf);
echo '
</form>
+11
View File
@@ -107,6 +107,17 @@ $config['os'][$os]['over'][1]['text'] = 'Processor Usage';
$config['os'][$os]['over'][2]['graph'] = 'device_ucd_memory';
$config['os'][$os]['over'][2]['text'] = 'Memory Usage';
$os = 'infinity';
$config['os'][$os]['text'] = 'LigoWave Infinity';
$config['os'][$os]['type'] = 'wireless';
$config['os'][$os]['nobulk'] = 1;
$config['os'][$os]['over'][0]['graph'] = 'device_bits';
$config['os'][$os]['over'][0]['text'] = 'Device Traffic';
$config['os'][$os]['over'][1]['graph'] = 'device_processor';
$config['os'][$os]['over'][1]['text'] = 'Processor Usage';
$config['os'][$os]['over'][2]['graph'] = 'device_mempool';
$config['os'][$os]['over'][2]['text'] = 'Memory Usage';
// Ubiquiti
$os = 'unifi';
$config['os'][$os]['text'] = 'Ubiquiti UniFi';
@@ -0,0 +1,22 @@
<?php
/*
* LibreNMS LigoWave Inifinity memory information module
*
* Copyright (c) 2015 Mike Rostermund <mike@kollegienet.dk>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
if ($device['os'] == 'infinity') {
echo 'INFINITY-MEMORY-POOL: ';
$total = snmp_get($device, '.1.3.6.1.4.1.10002.1.1.1.1.1.0', '-OvQ');
$free = snmp_get($device, '.1.3.6.1.4.1.10002.1.1.1.1.2.0', '-OvQ');
if (is_numeric($total) && is_numeric($free)) {
discover_mempool($valid_mempool, $device, 0, 'infinity', 'Memory', '1', null, null);
}
}
+17
View File
@@ -0,0 +1,17 @@
<?php
/*
* LibreNMS LigoWave os detection module
*
* Copyright (c) 2015 Mike Rostermund <mike@kollegienet.dk>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
if (!$os) {
if (preg_match('/^NFT 2N/', $sysDescr)) {
$os = 'infinity';
}
}
@@ -0,0 +1,24 @@
<?php
/*
* LibreNMS LigoWave Infinity CPU information module
*
* Copyright (c) 2015 Mike Rostermund <mike@kollegienet.dk>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
if ($device['os'] == 'infinity') {
echo 'LigoWave Infinity: ';
$descr = 'CPU';
$usage = snmp_get($device, '.1.3.6.1.4.1.10002.1.1.1.4.2.1.3.2', '-Ovqn');
if (is_numeric($usage)) {
discover_processor($valid['processor'], $device, '.1.3.6.1.4.1.10002.1.1.1.4.2.1.3.2', '0', 'infinity', $descr, '1', $usage, null, null);
}
}
unset($processors_array);
@@ -0,0 +1,17 @@
<?php
/*
* LibreNMS LigoWave Infinity memory information module
*
* Copyright (c) 2015 Mike Rostermund <mike@kollegienet.dk>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
$total = snmp_get($device, '.1.3.6.1.4.1.10002.1.1.1.1.1.0', '-OvQ');
$free = snmp_get($device, '.1.3.6.1.4.1.10002.1.1.1.1.2.0', '-OvQ');
$mempool['total'] = $total * 1024;
$mempool['free'] = $free * 1024;
$mempool['used'] = ($mempool['total'] - $mempool['free']);
+15
View File
@@ -0,0 +1,15 @@
<?php
/*
* LibreNMS LigoWave Infinity OS information module
*
* Copyright (c) 2015 Mike Rostermund <mike@kollegienet.dk>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
$version = snmp_get($device, 'SNMPv2-MIB::sysDescr.0', '-Ovq');
$version = explode(' ', $version)[2];
$hardware = snmp_get($device, 'IEEE802dot11-MIB::dot11manufacturerProductName.5', '-Ovq');
+15 -7
View File
@@ -3,14 +3,22 @@
if ($device['os_group'] == 'unix') {
echo $config['project_name'].' UNIX Agent: ';
// FIXME - this should be in config and overridable in database
$agent_port = '6556';
$agent_port = get_dev_attrib($device,'override_Unixagent_port');
if (empty($agent_port)) {
$agent_port = $config['unix-agent']['port'];
}
if (empty($config['unix-agent']['connection-timeout'])) {
$config['unix-agent']['connection-timeout'] = $config['unix-agent-connection-time-out'];
}
if (empty($config['unix-agent']['read-timeout'])) {
$config['unix-agent']['read-timeout'] = $config['unix-agent-read-time-out'];
}
$agent_start = utime();
$agent = fsockopen($device['hostname'], $agent_port, $errno, $errstr, $config['unix-agent-connection-time-out']);
$agent = fsockopen($device['hostname'], $agent_port, $errno, $errstr, $config['unix-agent']['connection-timeout']);
// Set stream timeout (for timeouts during agent fetch
stream_set_timeout($agent, $config['unix-agent-read-time-out']);
stream_set_timeout($agent, $config['unix-agent']['read-timeout']);
$agentinfo = stream_get_meta_data($agent);
if (!$agent) {
@@ -108,7 +116,7 @@ if ($device['os_group'] == 'unix') {
if (in_array($key, array('apache', 'mysql', 'nginx', 'proxmox', 'ceph'))) {
if (dbFetchCell('SELECT COUNT(*) FROM `applications` WHERE `device_id` = ? AND `app_type` = ?', array($device['device_id'], $key)) == '0') {
echo "Found new application '$key'\n";
dbInsert(array('device_id' => $device['device_id'], 'app_type' => $key), 'applications');
dbInsert(array('device_id' => $device['device_id'], 'app_type' => $key, 'app_status' => '', 'app_instance' => ''), 'applications');
}
}
}
@@ -120,7 +128,7 @@ if ($device['os_group'] == 'unix') {
foreach ($agent_data['app']['memcached'] as $memcached_host => $memcached_data) {
if (dbFetchCell('SELECT COUNT(*) FROM `applications` WHERE `device_id` = ? AND `app_type` = ? AND `app_instance` = ?', array($device['device_id'], 'memcached', $memcached_host)) == '0') {
echo "Found new application 'Memcached' $memcached_host\n";
dbInsert(array('device_id' => $device['device_id'], 'app_type' => 'memcached', 'app_instance' => $memcached_host), 'applications');
dbInsert(array('device_id' => $device['device_id'], 'app_type' => 'memcached', 'app_status' => '', 'app_instance' => $memcached_host), 'applications');
}
}
}
@@ -134,7 +142,7 @@ if ($device['os_group'] == 'unix') {
$agent_data['app']['drbd'][$drbd_dev] = $drbd_data;
if (dbFetchCell('SELECT COUNT(*) FROM `applications` WHERE `device_id` = ? AND `app_type` = ? AND `app_instance` = ?', array($device['device_id'], 'drbd', $drbd_dev)) == '0') {
echo "Found new application 'DRBd' $drbd_dev\n";
dbInsert(array('device_id' => $device['device_id'], 'app_type' => 'drbd', 'app_instance' => $drbd_dev), 'applications');
dbInsert(array('device_id' => $device['device_id'], 'app_type' => 'drbd', 'app_status' => '', 'app_instance' => $drbd_dev), 'applications');
}
}
}
+3 -2
View File
@@ -280,7 +280,8 @@ function rrdtool_lastupdate($filename, $options){
function rrdtool_escape($string, $maxlength=null){
$result = shorten_interface_type($string);
$result = str_replace('%', '%%', $result);
$result = str_replace("'", '', $result); # remove quotes
$result = str_replace('%', '%%', $result); # double percent signs
if (is_numeric($maxlength)) {
$extra = substr_count($string, ':', 0, $maxlength);
$result = substr(str_pad($result, $maxlength), 0, ($maxlength + $extra));
@@ -289,7 +290,7 @@ function rrdtool_escape($string, $maxlength=null){
}
}
$result = str_replace(':', '\:', $result);
$result = str_replace(':', '\:', $result); # escape colons
return $result.' ';
}
+1 -1
View File
@@ -1 +1 @@
INSERT INTO config (config_name,config_value,config_default,config_descr,config_group,config_group_order,config_sub_group,config_sub_group_order,config_hidden,config_disabled) values ('alert.transports.clickatell.token','','','Clickatell access token','alerting',0,'transports',0,'0','0'),('alert.transports.playsms.url','','','PlaySMS API URL','alerting',0,'transports',0,'0','0'),('alert.transports.playsms.user','','','PlaySMS User','alerting',0,'transports',0,'0','0'),('alert.transports.playsms.from','','','PlaySMS From','alerting',0,'transports',0,'0','0'),('alert.transports.playsms.token','','','PlaySMS Token','alerting',0,'transports',0,'0','0');
INSERT INTO config (config_name,config_value,config_default,config_descr,config_group,config_group_order,config_sub_group,config_sub_group_order,config_hidden,config_disabled) values ('unix-agent.port','6556','6556','Default port for the Unix-agent (check_mk)','external',0,'unix-agent',0,'0','0'),('unix-agent.connection-timeout','10','10','Unix-agent connection timeout','external',0,'unix-agent',0,'0','0'),('unix-agent.read-timeout','10','10','Unix-agent read timeout','external',0,'unix-agent',0,'0','0');
+1
View File
@@ -0,0 +1 @@
INSERT INTO config (config_name,config_value,config_default,config_descr,config_group,config_group_order,config_sub_group,config_sub_group_order,config_hidden,config_disabled) values ('alert.transports.clickatell.token','','','Clickatell access token','alerting',0,'transports',0,'0','0'),('alert.transports.playsms.url','','','PlaySMS API URL','alerting',0,'transports',0,'0','0'),('alert.transports.playsms.user','','','PlaySMS User','alerting',0,'transports',0,'0','0'),('alert.transports.playsms.from','','','PlaySMS From','alerting',0,'transports',0,'0','0'),('alert.transports.playsms.token','','','PlaySMS Token','alerting',0,'transports',0,'0','0');