mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Merge branch 'master' of https://github.com/adaniels21487/librenms into issue-1650
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
# EditorConfig is awesome: http://EditorConfig.org
|
||||
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
# Unix-style newlines with a newline ending every file
|
||||
[*]
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[**.css]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[**.php]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
@@ -11,3 +11,11 @@ nbproject
|
||||
.ircbot.alert
|
||||
.metadata_never_index
|
||||
*.swp
|
||||
|
||||
# OS generated files #
|
||||
######################
|
||||
.DS_Store
|
||||
.DS_Store?
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
Thumbs.db
|
||||
|
||||
+23
-15
@@ -1,17 +1,16 @@
|
||||
LibreNMS is a fork of [Observium][1]. Observium was written by:
|
||||
- Adam Armstrong
|
||||
- Tom Laermans
|
||||
- various others as indicated in the file contents and commit logs
|
||||
LibreNMS is a fork of [Observium][1].
|
||||
|
||||
Contributors to LibreNMS:
|
||||
LibreNMS core team:
|
||||
- Paul Gear <paul@librenms.org> (paulgear)
|
||||
- Neil Lathwood <neil@librenms.org> (laf)
|
||||
- Daniel Preussker <f0o@librenms.org> (f0o)
|
||||
- Søren Friis Rosiak <sorenrosiak@gmail.com> (rosiak)
|
||||
- Mike Rostermund <mike@kollegienet.dk> (SaaldjorMike)
|
||||
|
||||
LibreNMS contributors:
|
||||
- Bohdan Sanders <git@bohdans.com> (bohdan-s)
|
||||
- Toni Cunyat <elbuit@gmail.com> (elbuit)
|
||||
- Tuomas Riihimäki <tuomari@iudex.fi> (tuomari)
|
||||
- Søren Friis Rosiak <sorenrosiak@gmail.com> (rosiak)
|
||||
- Mike Rostermund <mike@kollegienet.dk> (SaaldjorMike)
|
||||
- Nicolas Armando <nicearma@yahoo.com> (nicearma)
|
||||
- Micah Chasteen <mjchasteen@gmail.com> (mchasteen)
|
||||
- Kevin Fleshman <fleshmank@hotmail.com> (KFleshman)
|
||||
@@ -26,13 +25,13 @@ Contributors to LibreNMS:
|
||||
- Mickael Marchand <mmarchand@corp.free.fr> (mmarchand)
|
||||
- Mohammad Al-Shami <mohammad@al-shami.net> (mohshami)
|
||||
- Rudy Hardeman <zarya@gigafreak.net> (zarya)
|
||||
- Freddie Cash (fjwcash@gmail.com) (fjwcash)
|
||||
- Thom Seddon <thom@seddonmedia.co.uk> (thomseddon)
|
||||
- Vitali Kari <vitali.kari@gmail.com> (vitalisator)
|
||||
- Freddie Cash <fjwcash@gmail.com> (fjwcash)
|
||||
- Thom Seddon <thom@seddonmedia.co.uk> (thomseddon)
|
||||
- Vitali Kari <vitali.kari@gmail.com> (vitalisator)
|
||||
- James Campbell <neokjames@gmail.com> (neokjames)
|
||||
- Steve Calvário <calvario.steve@gmail.com> (Calvario)
|
||||
- Christian Marg <marg@rz.tu-clausthal.de> (einhirn)
|
||||
- Louis Rossouw <lrossouw@gmail.com> (spinza)
|
||||
- Louis Rossouw <lrossouw@gmail.com> (spinza)
|
||||
- Clint Armstrong <clint@clintarmstrong.net> (clinta)
|
||||
- Tony Ditchfield <tony.ditchfield@gmail.com> (arnoldthebat)
|
||||
- Travis Hegner <travis.hegner@gmail.com> (travishegner)
|
||||
@@ -47,9 +46,9 @@ Contributors to LibreNMS:
|
||||
- Michael Newton <mnewton@pofp.com> (miken32)
|
||||
- Tom Ferguson <tom.ferguson.public@outlook.com> (Tawmu)
|
||||
- Jimmy Cleuren <jimmy.cleuren@gmail.com> (jimmycleuren)
|
||||
- Mark Schouten <mark@tuxis.nl> (tuxis-ie)
|
||||
- Mark Schouten <mark@tuxis.nl> (tuxis-ie)
|
||||
- Todd Eddy <vr@vrillusions.com> (vrillusions)
|
||||
- Arjit Chaudhary (arjit.c@gmail.com) (arjitc)
|
||||
- Arjit Chaudhary <arjit.c@gmail.com> (arjitc)
|
||||
- Sergiusz Paprzycki <serek@walcz.net> (spaprzycki)
|
||||
- Juho Vanhanen <juho@vanhanen.me> (juhovan)
|
||||
- Bart de Bruijn <bart_de_bruijn@yahoo.com> (bartdebruijn)
|
||||
@@ -65,7 +64,7 @@ Contributors to LibreNMS:
|
||||
- Sebastian Neuner <sebastian@sneuner.org> (9er)
|
||||
- Robert Zollner <wolfit_ro@yahoo.com> (Lupul)
|
||||
- Richard Hartmann <richih@debian.org> (RichiH)
|
||||
- Robert Gornall <roblnm@khobbits.co.uk (KHobbits)
|
||||
- Robert Gornall <roblnm@khobbits.co.uk> (KHobbits)
|
||||
- Rob Gormley <robert@gormley.me> (rgormley)
|
||||
- Richard Kojedzinszky <krichy@nmdps.net> (rkojedzinszky)
|
||||
- Tony Murray <murraytony@gmail.com> (murrant)
|
||||
@@ -74,6 +73,15 @@ Contributors to LibreNMS:
|
||||
- Rick Hodger <rick@fuzzi.org.uk> (Tatermen)
|
||||
- Eldon Koyle <ekoyle@gmail.com> (ekoyle)
|
||||
- Jonathan Bailey <jcbailey@code0.net> (jcbailey2)
|
||||
- Ruairi Carroll <ruairi.carroll@gmail.com> (rucarrol)
|
||||
- Ruairi Carroll <ruairi.carroll@gmail.com> (rucarrol)
|
||||
- Maxim Tsyplakov <maxim.tsyplakov@gmail.com> (tsypa)
|
||||
- D. Britz <github@wrind.de> (flatterlight)
|
||||
- Tobias Herrmann <tobias@fiveninedigital.ch> (Mightea)
|
||||
- Nicolas Guillaumin <nicolas+github@guillaumin.me> (nguillaumin)
|
||||
|
||||
[1]: http://observium.org/ "Observium web site"
|
||||
Observium was written by:
|
||||
- Adam Armstrong
|
||||
- Tom Laermans
|
||||
- various others as indicated in the file contents and commit logs
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ vis:
|
||||
$(GIT_SUBTREE) --prefix=lib/vis https://github.com/almende/vis.git master
|
||||
|
||||
typeahead:
|
||||
$(GIT_SUBTREE) --prefix=lib/typeahead https://github.com/twitter/typeahead.js.git master
|
||||
$(GIT_SUBTREE) --prefix=lib/typeahead https://github.com/corejavascript/typeahead.js.git master
|
||||
|
||||
gridster:
|
||||
$(GIT_SUBTREE) --prefix=lib/gridster https://github.com/dsmorse/gridster.js.git master
|
||||
|
||||
@@ -29,16 +29,15 @@ Participating
|
||||
-------------
|
||||
|
||||
You can participate in the project by:
|
||||
- Joining the [librenms-project][1] mailing list to post questions and
|
||||
suggestions.
|
||||
- Talking to us on [Twitter][3] or [IRC][4].
|
||||
- Talking to us on IRC ([##librenms on Freenode][4]) or [Twitter][3].
|
||||
- Joining the [librenms-project][1] mailing list.
|
||||
- Improving the [documentation][5].
|
||||
- Cloning the [repo][2] and filing bug reports and pull requests on github.
|
||||
- Cloning the [repo][2] and filing [bug reports][18] and [pull requests][19] on github.
|
||||
See [CONTRIBUTING][15] for more details.
|
||||
|
||||
|
||||
Try It
|
||||
------
|
||||
VM image
|
||||
--------
|
||||
|
||||
You can try LibreNMS by downloading a VM image. Currently, a Ubuntu-based
|
||||
image is supplied and has been tested with [VirtualBox][8].
|
||||
@@ -74,7 +73,7 @@ License
|
||||
|
||||
Copyright (C) 2006-2012 Adam Armstrong <adama@memetic.org>
|
||||
|
||||
Copyright (C) 2013-2014 by individual LibreNMS contributors
|
||||
Copyright (C) 2013-2016 by individual LibreNMS contributors
|
||||
|
||||
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
|
||||
@@ -119,3 +118,5 @@ exception):
|
||||
[15]: http://docs.librenms.org/General/Contributing/
|
||||
[16]: http://docs.librenms.org/
|
||||
[17]: http://docs.librenms.org/General/Acknowledgement/
|
||||
[18]: https://github.com/librenms/librenms/issues
|
||||
[19]: https://github.com/librenms/librenms/pulls
|
||||
|
||||
Executable
+20
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Script to convert RRDs from the experimental first release of MIB-based polling.
|
||||
|
||||
set -e
|
||||
set -u
|
||||
|
||||
for i; do
|
||||
base=${i%%.rrd}
|
||||
if [ -e $i.old ]; then
|
||||
continue
|
||||
fi
|
||||
mv $i $i.old
|
||||
echo "Processing $i"
|
||||
rrdtool dump $i.old | sed -e 's|<name>.*</name>|<name>mibval</name>|' > $base.xml
|
||||
rrdtool restore $base.xml $i
|
||||
rm -f $base.xml
|
||||
done
|
||||
|
||||
exit 0
|
||||
@@ -5,6 +5,7 @@ find . \
|
||||
-path ./html/includes/geshi -prune -o \
|
||||
-path ./html/includes/jpgraph -prune -o \
|
||||
-path ./html/js/jqplot -prune -o \
|
||||
-path ./lib -prune -o \
|
||||
-path ./junk -prune -o \
|
||||
-path ./logs -prune -o \
|
||||
-path ./mibs -prune -o \
|
||||
|
||||
@@ -10,7 +10,12 @@ require 'config.php';
|
||||
require_once 'includes/definitions.inc.php';
|
||||
require 'includes/functions.php';
|
||||
|
||||
$options = getopt('f:');
|
||||
$options = getopt('f:d');
|
||||
|
||||
if (isset($options['d'])) {
|
||||
echo "DEBUG\n";
|
||||
$debug = true;
|
||||
}
|
||||
|
||||
if ($options['f'] === 'update') {
|
||||
$innodb_buffer = innodb_buffer_check();
|
||||
@@ -101,7 +106,7 @@ if ($options['f'] === 'callback') {
|
||||
|
||||
if ($options['f'] === 'device_perf') {
|
||||
if (is_numeric($config['device_perf_purge'])) {
|
||||
if (dbDelete('device_perf', 'timestamp < UNIX_TIMESTAMP(DATE_SUB(NOW(),INTERVAL ? DAY))', array($config['device_perf_purge']))) {
|
||||
if (dbDelete('device_perf', 'timestamp < DATE_SUB(NOW(),INTERVAL ? DAY)', array($config['device_perf_purge']))) {
|
||||
echo 'Device performance times cleared for entries over '.$config['device_perf_purge']." days\n";
|
||||
}
|
||||
}
|
||||
|
||||
+11
-3
@@ -20,14 +20,22 @@ require 'includes/definitions.inc.php';
|
||||
require 'includes/functions.php';
|
||||
require 'includes/discovery/functions.inc.php';
|
||||
|
||||
$start = utime();
|
||||
$start = microtime(true);
|
||||
$runtime_stats = array();
|
||||
$sqlparams = array();
|
||||
$options = getopt('h:m:i:n:d::a::q',array('os:','type:'));
|
||||
|
||||
if (!isset($options['q'])) {
|
||||
echo $config['project_name_version']." Discovery\n";
|
||||
echo get_last_commit()."\n";
|
||||
$versions = version_info(false);
|
||||
echo "Version info:\n";
|
||||
$cur_sha = $versions['local_sha'];
|
||||
echo "Commit SHA: $cur_sha\n";
|
||||
echo "DB Schema: ".$versions['db_schema']."\n";
|
||||
echo "PHP: ".$versions['php_ver']."\n";
|
||||
echo "MySQL: ".$versions['mysql_ver']."\n";
|
||||
echo "RRDTool: ".$versions['rrdtool_ver']."\n";
|
||||
echo "SNMP: ".$versions['netsnmp_ver']."\n";
|
||||
}
|
||||
|
||||
if (isset($options['h'])) {
|
||||
@@ -121,7 +129,7 @@ foreach (dbFetch("SELECT * FROM `devices` WHERE status = 1 AND disabled = 0 $whe
|
||||
discover_device($device, $options);
|
||||
}
|
||||
|
||||
$end = utime();
|
||||
$end = microtime(true);
|
||||
$run = ($end - $start);
|
||||
$proctime = substr($run, 0, 5);
|
||||
|
||||
|
||||
+2
-2
@@ -505,7 +505,7 @@ Output:
|
||||
|
||||
### <a name="api-route-21">Function: `list_oxidized`</a> [`top`](#top)
|
||||
|
||||
List devices for use with Oxidized.
|
||||
List devices for use with Oxidized. If you have group support enabled then a group will also be returned based on your config.
|
||||
|
||||
Route: /api/v0/oxidized
|
||||
|
||||
@@ -836,7 +836,7 @@ Output:
|
||||
{
|
||||
"status": "ok",
|
||||
"err-msg": "",
|
||||
"message": "Alert has been ackgnowledged"
|
||||
"message": "Alert has been acknowledged"
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ if ($foo == 5) {
|
||||
```
|
||||
|
||||
### Line length
|
||||
Try to keep the length of a line to about 75-85 characters. This isn't essential but does enable compatbility for all screen sizes but above all enables reading of code easier.
|
||||
Try to keep the length of a line to about 75-85 characters. This isn't essential but does enable compatibility for all screen sizes but above all enables reading of code easier.
|
||||
|
||||
### Control structures
|
||||
A space should be used both before and after the parenthesis and also surrounding the condition operator.
|
||||
|
||||
@@ -79,12 +79,12 @@ __Installation__:
|
||||
_Note_: In case you get `Makefile:9: *** missing separator. Stop.`, compile manually using:
|
||||
* With IPv6: `gcc -Wall -O2 -fstack-protector -DWITH_IPV6 -o tinystats tinystats.c`
|
||||
* Without IPv6: `gcc -Wall -O2 -fstack-protector -o tinystats tinystats.c`
|
||||
3. Install into prefered path, like `/usr/bin/`.
|
||||
3. Install into preferred path, like `/usr/bin/`.
|
||||
|
||||
__Configuration__:
|
||||
|
||||
_Note_: In this part we assume that you use DJB's [Daemontools](http://cr.yp.to/daemontools.html) to start/stop tinydns.
|
||||
And that your tinydns-instance is located in `/service/dns`, adjust this path if necesary.
|
||||
And that your tinydns-instance is located in `/service/dns`, adjust this path if necessary.
|
||||
|
||||
1. Replace your _log_'s `run` file, typically located in `/service/dns/log/run` with:
|
||||
```
|
||||
@@ -95,7 +95,7 @@ And that your tinydns-instance is located in `/service/dns`, adjust this path if
|
||||
2. Create tinystats directory and chown:
|
||||
`mkdir /service/dns/log/main/tinystats && chown dnslog:nofiles /service/dns/log/main/tinystats`
|
||||
3. Restart TinyDNS and Daemontools: `/etc/init.d/svscan restart`
|
||||
_Note_: Some say `svc -t /service/dns` is enough, on my install (Gentoo) it doesnt rehook the logging and I'm forced to restart it entirely.
|
||||
_Note_: Some say `svc -t /service/dns` is enough, on my install (Gentoo) it doesn't rehook the logging and I'm forced to restart it entirely.
|
||||
|
||||
### MySQL
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ Placeholders:
|
||||
- Time Elapsed, Only available on recovery (`%state == 0`): `%elapsed`
|
||||
- Alert-ID: `%id`
|
||||
- Unique-ID: `%uid`
|
||||
- Faults, Only available on alert (`%state != 0`), must be iterated in a foreach (`{foreach %faults}`). Holds all available information about the Fault, accessable in the format `%value.Column`, for example: `%value.ifDescr`. Special field `%value.string` has most Identification-information (IDs, Names, Descrs) as single string, this is the equivalent of the default used.
|
||||
- Faults, Only available on alert (`%state != 0`), must be iterated in a foreach (`{foreach %faults}`). Holds all available information about the Fault, accessible in the format `%value.Column`, for example: `%value.ifDescr`. Special field `%value.string` has most Identification-information (IDs, Names, Descrs) as single string, this is the equivalent of the default used.
|
||||
- State: `%state`
|
||||
- Severity: `%severity`
|
||||
- Rule: `%rule`
|
||||
@@ -379,7 +379,7 @@ $config['alert']['transports']['pushbullet'] = 'MYFANCYACCESSTOKEN';
|
||||
## <a name="transports-clickatell">Clickatell</a>
|
||||
|
||||
Clickatell provides a REST-API requiring an Authorization-Token and at least one Cellphone number.
|
||||
Please consult Clickatell's documentation regarding number formating.
|
||||
Please consult Clickatell's documentation regarding number formatting.
|
||||
Here an example using 3 numbers, any amount of numbers is supported:
|
||||
|
||||
~~
|
||||
|
||||
@@ -46,7 +46,7 @@ We would recommend that you run some form of php caching application such as PHP
|
||||
The MySQL server should be contactable from this layer on port 3306 unless it's changed.
|
||||
|
||||
####Database Server
|
||||
MySQL - At the moment this is the only databse server that is supported, work is being done to ensure MySQL Strict mode is also supported but this should be considered to be incomplete still.
|
||||
MySQL - At the moment this is the only database server that is supported, work is being done to ensure MySQL Strict mode is also supported but this should be considered to be incomplete still.
|
||||
|
||||
The pollers, web and API layers should all be able to access the database server directly. It would be possible to configure MySQL multi master but that is outside the scope of this document.
|
||||
|
||||
@@ -63,7 +63,7 @@ $config['rrdtool_version'] = 1.5;
|
||||
```
|
||||
|
||||
####Memcache
|
||||
Memcache is required for the distributed pollers to be able to register to a central location and record what devices are polled. Memcache can run from any of the kit so long as it is accessable by all pollers.
|
||||
Memcache is required for the distributed pollers to be able to register to a central location and record what devices are polled. Memcache can run from any of the kit so long as it is accessible by all pollers.
|
||||
|
||||
####Pollers
|
||||
Pollers can be installed and run from anywhere, the only requirements are:
|
||||
@@ -78,7 +78,7 @@ This will provide the ability to have a single poller behind a NAT firewall moni
|
||||
|
||||
Another benefit to this is that you can provide N+x pollers, i.e if you know that you require three pollers to process all devices within 300 seconds then adding a 4th poller will mean that should any one single poller fail then the remaining three will complete polling in time. You could also use this to take a poller out of service for maintenance, i.e OS updates and software updates.
|
||||
|
||||
It is exctremely advisable to either run a central recursive dns server such as pdns-recursor and have all of your pollers use this or install a recursive dns server on each poller - the volume of DNS requests on large installs can be significant.
|
||||
It is extremely advisable to either run a central recursive dns server such as pdns-recursor and have all of your pollers use this or install a recursive dns server on each poller - the volume of DNS requests on large installs can be significant.
|
||||
|
||||
####Discovery
|
||||
It's not necessary to run discovery services on all pollers. In fact, you should only run one discovery process per poller group. Designate a single poller to run discovery (or a seperate server if required).
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
LibreNMS comes with a configurable geochart based frontpage to visualize where your gear is located geographically.
|
||||
|
||||
### Expiremental map
|
||||
### Experimentall map
|
||||
|
||||
An new expiremental map is available, this requires you to have properly formatted addresses in sysLocation or sysLocation override. As part of the standard poller these addresses will be Geocoded by Google and stored in the database. To enable this please set the following config:
|
||||
An new experimental map is available, this requires you to have properly formatted addresses in sysLocation or sysLocation override. As part of the standard poller these addresses will be Geocoded by Google and stored in the database. To enable this please set the following config:
|
||||
|
||||
```php
|
||||
$config['front_page'] = "pages/front/map.php";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Graylog integration
|
||||
|
||||
We have simple integration for Graylog, you will be able to view any logs from within LibreNMS that have been parsed by the syslog input from within
|
||||
Graylog itself. This includes logs from devices which aren't in LibreNMS still, you can also see logs for a sepcific device under the logs section
|
||||
Graylog itself. This includes logs from devices which aren't in LibreNMS still, you can also see logs for a specific device under the logs section
|
||||
for the device.
|
||||
|
||||
Graylog itself isn't included within LibreNMS, you will need to install this separately either on the same infrastructure as LibreNMS or as a totally
|
||||
|
||||
@@ -45,7 +45,7 @@ Command | Description
|
||||
`.join <channel>` | Joins `<channel>` if user has admin-level.
|
||||
`.listdevices` | Lists the hostnames of all known devices.
|
||||
`.log [<N>]` | Prints `N` lines or last line of the eventlog.
|
||||
`.port <hostname> <ifname>` | Prints Port-related informations from `ifname` on given `hostname`.
|
||||
`.port <hostname> <ifname>` | Prints Port-related information from `ifname` on given `hostname`.
|
||||
`.quit` | Disconnect from IRC and exit.
|
||||
`.reload` | Reload configuration.
|
||||
`.status <type>` | Prints status informations for given `type`. Type can be `devices`, `services`, `ports`. Shorthands are: `dev`,`srv`,`prt`
|
||||
@@ -105,10 +105,10 @@ Or using a single string using `,` as delimiter between various channels:
|
||||
# <a name="extensions">Extensions?!</a>
|
||||
|
||||
The bot is coded in a unified way.
|
||||
This makes writing extensions by far less painfull.
|
||||
This makes writing extensions by far less painful.
|
||||
Simply add your `command` to the `$config['irc_external']` directive and create a file called `includes/ircbot/command.inc.php` containing your code.
|
||||
The string behind the call of `.command` is passed as `$params`.
|
||||
The user who requested something is accessable via `$this->user`.
|
||||
The user who requested something is accessible via `$this->user`.
|
||||
Send your reply/ies via `$this->respond($string)`.
|
||||
|
||||
A more detailed documentation of the functions and variables available for extensions can be found at [IRC-Bot Extensions](IRC-Bot-Extensions);
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
# Enabling support for InfluxDB.
|
||||
|
||||
Before we get started it is important that you know and understand that InfluxDB support is currently alpha at best.
|
||||
All it provides is the sending of data to a InfluxDB install. Due to the current changes that are constantly being
|
||||
made to InfluxDB itself then we cannot guarantee that your data will be ok so enabling this support is at your own
|
||||
risk!
|
||||
|
||||
### Requirements
|
||||
- InfluxDB 0.94
|
||||
- Grafana
|
||||
|
||||
The setup of the above is completely out of scope here and we aren't really able to provide any help with this side
|
||||
of things.
|
||||
|
||||
### What you don't get
|
||||
- Pretty graphs, this is why at present you need Grafana. You need to build your own graphs within Grafana.
|
||||
- Support for InfluxDB or Grafana, we would highly recommend that you have some level of experience with these.
|
||||
|
||||
RRD will continue to function as normal so LibreNMS itself should continue to function as normal.
|
||||
|
||||
### Configuration
|
||||
```php
|
||||
$config['influxdb']['enable'] = true;
|
||||
$config['influxdb']['transport'] = 'http';
|
||||
$config['influxdb']['host'] = '127.0.0.1';
|
||||
$config['influxdb']['port'] = '8086';
|
||||
$config['influxdb']['db'] = 'librenms';
|
||||
$config['influxdb']['username'] = 'admin';
|
||||
$config['influxdb']['password'] = 'admin';
|
||||
```
|
||||
|
||||
UDP is a supported transport and no credentials are needed if you don't use InfluxDB authentication.
|
||||
|
||||
The same data then stored within rrd will be sent to InfluxDB and recorded. You can then create graphs within Grafana
|
||||
to display the information you need.
|
||||
@@ -17,7 +17,7 @@ For this a small `bash` script is supplied in `scripts/` called `ifAlias`.
|
||||
This requires a little bit of setup on the monitored Server (Not the server running librenms!):
|
||||
|
||||
* Add `ifAlias` from `/opt/librenms/scripts/` or download it from [here](#source) to the Server and make
|
||||
it executeable `chmod +x /path/to/ifAlias`
|
||||
it executable `chmod +x /path/to/ifAlias`
|
||||
* Add to `snmpd.conf` something like:
|
||||
``pass .1.3.6.1.2.1.31.1.1.1.18 /path/to/ifAlias``
|
||||
* Restart your `net-snmpd`
|
||||
@@ -50,6 +50,6 @@ See [examples](#examples) for formats.
|
||||
# eth2: Peering: Peering Exchange
|
||||
```
|
||||
|
||||
# <a name="source">Sourcecode</a>:
|
||||
# <a name="source">Source code</a>:
|
||||
|
||||
* https://github.com/librenms/librenms/blob/master/scripts/ifAlias
|
||||
|
||||
@@ -0,0 +1,159 @@
|
||||
## WARNING ##
|
||||
|
||||
MIB-based polling is experimental. It might overload your LibreNMS server,
|
||||
destroy your data, set your routers on fire, and kick your cat. It has been
|
||||
tested against a very limited set of devices (namely Ruckus ZD1000 wireless
|
||||
controllers, and `net-snmp` on Linux). It may fail badly on other hardware.
|
||||
|
||||
The approach taken is fairly simplistic and I claim no special expertise in
|
||||
understanding MIBs. Most of my knowledge of SNMP comes from reading net-snmp
|
||||
man pages, and reverse engineering the output of snmptranslate and snmpwalk
|
||||
and trying to make devices work with LibreNMS. I may have made false
|
||||
assumptions and probably use wrong terminology in many places. Feel free to
|
||||
offer corrections/suggestions via pull requests or email.
|
||||
|
||||
Paul Gear <paul@librenms.org>
|
||||
|
||||
## Overview ##
|
||||
|
||||
This is the 2nd experimental release of MIB polling. If you used the 1st
|
||||
release, you MUST perform a data conversion of the MIB-based polling files
|
||||
using the script `contrib/convert-mib-graphs.sh`. Failure to do so will
|
||||
result in your data collection silently stopping.
|
||||
|
||||
MIB-based polling is disabled by default; you must set
|
||||
`$config['poller_modules']['mib'] = 1;`
|
||||
in `config.php` to enable it.
|
||||
|
||||
## Preparation ##
|
||||
|
||||
MIB-based polling results in the creation of a separate RRD file for each
|
||||
device-MIB-OID-index combination encountered by LibreNMS. Thus it can cause
|
||||
your disk space requirements to grow enormously and rapidly. As an example,
|
||||
enabling MIB-based polling on my test Ruckus ZD1000 wireless controller with
|
||||
one (1) AP and one (1) user on that AP resulted in a 5 MB increase in RRD
|
||||
space usage for that device. Each RRD file is around 125 KB in size (on
|
||||
x64-64 systems) and is pre-allocated, so after the first discovery and poller
|
||||
run of each device with MIB-based polling enabled, disk space should be stable.
|
||||
However, monitoring disk usage is your responsibility. (The good news: you
|
||||
can do this with LibreNMS. :-)
|
||||
|
||||
Unless you are running LibreNMS on a powerful system with pure SSD for RRD
|
||||
storage, it is strongly recommended that you enable rrdcached and ensure it is
|
||||
working *before* enabling MIB-based polling.
|
||||
|
||||
## Components ##
|
||||
|
||||
The components involved in MIB-based polling are:
|
||||
|
||||
### Discovery ###
|
||||
|
||||
- OS discovery determines whether there are MIBs which should be polled. If
|
||||
so, they are registered in the `device_mibs` association table as relevant
|
||||
to that device. MIB associations for each device can be viewed at:
|
||||
http://your.librenms.server/device/device=XXXX/tab=mib/
|
||||
All MIBs used by MIB-based polling may be viewed at:
|
||||
http://your.librenms.server/mibs/
|
||||
All device associations created by MIB-based polling may be viewed at:
|
||||
http://your.librenms.server/mib_assoc/ (Devices -> MIB associations)
|
||||
|
||||
- In addition, all devices are checked for a MIB matching their sysObjectID.
|
||||
If there is a matching MIB available, it is automatically included.
|
||||
The sysObjectID for each device is now displayed on the overview page:
|
||||
http://your.librenms.server/device/device=XXXX/
|
||||
|
||||
- Note that the above means that no MIB-based polling will occur until the
|
||||
devices in question are rediscovered. If you want to begin MIB-based
|
||||
polling immediately, you must force rediscovery from the web UI, or run it
|
||||
from the CLI using `./discovery.php -h HOSTNAME`
|
||||
|
||||
- During discovery, relevant MIBs are parsed using `snmptranslate`, and the
|
||||
data returned is used to populate a database which guides the poller in
|
||||
what to store. At the moment, only OIDs with Unsigned32 and Counter64
|
||||
data types are parsed.
|
||||
|
||||
- Devices may be excluded from MIB polling by changing the setting in the
|
||||
device edit screen:
|
||||
http://your.librenms.server/device/device=XXXX/tab=edit/section=modules/
|
||||
|
||||
### Polling ###
|
||||
|
||||
- During polling the MIB associations for the device are looked up, and the
|
||||
MIB is polled for current values. You can see the values which LibreNMS
|
||||
has retrieved from the MIB poller in the "Device MIB values" section of
|
||||
http://your.librenms.server/device/device=XXXX/tab=mib/
|
||||
|
||||
- Data from the latest poll is saved in the table `device_oids`, and RRD
|
||||
files are saved in the relevant device directory as
|
||||
mibName-oidName-index.rrd
|
||||
|
||||
### Graphing ###
|
||||
|
||||
- For each graph type defined in the database, a graph will appear in:
|
||||
http://your.librenms.server/device/device=XXXX/tab=graphs/group=mib/
|
||||
- MIB graphs are generated generically by
|
||||
`html/includes/graphs/device/mib.inc.php`
|
||||
There is presently no customisation of graphs available.
|
||||
- If there is only one index under a given OID, it is displayed as a normal
|
||||
line graph; if there multiple OIDs, they are displayed as a stacked graph.
|
||||
At the moment, all indices are placed in the same graph. This is
|
||||
non-optimal for, e.g., wifi controllers with hundreds of APs attached.
|
||||
|
||||
### Alerting ###
|
||||
|
||||
There is no specific support for alerting in the MIB-based polling engine, but
|
||||
the data it collects may be used in alerts. Here's an example of an alert
|
||||
which detects when a Ruckus wireless controller reports meshing disabled on an
|
||||
access point:
|
||||
http://libertysys.com.au/imagebin/3btw98DR.png
|
||||
|
||||
|
||||
## Adding/testing other device types ##
|
||||
|
||||
One of the goals of this work is to help take out the heavy lifting of adding
|
||||
new device types. Even if you want fully-customised graphs or tables, you can
|
||||
still use the MIB-based poller to make it easy to gather the data you want to
|
||||
graph.
|
||||
|
||||
### How to add a new device MIB ###
|
||||
|
||||
1. Ensure the manufacturer's MIB is present in the mibs directory. If you
|
||||
plan to submit your work to LibreNMS, make sure you attribute the source
|
||||
of the MIB, including the exact download URL if possible, or explicit
|
||||
instructions about how to obtain it.
|
||||
2. Check that `snmptranslate -Ts -M mibs -m MODULE | grep mibName` produces
|
||||
a named list of OIDs. See the comments on `snmp_mib_walk()` in
|
||||
`includes/snmp.inc.php` for an example.
|
||||
3. Check that `snmptranslate -Td -On -M mibs -m MODULE MODULE::mibName`
|
||||
produces a parsed description of the OID values. An example can be
|
||||
found in the comments for `snmp_mib_parse()` in `includes/snmp.inc.php`.
|
||||
4. Get the `sysObjectID` from a device, for example:
|
||||
```snmpget -v2c -c public -OUsb -m SNMPv2-MIB -M /opt/librenms/mibs -t 30 hostname sysObjectID.0```
|
||||
5. Ensure `snmptranslate -m all -M /opt/librenms/mibs OID 2>/dev/null`
|
||||
(where OID is the value returned for sysObjectID above) results in a
|
||||
valid name for the MIB. See the comments for `snmp_translate()` in
|
||||
`includes/snmp.inc.php` for an example. If this step fails, it means
|
||||
there is something wrong with the MIB and `net-snmp` cannot parse it.
|
||||
6. Add any additional MIBs you wish to poll for specific device types to
|
||||
`includes/discovery/os/OSNAME.inc.php` by calling `poll_mibs()` with the
|
||||
MIB module and name. See `includes/discovery/os/ruckuswireless.inc.php`
|
||||
for an example.
|
||||
7. That should be all you need to see MIB graphs!
|
||||
8. If you want to develop more customised support for a particular OS, you
|
||||
can follow the above process, then use the resultant data collected by
|
||||
LibreNMS in the RRD files or the database tables `device_oids`
|
||||
|
||||
|
||||
## TODO ##
|
||||
|
||||
What's not included in MIB-based polling at present? These may be present in
|
||||
future versions. Pull requests gratefully accepted!
|
||||
|
||||
- Parse and save integer and timetick data types.
|
||||
- Filter MIBs/OIDs from being polled and/or saved.
|
||||
- Move graphs from the MIB section to elsewhere. e.g. If a device uses a
|
||||
unique MIB for CPU utilisation, we should display it under the relevant
|
||||
health tab.
|
||||
- Combine multiple MIB values into graphs automatically on a predefined or
|
||||
user-defined basis.
|
||||
- Include MIB types in stats submissions.
|
||||
@@ -16,7 +16,7 @@ Either remove mac or xdp depending on which you want.
|
||||
A global map will be drawn from the information in the database, it is worth noting that this could lead to a large network map.
|
||||
Network maps for individual devices are available showing the relationship with other devices.
|
||||
|
||||
One can also specicify the parameters to be used for drawing and updateing the network map.
|
||||
One can also specicify the parameters to be used for drawing and updating the network map.
|
||||
Please see http://visjs.org/docs/network/ for details on the configuration parameters.
|
||||
```php
|
||||
$config['network_map_vis_options'] = '{
|
||||
|
||||
@@ -18,6 +18,27 @@ We also support config versioning within Oxidized, this will allow you to see th
|
||||
$config['oxidized']['features']['versioning'] = true;
|
||||
```
|
||||
|
||||
Oxidized supports various ways to utilise credentials to login to devices, you can specify global username/password within Oxidized, Group level username/password or per device.
|
||||
We currently support sending groups back to Oxidized so that you can then define group credentials within Oxidized. To enable this support please switch on 'Enable the return of groups to Oxidized':
|
||||
|
||||
```php
|
||||
$config['oxidized']['group_support'] = true;
|
||||
```
|
||||
|
||||
You can set a default group that devices will fall back to with:
|
||||
|
||||
```php
|
||||
$config['oxidized']['default_group'] = 'default';
|
||||
```
|
||||
|
||||
To return a group to Oxidized you can do this by matching a regex for either hostname or location. The order is hostname is matched first, if nothing is found then location is attempted.
|
||||
The first match found will be used. To match on the device hostnames that contain 'lon-sw' or if the location contains 'London' then you would place the following within config.php:
|
||||
|
||||
```php
|
||||
$config['oxidized']['group']['hostname'][] = array('regex' => '/^lon-sw/', 'group' => 'london-switches');
|
||||
$config['oxidized']['group']['location'][] = array('regex' => '/london/', 'group' => 'london-switches');
|
||||
```
|
||||
|
||||
### Feeding Oxidized
|
||||
|
||||
Oxidized has support for feeding devices into it via an API call, support for Oxidized has been added to the LibreNMS API. A sample config for Oxidized is provided below.
|
||||
|
||||
@@ -23,15 +23,15 @@ $config['poller_service_single_connection'] = false;
|
||||
```
|
||||
|
||||
## Distributed Polling
|
||||
Distributed polling is possible, and uses the same configuration options as are described for traditional distributed polling, except that the memcached options are not necessary. The database must be acessable from the distributed pollers, and properly configured. Remote access to the RRD directory must also be configured as described in the Distributed Poller documentation. Memcache is not required. Concurrency is managed using mysql GET_LOCK to ensure that devices are only being polled by one device at at time. The poller service is compatible with poller groups.
|
||||
Distributed polling is possible, and uses the same configuration options as are described for traditional distributed polling, except that the memcached options are not necessary. The database must be accessible from the distributed pollers, and properly configured. Remote access to the RRD directory must also be configured as described in the Distributed Poller documentation. Memcache is not required. Concurrency is managed using mysql GET_LOCK to ensure that devices are only being polled by one device at at time. The poller service is compatible with poller groups.
|
||||
|
||||
## Multi-Master MySQL considerations
|
||||
Because locks are not replicated in Multi-Master MySQL configurations, if you are using such a configuration, you will need to make sure that all pollers are using the same MySQL server.
|
||||
|
||||
## Single Connection
|
||||
If you are running MariaDB 10.2 or newer, you can tell poller-service to use a single mysql connectino for managing locks by setting `$config['poller_service_single_connection']` to `true`. *DO NOT* configure this for any version of MariaDB less than 10.2 or any version of MySQL.
|
||||
If you are running MariaDB 10.2 or newer, you can tell poller-service to use a single mysql connection for managing locks by setting `$config['poller_service_single_connection']` to `true`. *DO NOT* configure this for any version of MariaDB less than 10.2 or any version of MySQL.
|
||||
|
||||
## Service Installation
|
||||
An upstart configuration `poller-service.conf` is provided. To install run `ln -s /opt/librenms/poller-service.conf /etc/init/poller-service.conf`. The service will start on boot and can be started manually by running `start poller-service`. If you recieve an error that the service does not exist, run `initctl reload-configuration`. The service is configured to run as the user `librenms` and will fail if that user does not exist.
|
||||
An upstart configuration `poller-service.conf` is provided. To install run `ln -s /opt/librenms/poller-service.conf /etc/init/poller-service.conf`. The service will start on boot and can be started manually by running `start poller-service`. If you receive an error that the service does not exist, run `initctl reload-configuration`. The service is configured to run as the user `librenms` and will fail if that user does not exist.
|
||||
|
||||
An LSB init script `poller-service.init` is also provided. To install run `ln -s /opt/librenms/poller-service.init /etc/init.d/poller-service && update-rc.d poller-service defaults`.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Configuring interface descriptions for parsing.
|
||||
|
||||
LibreNMS includes the ability to parse your interface descriptions for set information to diplay and segement in the WebUI.
|
||||
LibreNMS includes the ability to parse your interface descriptions for set information to diplay and segment in the WebUI.
|
||||
|
||||
The following information is used from interface descriptions:
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ $config['rrdtool_version'] = 1.5;
|
||||
```
|
||||
|
||||
### RRDCached installation CentOS 6
|
||||
This example is based on a fresh LibreNMS install, on a minimimal CentOS 6 installation.
|
||||
This example is based on a fresh LibreNMS install, on a minimal CentOS 6 installation.
|
||||
In this example, we'll use the Repoforge repository.
|
||||
|
||||
```ssh
|
||||
|
||||
@@ -30,6 +30,7 @@ Now configure LibreNMS (make sure you point dir to your smokeping data directory
|
||||
|
||||
```php
|
||||
$config['smokeping']['dir'] = '/opt/smokeping/data';
|
||||
$config['smokeping']['pings'] = 20; // should be equal to "pings" in your smokeping config
|
||||
$config['smokeping']['integration'] = true;
|
||||
```
|
||||
|
||||
@@ -39,6 +40,7 @@ This is quite simple, just point your dir at the smokeping data directory - plea
|
||||
|
||||
```php
|
||||
$config['smokeping']['dir'] = '/opt/smokeping/data';
|
||||
$config['smokeping']['pings'] = 20; // should be equal to "pings" in your smokeping config
|
||||
$config['own_hostname']
|
||||
```
|
||||
|
||||
@@ -148,6 +150,7 @@ Scroll to the bottom, and paste in the following:
|
||||
|
||||
```bash
|
||||
$config['smokeping']['dir'] = '/var/lib/smokeping';
|
||||
$config['smokeping']['pings'] = 20; // should be equal to "pings" in your smokeping config
|
||||
$config['smokeping']['integration'] = true;
|
||||
```
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ Table of Content:
|
||||
# <a name="about">About</a>
|
||||
|
||||
Over the last couple of years, the primary attack vector for internet accounts has been static passwords.
|
||||
Therefore static passwords are no longer suffient to protect unauthorized access to accounts.
|
||||
Therefore static passwords are no longer sufficient to protect unauthorized access to accounts.
|
||||
Two Factor Authentication adds a variable part in authentication procedures.
|
||||
A user is now required to supply a changing 6-digit passcode in addition to it's password to obtain access to the account.
|
||||
|
||||
@@ -33,8 +33,8 @@ RFC4226 suggests a resynchronization attempt in case the passcode mismatches, pr
|
||||
|
||||
## <a name="hotp">Counterbased One-Time-Password (TOTP)</a>
|
||||
|
||||
This type uses an internal counter that needs to be in-synch with the server's counter to successfully authenticate the passcodes.
|
||||
The main advantage over timebased OTP is the attacker doesnt only need to know the Secretkey but also the server's Counter in order to create valid passcodes.
|
||||
This type uses an internal counter that needs to be in sync with the server's counter to successfully authenticate the passcodes.
|
||||
The main advantage over timebased OTP is the attacker doesn't only need to know the Secretkey but also the server's Counter in order to create valid passcodes.
|
||||
RFC4226 suggests a resynchronization attempt in case the passcode mismatches, providing the attacker a range of upto +4 increments from the actual counter to create passcodes.
|
||||
|
||||
# <a name="config">Configuration</a>
|
||||
@@ -44,7 +44,7 @@ Enable Two-Factor:
|
||||
$config['twofactor'] = true;
|
||||
```
|
||||
|
||||
Set throttle-time (in secconds):
|
||||
Set throttle-time (in seconds):
|
||||
```php
|
||||
$config['twofactor_lock'] = 300;
|
||||
```
|
||||
@@ -57,12 +57,12 @@ Create a Two-Factor key:
|
||||
- Go to 'My Settings' (/preferences/)
|
||||
- Choose TwoFactor type
|
||||
- Click on 'Generate TwoFactor Secret Key'
|
||||
- If your browser didnt reload, reload manually
|
||||
- If your browser didn't reload, reload manually
|
||||
- Scan provided QR or click on 'Manual' to see the Key
|
||||
|
||||
## <a name="usage-google">Google Authenticator</a>
|
||||
|
||||
Installation guides for Google Authneticator can be found [here](https://support.google.com/accounts/answer/1066447?hl=en).
|
||||
Installation guides for Google Authenticator can be found [here](https://support.google.com/accounts/answer/1066447?hl=en).
|
||||
|
||||
Usage:
|
||||
- Create a key like described above
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
### January 2016
|
||||
|
||||
#### Bug fixes
|
||||
- Discovery / Polling:
|
||||
- Ignore HC Broadcast and Multicast counters for Cisco SB (PR2552)
|
||||
|
||||
#### Improvements
|
||||
- WebUI:
|
||||
- Converted arp pages to use bootgrid (PR2669)
|
||||
- Updated VMWare listing page (PR2684)
|
||||
- Added detection for:
|
||||
- Added support for Samsung printers (PR2680)
|
||||
- Added support for Canon printers (PR2687)
|
||||
- Misc:
|
||||
- Added option to specify Smokeping ping value (PR2676)
|
||||
|
||||
### December 2015
|
||||
|
||||
#### Bug fixes
|
||||
@@ -35,6 +51,7 @@
|
||||
- Update alert rules to show actual alert rule ID (PR2603)
|
||||
- Initial support added for per user default dashboard (PR2620)
|
||||
- Updated Worldmap to show clusters in red if one device is down (PR2621)
|
||||
- Cleaned up Billing pages (PR2671)
|
||||
- Discovery / Polling
|
||||
- Added traffic bits as default for Cambium devices (PR2525)
|
||||
- Overwrite eth0 port data from UniFi MIBs for AirFibre devices (PR2544)
|
||||
@@ -54,6 +71,7 @@
|
||||
- Updated Fotinet MIBs (PR2529, PR2534)
|
||||
- Cisco SG500 (PR2609)
|
||||
- Updated processor support for Fortigate (PR2613)
|
||||
- Added CPU / Memory support for PBN (PR2672)
|
||||
- Misc:
|
||||
- Updated validation to check for php extension and classes required (PR2602)
|
||||
- Added Radius Authentication support (PR2615)
|
||||
@@ -70,6 +88,7 @@
|
||||
- Fix netcmd.php URI for sub dir installations (PR2428)
|
||||
- Fixed Oxidized fetch config with groups (PR2501)
|
||||
- Fixed background colour to white for some graphs (PR2516)
|
||||
- Added missing Service description on services page (PR2679)
|
||||
- API:
|
||||
- Added missing quotes for MySQL queries (PR2382)
|
||||
- Discovery / Polling:
|
||||
|
||||
@@ -102,7 +102,7 @@ General Guidelines
|
||||
web chat](http://webchat.freenode.net/) and follow the prompts to chat
|
||||
via the web client.
|
||||
|
||||
- Ensure you read the Code Guidelines documention and understand the code
|
||||
- Ensure you read the Code Guidelines documentation and understand the code
|
||||
style that should be adhered to [6].
|
||||
|
||||
|
||||
|
||||
@@ -35,6 +35,9 @@ LibreNMS ships with the following software components:
|
||||
Mika Tuupola <tuupola@appelsiini.net> (@tuupola on github)
|
||||
MIT License
|
||||
|
||||
- influxdb-php
|
||||
https://github.com/influxdb/influxdb-php
|
||||
MIT License
|
||||
|
||||
Other components (needs details filled in):
|
||||
- JpGraph (html/includes/jpgraph): QPL 1.0 license
|
||||
|
||||
@@ -1,100 +0,0 @@
|
||||
## WARNING ##
|
||||
|
||||
MIB-based polling is experimental. It might overload your LibreNMS server,
|
||||
destroy your data, set your routers on fire, and kick your cat. It has been
|
||||
tested against a very limited set of devices (namely Ruckus ZD1000 wireless
|
||||
controllers, and `net-snmp` on Linux). It may fail badly on other hardware.
|
||||
|
||||
The approach taken is fairly basic and I claim no special expertise in
|
||||
understanding MIBs. Most of my understanding of SNMP comes from reading
|
||||
net-snmp man pages, and reverse engineering the output of snmptranslate and
|
||||
snmpwalk and trying to make devices work with LibreNMS. I may have made
|
||||
false assumptions and probably use wrong terminology in many places. Feel
|
||||
free to offer corrections/suggestions via pull requests or email.
|
||||
|
||||
Paul Gear <paul@librenms.org>
|
||||
|
||||
## Overview ##
|
||||
|
||||
MIB-based polling is disabled by default; you must set
|
||||
`$config['poller_modules']['mib'] = 1;`
|
||||
in `config.php` to enable it.
|
||||
|
||||
The components involved in of MIB-based support are:
|
||||
|
||||
### Discovery ###
|
||||
|
||||
- MIB-based detection is not involved; any work done here would have to be
|
||||
duplicated by the poller and thus would only increase load.
|
||||
|
||||
### Polling ###
|
||||
|
||||
- The file `includes/snmp.inc.php` now contains code which can parse MIBs
|
||||
using `snmptranslate` and use the data returned to populate an array
|
||||
which guides the poller in what to store. At the moment, only OIDs with
|
||||
Unsigned32 and Counter64 data types are parsed.
|
||||
- `includes/polling/mib.inc.php` looks for a MIB matching sysObjectID in
|
||||
the MIB directory; if one is found, it:
|
||||
- parses it
|
||||
- walks that MIB on the device
|
||||
- stores any numeric results in individual RRD files
|
||||
- updates/adds graph definitions in the previously-unused graph_types
|
||||
database table
|
||||
- Individual OSes (`includes/polling/os/*.inc.php`) can poll extra MIBs
|
||||
for a given OS by calling `poll_mib()`. At the moment, this actually
|
||||
happens before the general MIB polling.
|
||||
- Devices may be excluded from MIB polling by changing the setting in the
|
||||
device edit screen (`/device/device=ID/tab=edit/section=modules/`)
|
||||
|
||||
### Graphing ###
|
||||
|
||||
- For each graph type defined in the database, a graph will appear in:
|
||||
Device -> Graphs -> MIB
|
||||
- MIB graphs are generated generically by
|
||||
`html/includes/graphs/device/mib.inc.php`
|
||||
- At the moment, all units are placed in the same graph. This is probably
|
||||
non-optimal for, e.g., wifi controllers with hundreds of APs attached.
|
||||
|
||||
## Adding/testing other device types ##
|
||||
|
||||
One of the goals of this work is to help take out the heavy lifting of
|
||||
adding new device types. Even if you want fully customised graphs or
|
||||
tables, you can use the automatic collection of MIBs to make it easy to
|
||||
gather the data you want.
|
||||
|
||||
### How to add a new device MIB ###
|
||||
|
||||
1. Ensure the manufacturer's MIB is present in the mibs directory. If you
|
||||
plan to submit your work to LibreNMS, make sure you attribute the source
|
||||
of the MIB, including the exact download URL.
|
||||
2. Check that `snmptranslate -Ts -M mibs -m MODULE | grep mibName` produces
|
||||
a named list of OIDs. See the comments for `snmp_mib_walk()` in
|
||||
`includes/snmp.inc.php` for an example.
|
||||
3. Check that `snmptranslate -Td -On -M mibs -m MODULE MODULE::mibName`
|
||||
produces a parsed description of the OID values. An example can be
|
||||
found in the comments for `snmp_mib_parse()` in `includes/snmp.inc.php`.
|
||||
4. Get the `sysObjectID` from a device, for example:
|
||||
```snmpget -v2c -c public -OUsb -m SNMPv2-MIB -M /opt/librenms/mibs -t 30 hostname sysObjectID.0```
|
||||
5. Ensure `snmptranslate -m all -M /opt/librenms/mibs OID 2>/dev/null`
|
||||
(where OID is the value returned for sysObjectID above) results in a
|
||||
valid name for the MIB. See the comments for `snmp_translate()` in
|
||||
`includes/snmp.inc.php` for an example. If this step fails, it means
|
||||
there is something wrong with the MIB and `net-snmp` cannot parse it.
|
||||
6. Add any additional MIBs you wish to poll for specific device types to
|
||||
`includes/polling/os/OSNAME.inc.php` by calling `poll_mibs()` with the
|
||||
MIB module and name. See `includes/polling/os/ruckuswireless.inc.php` for
|
||||
an example.
|
||||
7. That should be all you need to see MIB graphs!
|
||||
|
||||
## TODO ##
|
||||
|
||||
- Save the most recent MIB data in the database (including string types
|
||||
which cannot be graphed). Display it in the appropriate places.
|
||||
- Parse and save integer and timetick data types.
|
||||
- Filter MIBs/OIDs from being polled and/or saved.
|
||||
- Move graphs from the MIB section to elsewhere. e.g. There is already
|
||||
specific support for wireless APs - this should be utilised, but isn't
|
||||
yet.
|
||||
- Combine multiple MIB values into graphs automatically on a predefined or
|
||||
user-defined basis.
|
||||
- Include MIB types in stats submissions.
|
||||
@@ -1,20 +0,0 @@
|
||||
- Device support:
|
||||
- Ruckus wireless controllers
|
||||
- Investigate generic device support based on MIBs. It should be
|
||||
possible to do basic graphs based just on the MIB. They would
|
||||
obviously not be as customised as the specifically supported devices
|
||||
but should still be useful to users.
|
||||
|
||||
- Functionality/performance improvements:
|
||||
- Investigate solutions for poller performance improvement.
|
||||
- Investigate solutions for multiple communities per device.
|
||||
- Eliminate interface churn for transient interfaces (e.g. ppp/tun) on
|
||||
net-snmp.
|
||||
|
||||
- Consider adding some non-monitoring administrative functions:
|
||||
- enabling/disabling ports
|
||||
- changing access port VLANs
|
||||
- editing port labels
|
||||
|
||||
- Integrate as many usability improvements as time permits:
|
||||
- Front page: more automation; GUI configuration
|
||||
@@ -69,6 +69,7 @@ Adding the above line to `/etc/snmp/snmpd.conf` and running `service snmpd resta
|
||||
|
||||
In `/etc/php5/apache2/php.ini` and `/etc/php5/cli/php.ini`, ensure date.timezone is set to your preferred time zone. See http://php.net/manual/en/timezones.php for a list of supported timezones. Valid
|
||||
examples are: "America/New York", "Australia/Brisbane", "Etc/UTC".
|
||||
Please also ensure that allow_url_fopen is enabled.
|
||||
|
||||
### Adding the librenms-user ###
|
||||
|
||||
|
||||
@@ -127,6 +127,15 @@ Set `httpd` to start on system boot.
|
||||
**CentOS 7**
|
||||
systemctl enable httpd
|
||||
|
||||
You need to configure snmpd appropriately if you have not already done so. An absolute minimal config for snmpd is:
|
||||
|
||||
rocommunity public 127.0.0.1
|
||||
|
||||
Adding the above line to `/etc/snmp/snmpd.conf` and running `service snmpd restart` will activate this config.
|
||||
|
||||
In `/etc/php.ini`, ensure date.timezone is set to your preferred time zone. See http://php.net/manual/en/timezones.php for a list of supported timezones. Valid
|
||||
examples are: "America/New York", "Australia/Brisbane", "Etc/UTC". Please also ensure that allow_url_fopen is enabled.
|
||||
|
||||
Next, add the following to `/etc/httpd/conf.d/librenms.conf`
|
||||
|
||||
```apache
|
||||
|
||||
@@ -185,7 +185,7 @@ You can disable image lazy loading by setting this to false.
|
||||
```php
|
||||
$config['show_overview_tab'] = TRUE;
|
||||
```
|
||||
Enable or disable the overview tabe for a device.
|
||||
Enable or disable the overview tab for a device.
|
||||
|
||||
```php
|
||||
$config['overview_show_sysDescr'] = TRUE;
|
||||
@@ -359,6 +359,13 @@ $config['smokeping']['dir'] = "/var/lib/smokeping/";
|
||||
```
|
||||
Set the smokeping directory location.
|
||||
|
||||
```php
|
||||
$config['smokeping']['pings'] = 20;
|
||||
```
|
||||
Should be equal to "pings" in your smokeping config. On Debian/Ubuntu, this is set in `/etc/smokeping/config.d/Database`.
|
||||
|
||||
You can also set it to less than the value of "pings" in your smokeping config if you don't want LibreNMS to graph all of the ping data.
|
||||
|
||||
```php
|
||||
$config['nfsen_enable'] = 0;
|
||||
$config['nfsen_split_char'] = "_";
|
||||
|
||||
@@ -54,7 +54,7 @@ if (!$os) {
|
||||
}
|
||||
```
|
||||
|
||||
Here is the file location for polling the new OS within a vendor MIB or a standart one:
|
||||
Here is the file location for polling the new OS within a vendor MIB or a standard one:
|
||||
|
||||
```bash
|
||||
includes/polling/os/pulse.inc.php
|
||||
@@ -73,7 +73,7 @@ Quick explanation and examples :
|
||||
|
||||
```bash
|
||||
snmpwalk -v2c -c public -m SNMPv2-MIB -M mibs
|
||||
//will give the overall OIDs that can be retrieve with this Standart MIB. OID on the left side and the result on the right side
|
||||
//will give the overall OIDs that can be retrieve with this standard MIB. OID on the left side and the result on the right side
|
||||
//Then we have just to pick the wanted OID and do a check
|
||||
|
||||
snmpget -v2c -c public -OUsb -m SNMPv2-MIB -M /opt/librenms/mibs -t 30 HOSTNAME SNMPv2-SMI::mib-2.1.1.0
|
||||
@@ -118,7 +118,7 @@ At first we copy the MIB file into the default directory:
|
||||
|
||||
We are now ready to look at inside the file and find the OID we want to use. _For this documentation we'll use Pulse Secure devices._
|
||||
|
||||
Then we can test it with the snmpget command (hostname must be reachabled):
|
||||
Then we can test it with the snmpget command (hostname must be reachable):
|
||||
|
||||
```bash
|
||||
//for example the OID iveCpuUtil.0:
|
||||
@@ -324,7 +324,7 @@ if (is_numeric($sessions)) {
|
||||
```
|
||||
We finish in the declaration of the two graph types in the database:
|
||||
|
||||
We can do that within a file to share our work and contribute in the developpement of LibreNMS. :-)
|
||||
We can do that within a file to share our work and contribute in the development of LibreNMS. :-)
|
||||
|
||||
```bash
|
||||
sql-schema/xxx.sql
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ if (!$_SESSION['authenticated']) {
|
||||
$type = mres($_POST['type']);
|
||||
|
||||
if ($type == 'placeholder') {
|
||||
$output = "<span style='text-align:left;'><br><h3>Click on Edit-Dashboard to add Widgets</h3><br><h4><strong>Remember:</strong> You can only move & rezise widgets when you're in <strong>Edit-Mode</strong>.</h4><span>";
|
||||
$output = "<span style='text-align:left;'><br><h3>Click on the Edit Dashboard button (next to the list of dashboards) to add widgets</h3><br><h4><strong>Remember:</strong> You can only move & resize widgets when you're in <strong>Edit Mode</strong>.</h4><span>";
|
||||
$status = 'ok';
|
||||
$title = 'Placeholder';
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ if (!$_SESSION['authenticated']) {
|
||||
|
||||
$device = array();
|
||||
$ports = array();
|
||||
$bgp = array();
|
||||
|
||||
if (isset($_REQUEST['search'])) {
|
||||
$search = mres($_REQUEST['search']);
|
||||
|
||||
+2
-10
@@ -12,15 +12,7 @@
|
||||
*/
|
||||
|
||||
|
||||
function utime() {
|
||||
$time = explode(' ', microtime());
|
||||
$usec = (double) $time[0];
|
||||
$sec = (double) $time[1];
|
||||
return ($sec + $usec);
|
||||
|
||||
}
|
||||
|
||||
$start = utime();
|
||||
$start = microtime(true);
|
||||
|
||||
require_once 'Net/IPv4.php';
|
||||
|
||||
@@ -54,7 +46,7 @@ require 'includes/graphs/graph.inc.php';
|
||||
|
||||
$console_color = new Console_Color2();
|
||||
|
||||
$end = utime();
|
||||
$end = microtime(true);
|
||||
$run = ($end - $start);
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.0 KiB |
@@ -831,7 +831,7 @@ function ack_alert() {
|
||||
$status = 'ok';
|
||||
$code = 200;
|
||||
if (dbUpdate(array('state' => 2), 'alerts', '`id` = ? LIMIT 1', array($alert_id))) {
|
||||
$message = 'Alert has been ackgnowledged';
|
||||
$message = 'Alert has been acknowledged';
|
||||
}
|
||||
else {
|
||||
$message = 'No alert by that ID';
|
||||
@@ -944,7 +944,27 @@ function list_oxidized() {
|
||||
$devices = array();
|
||||
$device_types = "'".implode("','", $config['oxidized']['ignore_types'])."'";
|
||||
$device_os = "'".implode("','", $config['oxidized']['ignore_os'])."'";
|
||||
foreach (dbFetchRows("SELECT hostname,os FROM `devices` LEFT JOIN devices_attribs AS `DA` ON devices.device_id = DA.device_id AND `DA`.attrib_type='override_Oxidized_disable' WHERE `status`='1' AND (DA.attrib_value = 'false' OR DA.attrib_value IS NULL) AND (`type` NOT IN ($device_types) AND `os` NOT IN ($device_os))") as $device) {
|
||||
foreach (dbFetchRows("SELECT hostname,os,location FROM `devices` LEFT JOIN devices_attribs AS `DA` ON devices.device_id = DA.device_id AND `DA`.attrib_type='override_Oxidized_disable' WHERE `disabled`='0' AND `ignore` = 0 AND (DA.attrib_value = 'false' OR DA.attrib_value IS NULL) AND (`type` NOT IN ($device_types) AND `os` NOT IN ($device_os))") as $device) {
|
||||
if ($config['oxidized']['group_support'] == "true") {
|
||||
foreach ($config['oxidized']['group']['hostname'] as $host_group) {
|
||||
if (preg_match($host_group['regex'].'i', $device['hostname'])) {
|
||||
$device['group'] = $host_group['group'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (empty($device['group'])) {
|
||||
foreach ($config['oxidized']['group']['location'] as $host_group) {
|
||||
if (preg_match($host_group['regex'].'i', $device['location'])) {
|
||||
$device['group'] = $host_group['group'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (empty($device['group']) && !empty($config['oxidized']['default_group'])) {
|
||||
$device['group'] = $config['oxidized']['default_group'];
|
||||
}
|
||||
}
|
||||
unset($device['location']);
|
||||
$devices[] = $device;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,6 +49,13 @@ if ($device['serial']) {
|
||||
</tr>';
|
||||
}
|
||||
|
||||
if ($device['sysObjectID']) {
|
||||
echo '<tr>
|
||||
<td>Object ID</td>
|
||||
<td>'.$device['sysObjectID'].'</td>
|
||||
</tr>';
|
||||
}
|
||||
|
||||
if ($device['sysContact']) {
|
||||
echo '<tr>
|
||||
<td>Contact</td>';
|
||||
|
||||
@@ -33,7 +33,7 @@ if (isset($_REQUEST['notification_id']) && isset($_REQUEST['action'])) {
|
||||
$status = 'ok';
|
||||
$message = 'Set as Sticky';
|
||||
}
|
||||
elseif ($_SESSION['userlevel'] == 10 && $_REQUEST['action'] == 'unstick' && dbUpdate(array('key'=>'sticky','value'=>0),'notifications_attribs','notifications_id = ? && user_id = ?',array($_REQUEST['notification_id'],$_SESSION['user_id']))) {
|
||||
elseif ($_SESSION['userlevel'] == 10 && $_REQUEST['action'] == 'unstick' && dbDelete('notifications_attribs',"notifications_id = ? && user_id = ? AND `key`='sticky'",array($_REQUEST['notification_id'],$_SESSION['user_id']))) {
|
||||
$status = 'ok';
|
||||
$message = 'Removed Sticky';
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
<?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';
|
||||
|
||||
$device_id = mres($_POST['device_id']);
|
||||
$port_id_notes = mres($_POST['port_id_notes']);
|
||||
$attrib_value = mres($_POST['notes']);
|
||||
|
||||
if (isset($attrib_value) && set_dev_attrib(array('device_id' => $device_id), $port_id_notes, $attrib_value)) {
|
||||
$status = 'ok';
|
||||
$message = 'Updated';
|
||||
}
|
||||
else {
|
||||
$status = 'error';
|
||||
$message = 'ERROR: Could not update';
|
||||
}
|
||||
die(json_encode(array(
|
||||
'status' => $status,
|
||||
'message' => $message,
|
||||
'attrib_type' => $port_id_notes,
|
||||
'attrib_value' => $attrib_value,
|
||||
'device_id' => $device_id
|
||||
|
||||
)));
|
||||
@@ -473,15 +473,22 @@ function generate_lazy_graph_tag($args) {
|
||||
case 'height':
|
||||
$h = $arg;
|
||||
break;
|
||||
case 'lazy_w':
|
||||
$lazy_w = $arg;
|
||||
break;
|
||||
}
|
||||
$urlargs[] = $key."=".urlencode($arg);
|
||||
}
|
||||
|
||||
if(isset($lazy_w)) {
|
||||
$w=$lazy_w;
|
||||
}
|
||||
|
||||
if ($config['enable_lazy_load'] === true) {
|
||||
return '<img class="lazy graphs" width="'.$w.'" height="'.$h.'" data-original="graph.php?' . implode('&',$urlargs).'" border="0" />';
|
||||
return '<img class="lazy img-responsive" data-original="graph.php?' . implode('&',$urlargs).'" border="0" />';
|
||||
}
|
||||
else {
|
||||
return '<img class="graphs" width="'.$w.'" height="'.$h.'" src="graph.php?' . implode('&',$urlargs).'" border="0" />';
|
||||
return '<img class="img-responsive" src="graph.php?' . implode('&',$urlargs).'" border="0" />';
|
||||
}
|
||||
|
||||
}//end generate_lazy_graph_tag()
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS custom graphing
|
||||
*
|
||||
* Author: Paul Gear
|
||||
* Copyright (c) 2015 Gear Consulting Pty Ltd <github@libertysys.com.au>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
// FIXME: Dummy implementation which only supports ruckuswireless processor & mempool
|
||||
|
||||
$i = 0;
|
||||
$rrd_list = array();
|
||||
if ($subtype == 'processor') {
|
||||
$rrd_list[0] = array(
|
||||
'area' => 1,
|
||||
'ds' => 'mibval',
|
||||
'descr' => 'CPU Utilization',
|
||||
'filename' => rrd_name($device['hostname'], array('ruckusZDSystemStats-CPUUtil-0')),
|
||||
);
|
||||
}
|
||||
|
||||
if ($subtype == 'mempool') {
|
||||
$rrd_list[0] = array(
|
||||
'area' => 1,
|
||||
'ds' => 'mibval',
|
||||
'descr' => 'Memory Utilization',
|
||||
'filename' => rrd_name($device['hostname'], array('ruckusZDSystemStats-MemoryUtil-0')),
|
||||
);
|
||||
}
|
||||
|
||||
$units = '%%';
|
||||
$colours = 'mixed';
|
||||
$scale_min = '0';
|
||||
$scale_max = '100';
|
||||
$nototal = 1;
|
||||
|
||||
require_once 'includes/graphs/generic_multi_line.inc.php';
|
||||
@@ -13,25 +13,35 @@
|
||||
*/
|
||||
|
||||
$rrd_list = array();
|
||||
$prefix = rrd_name($device['hostname'], array($subtype, ''), '');
|
||||
foreach (glob($prefix.'*.rrd') as $filename) {
|
||||
$prefix = rrd_name($device['hostname'], array($subtype, ''), '');
|
||||
$filenames = glob($prefix."*.rrd");
|
||||
$count = count($filenames);
|
||||
foreach ($filenames as $filename) {
|
||||
// find out what * expanded to
|
||||
$globpart = str_replace($prefix, '', $filename);
|
||||
// take off the prefix
|
||||
$instance = substr($globpart, 0, -4);
|
||||
// take off ".rrd"
|
||||
$globpart = str_replace($prefix, '', $filename); // take off the prefix
|
||||
$instance = substr($globpart, 0, -4); // take off ".rrd"
|
||||
$ds = array();
|
||||
$mibparts = explode('-', $subtype);
|
||||
$mibvar = end($mibparts);
|
||||
$ds['ds'] = name_shorten($mibvar);
|
||||
$ds['ds'] = 'mibval';
|
||||
$ds['descr'] = "$mibvar-$instance";
|
||||
$ds['filename'] = $filename;
|
||||
$rrd_list[] = $ds;
|
||||
}
|
||||
|
||||
$colours = 'mixed';
|
||||
$scale_min = '0';
|
||||
$nototal = 0;
|
||||
$simple_rrd = true;
|
||||
|
||||
require 'includes/graphs/generic_multi_line.inc.php';
|
||||
// If there are multiple matching files, use a stacked graph instead of a line graph
|
||||
if ($count > 1) {
|
||||
$nototal = 1;
|
||||
$divider = $count;
|
||||
$text_orig = 1;
|
||||
$colours = 'manycolours';
|
||||
include "includes/graphs/generic_multi_simplex_seperated.inc.php";
|
||||
}
|
||||
else {
|
||||
$colours = 'mixed';
|
||||
$nototal = 0;
|
||||
include "includes/graphs/generic_multi_line.inc.php";
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ foreach ($procs as $proc) {
|
||||
|
||||
$unit_text = 'Load %';
|
||||
|
||||
$units = '%';
|
||||
$units = '';
|
||||
$total_units = '%';
|
||||
$colours = 'mixed';
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
// Dear Tobias. You write in Perl, this makes me hate you forever.
|
||||
// This is my translation of Smokeping's graphing.
|
||||
// Thanks to Bill Fenner for Perl->Human translation:>
|
||||
$scale_min = 0;
|
||||
@@ -10,7 +9,7 @@ require 'includes/graphs/common.inc.php';
|
||||
require 'smokeping_common.inc.php';
|
||||
|
||||
$i = 0;
|
||||
$pings = 20;
|
||||
$pings = $config['smokeping']['pings'];
|
||||
$iter = 0;
|
||||
$colourset = 'mixed';
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
// Dear Tobias. You write in Perl, this makes me hate you forever.
|
||||
// This is my translation of Smokeping's graphing.
|
||||
// Thanks to Bill Fenner for Perl->Human translation:>
|
||||
$scale_min = 0;
|
||||
@@ -10,7 +9,7 @@ require 'includes/graphs/common.inc.php';
|
||||
require 'smokeping_common.inc.php';
|
||||
|
||||
$i = 0;
|
||||
$pings = 20;
|
||||
$pings = $config['smokeping']['pings'];
|
||||
$iter = 0;
|
||||
$colourset = 'mixed';
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
$scale_max = 100;
|
||||
|
||||
require 'includes/graphs/common.inc.php';
|
||||
|
||||
$rrdfilename = $config['rrd_dir'].'/'.$device['hostname'].'/sub10systems.rrd';
|
||||
|
||||
|
||||
if (file_exists($rrdfilename)) {
|
||||
$rrd_options .= " COMMENT:' Now Min Max\\n'";
|
||||
$rrd_options .= ' DEF:sub10RadioLclAFER='.$rrdfilename.':sub10RadioLclAFER:AVERAGE ';
|
||||
$rrd_options .= " LINE1:sub10RadioLclAFER#CC0000:'Percent ' ";
|
||||
$rrd_options .= ' GPRINT:sub10RadioLclAFER:LAST:%3.2lf ';
|
||||
$rrd_options .= ' GPRINT:sub10RadioLclAFER:MIN:%3.2lf ';
|
||||
$rrd_options .= ' GPRINT:sub10RadioLclAFER:MAX:%3.2lf\\\l ';
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
// $scale_min = 0;
|
||||
|
||||
require 'includes/graphs/common.inc.php';
|
||||
|
||||
$rrdfilename = $config['rrd_dir'].'/'.$device['hostname'].'/sub10systems.rrd';
|
||||
|
||||
|
||||
if (file_exists($rrdfilename)) {
|
||||
$rrd_options .= " COMMENT:'dBm Now Min Max\\n'";
|
||||
$rrd_options .= ' DEF:sub10RadioLclDataRa='.$rrdfilename.':sub10RadioLclDataRa:AVERAGE ';
|
||||
$rrd_options .= " LINE1:sub10RadioLclDataRa#CC0000:'Tx Power ' ";
|
||||
$rrd_options .= ' GPRINT:sub10RadioLclDataRa:LAST:%3.2lf ';
|
||||
$rrd_options .= ' GPRINT:sub10RadioLclDataRa:MIN:%3.2lf ';
|
||||
$rrd_options .= ' GPRINT:sub10RadioLclDataRa:MAX:%3.2lf\\\l ';
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
require 'includes/graphs/common.inc.php';
|
||||
|
||||
$rrdfilename = $config['rrd_dir'].'/'.$device['hostname'].'/sub10systems.rrd';
|
||||
|
||||
|
||||
if (file_exists($rrdfilename)) {
|
||||
$rrd_options .= " COMMENT:'dB Now Min Max\\n'";
|
||||
$rrd_options .= ' DEF:sub10RadioLclLnkLos='.$rrdfilename.':sub10RadioLclLnkLos:AVERAGE ';
|
||||
$rrd_options .= " LINE1:sub10RadioLclLnkLos#CC0000:'Link Loss ' ";
|
||||
$rrd_options .= ' GPRINT:sub10RadioLclLnkLos:LAST:%3.2lf ';
|
||||
$rrd_options .= ' GPRINT:sub10RadioLclLnkLos:MIN:%3.2lf ';
|
||||
$rrd_options .= ' GPRINT:sub10RadioLclLnkLos:MAX:%3.2lf\\\l ';
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
$scale_max = 0;
|
||||
|
||||
require 'includes/graphs/common.inc.php';
|
||||
|
||||
$rrdfilename = $config['rrd_dir'].'/'.$device['hostname'].'/sub10systems.rrd';
|
||||
|
||||
|
||||
if (file_exists($rrdfilename)) {
|
||||
$rrd_options .= " COMMENT:'dBm Now Min Max\\n'";
|
||||
$rrd_options .= ' DEF:sub10RadioLclRxPowe='.$rrdfilename.':sub10RadioLclRxPowe:AVERAGE ';
|
||||
$rrd_options .= " LINE1:sub10RadioLclRxPowe#CC0000:'Rx Power ' ";
|
||||
$rrd_options .= ' GPRINT:sub10RadioLclRxPowe:LAST:%3.2lf ';
|
||||
$rrd_options .= ' GPRINT:sub10RadioLclRxPowe:MIN:%3.2lf ';
|
||||
$rrd_options .= ' GPRINT:sub10RadioLclRxPowe:MAX:%3.2lf\\\l ';
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
$scale_min = 0;
|
||||
|
||||
require 'includes/graphs/common.inc.php';
|
||||
|
||||
$rrdfilename = $config['rrd_dir'].'/'.$device['hostname'].'/sub10systems.rrd';
|
||||
|
||||
|
||||
if (file_exists($rrdfilename)) {
|
||||
$rrd_options .= " COMMENT:'dBm Now Min Max\\n'";
|
||||
$rrd_options .= ' DEF:sub10RadioLclTxPowe='.$rrdfilename.':sub10RadioLclTxPowe:AVERAGE ';
|
||||
$rrd_options .= " LINE1:sub10RadioLclTxPowe#CC0000:'Tx Power ' ";
|
||||
$rrd_options .= ' GPRINT:sub10RadioLclTxPowe:LAST:%3.2lf ';
|
||||
$rrd_options .= ' GPRINT:sub10RadioLclTxPowe:MIN:%3.2lf ';
|
||||
$rrd_options .= ' GPRINT:sub10RadioLclTxPowe:MAX:%3.2lf\\\l ';
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
$scale_max = 0;
|
||||
|
||||
require 'includes/graphs/common.inc.php';
|
||||
|
||||
$rrdfilename = $config['rrd_dir'].'/'.$device['hostname'].'/sub10systems.rrd';
|
||||
|
||||
|
||||
if (file_exists($rrdfilename)) {
|
||||
$rrd_options .= " COMMENT:'dB Now Min Max\\n'";
|
||||
$rrd_options .= ' DEF:sub10RadioLclVectEr='.$rrdfilename.':sub10RadioLclVectEr:AVERAGE ';
|
||||
$rrd_options .= " LINE1:sub10RadioLclVectEr#CC0000:'Vector Error ' ";
|
||||
$rrd_options .= ' GPRINT:sub10RadioLclVectEr:LAST:%3.2lf ';
|
||||
$rrd_options .= ' GPRINT:sub10RadioLclVectEr:MIN:%3.2lf ';
|
||||
$rrd_options .= ' GPRINT:sub10RadioLclVectEr:MAX:%3.2lf\\\l ';
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -123,9 +123,9 @@ if ($config['rrdgraph_real_95th']) {
|
||||
$rrd_options .= " GPRINT:95thhigh:\"%30.2lf%s\\n\"";
|
||||
}
|
||||
|
||||
$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:tot:'Total %6.2lf%sB'";
|
||||
$rrd_options .= " GPRINT:totin:'(In %6.2lf%sB'";
|
||||
$rrd_options .= " GPRINT:totout:'Out %6.2lf%sB)\\l'";
|
||||
$rrd_options .= ' LINE1:95thin#aa0000';
|
||||
$rrd_options .= ' LINE1:d95thout#aa0000';
|
||||
|
||||
|
||||
@@ -36,6 +36,9 @@ foreach ($rrd_list as $rrd) {
|
||||
}
|
||||
|
||||
$colour = $config['graph_colours'][$colours][$iter];
|
||||
if (!empty($rrd['area']) && empty($rrd['areacolour'])) {
|
||||
$rrd['areacolour'] = $colour."20";
|
||||
}
|
||||
|
||||
$ds = $rrd['ds'];
|
||||
$filename = $rrd['filename'];
|
||||
@@ -69,8 +72,8 @@ foreach ($rrd_list as $rrd) {
|
||||
}
|
||||
}
|
||||
|
||||
$rrd_optionsb .= ' GPRINT:'.$id.':LAST:%5.2lf%s GPRINT:'.$id.'min:MIN:%5.2lf%s';
|
||||
$rrd_optionsb .= ' GPRINT:'.$id.'max:MAX:%5.2lf%s GPRINT:'.$id.":AVERAGE:'%5.2lf%s\\n'";
|
||||
$rrd_optionsb .= ' GPRINT:'.$id.':LAST:%5.2lf%s'.$units.' GPRINT:'.$id.'min:MIN:%5.2lf%s'.$units;
|
||||
$rrd_optionsb .= ' GPRINT:'.$id.'max:MAX:%5.2lf%s'.$units.' GPRINT:'.$id.":AVERAGE:'%5.2lf%s$units\\n'";
|
||||
|
||||
$i++;
|
||||
$iter++;
|
||||
|
||||
@@ -43,12 +43,15 @@ if ($auth !== true && $auth != 1) {
|
||||
|
||||
require $config['install_dir']."/html/includes/graphs/$type/auth.inc.php";
|
||||
|
||||
if ($auth === true && is_file($config['install_dir']."/html/includes/graphs/$type/$subtype.inc.php")) {
|
||||
include $config['install_dir']."/html/includes/graphs/$type/$subtype.inc.php";
|
||||
if ($auth === true && is_custom_graph($type, $subtype, $device)) {
|
||||
include($config['install_dir'] . "/html/includes/graphs/custom.inc.php");
|
||||
}
|
||||
else if ($auth === true && is_mib_graph($type, $subtype)) {
|
||||
include $config['install_dir']."/html/includes/graphs/$type/mib.inc.php";
|
||||
}
|
||||
elseif ($auth === true && is_file($config['install_dir']."/html/includes/graphs/$type/$subtype.inc.php")) {
|
||||
include $config['install_dir']."/html/includes/graphs/$type/$subtype.inc.php";
|
||||
}
|
||||
else {
|
||||
graph_error("$type*$subtype ");
|
||||
// Graph Template Missing");
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
$src = device_by_id_cache($_GET['src']);
|
||||
|
||||
// Dear Tobias. You write in Perl, this makes me hate you forever.
|
||||
// This is my translation of Smokeping's graphing.
|
||||
// Thanks to Bill Fenner for Perl->Human translation:>
|
||||
$scale_min = 0;
|
||||
@@ -12,7 +11,7 @@ require 'includes/graphs/common.inc.php';
|
||||
require 'smokeping_common.inc.php';
|
||||
|
||||
$i = 0;
|
||||
$pings = 20;
|
||||
$pings = $config['smokeping']['pings'];
|
||||
$iter = 0;
|
||||
$colourset = 'mixed';
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
$dest = device_by_id_cache($_GET['dest']);
|
||||
|
||||
// Dear Tobias. You write in Perl, this makes me hate you forever.
|
||||
// This is my translation of Smokeping's graphing.
|
||||
// Thanks to Bill Fenner for Perl->Human translation:>
|
||||
$scale_min = 0;
|
||||
@@ -12,7 +11,7 @@ require 'includes/graphs/common.inc.php';
|
||||
require 'smokeping_common.inc.php';
|
||||
|
||||
$i = 0;
|
||||
$pings = 20;
|
||||
$pings = $config['smokeping']['pings'];
|
||||
$iter = 0;
|
||||
$colourset = 'mixed';
|
||||
|
||||
|
||||
@@ -18,9 +18,9 @@ echo '<div class="panel panel-default">
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
';
|
||||
|
||||
echo "<div class='row'>";
|
||||
require 'includes/print-graphrow.inc.php';
|
||||
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
$g_i++;
|
||||
|
||||
@@ -71,6 +71,8 @@ foreach ($periods as $period) {
|
||||
$graph_data[] = overlib_link($link, generate_lazy_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL);
|
||||
}
|
||||
else {
|
||||
echo "<div class='col-md-3'>";
|
||||
echo(overlib_link($link, generate_lazy_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL));
|
||||
echo "</div>";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ else {
|
||||
}
|
||||
|
||||
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)."'\">";
|
||||
<td valign=top width=350>";
|
||||
|
||||
// Don't echo out ports ifIndex if it's a NOS device since their ifIndex is, for lack of better words....different
|
||||
if ($device['os'] == 'nos') {
|
||||
|
||||
@@ -110,6 +110,14 @@ if ( dbFetchCell("SELECT 1 from `packages` LIMIT 1") ) {
|
||||
<li><a href="<?php echo(generate_url(array('page'=>'search','search'=>'ipv6'))); ?>"><i class="fa fa-search fa-fw fa-lg"></i> IPv6 Search</a></li>
|
||||
<li><a href="<?php echo(generate_url(array('page'=>'search','search'=>'mac'))); ?>"><i class="fa fa-search fa-fw fa-lg"></i> MAC Search</a></li>
|
||||
<li><a href="<?php echo(generate_url(array('page'=>'search','search'=>'arp'))); ?>"><i class="fa fa-search fa-fw fa-lg"></i> ARP Tables</a></li>
|
||||
<?php
|
||||
if (is_module_enabled('poller', 'mib')) {
|
||||
?>
|
||||
<li role="presentation" class="divider"></li>
|
||||
<li><a href="<?php echo(generate_url(array('page'=>'mibs'))); ?>"><i class="fa fa-file-text-o fa-fw fa-lg"></i> MIB definitions</a></li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
@@ -166,8 +174,13 @@ if ($_SESSION['userlevel'] >= '10') {
|
||||
');
|
||||
}
|
||||
echo '
|
||||
<li role="presentation" class="divider"></li>';
|
||||
if (is_module_enabled('poller', 'mib')) {
|
||||
echo '
|
||||
<li><a href='.generate_url(array('page'=>'mib_assoc')).'><i class="fa fa-file-text-o fa-fw fa-lg"></i> MIB associations</a></li>
|
||||
<li role="presentation" class="divider"></li>
|
||||
';
|
||||
}
|
||||
|
||||
if ($config['navbar']['manage_groups']['hide'] === 0) {
|
||||
echo '<li><a href="'.generate_url(array('page'=>'device-groups')).'"><i class="fa fa-th fa-fw fa-lg"></i> Manage Groups</a></li>';
|
||||
|
||||
@@ -24,6 +24,9 @@ else if ($service[service_status] == '2') {
|
||||
$message = trim($service['service_message']);
|
||||
$message = str_replace("\n", '<br />', $message);
|
||||
|
||||
$desc = trim($service['service_desc']);
|
||||
$desc = str_replace("\n", '<br />', $desc);
|
||||
|
||||
$since = (time() - $service['service_changed']);
|
||||
$since = formatUptime($since);
|
||||
|
||||
@@ -63,6 +66,9 @@ echo "
|
||||
<td>
|
||||
<span class=box-desc>$message</span>
|
||||
</td>
|
||||
<td>
|
||||
<span class=box-desc>$desc</span>
|
||||
</td>
|
||||
</tr>";
|
||||
|
||||
$i++;
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
$stp_raw = dbFetchRow('SELECT * FROM `stp` WHERE `device_id` = ?', array($device['device_id']));
|
||||
$stp = array (
|
||||
'Root bridge' => ($stp_raw['rootBridge'] == 1) ? 'Yes' : 'No',
|
||||
'Bridge address (MAC)' => $stp_raw['bridgeAddress'],
|
||||
'Protocol specification' => $stp_raw['protocolSpecification'],
|
||||
'Priority (0-61440)' => $stp_raw['priority'],
|
||||
'Time since topology change' => formatUptime($stp_raw['timeSinceTopologyChange']),
|
||||
'Topology changes' => $stp_raw['topChanges'],
|
||||
'Designated root (MAC)' => $stp_raw['designatedRoot'],
|
||||
'Root cost' => $stp_raw['rootCost'],
|
||||
'Root port' => $stp_raw['rootPort'],
|
||||
'Max age (s)' => $stp_raw['maxAge'],
|
||||
'Hello time (s)' => $stp_raw['helloTime'],
|
||||
'Hold time (s)' => $stp_raw['holdTime'],
|
||||
'Forward delay (s)' => $stp_raw['forwardDelay'],
|
||||
'Bridge max age (s)' => $stp_raw['bridgeMaxAge'],
|
||||
'Bridge hello time (s)' => $stp_raw['bridgeHelloTime'],
|
||||
'Bridge forward delay (s)' => $stp_raw['bridgeForwardDelay']
|
||||
);
|
||||
foreach (array_keys($stp) as $key) {
|
||||
echo "
|
||||
<tr>
|
||||
<td width=280 class=list-large>$key</td>
|
||||
<td class=box-desc>$stp[$key]</td>
|
||||
</tr>
|
||||
";
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
<?php
|
||||
|
||||
echo '<tr class="list">';
|
||||
|
||||
echo '<td class="list">';
|
||||
|
||||
if (getidbyname($vm['vmwVmDisplayName'])) {
|
||||
@@ -12,7 +10,13 @@ else {
|
||||
}
|
||||
|
||||
echo '</td>';
|
||||
echo '<td class="list">'.$vm['vmwVmState'].'</td>';
|
||||
|
||||
if ($vm['vmwVmState'] == 'powered off') {
|
||||
echo '<td class="list"><span style="min-width:40px; display:inline-block;" class="label label-default">OFF</span></td>';
|
||||
}
|
||||
else {
|
||||
echo '<td class="list"><span style="min-width:40px; display:inline-block;" class="label label-success">ON</span></td>';
|
||||
}
|
||||
|
||||
if ($vm['vmwVmGuestOS'] == 'E: tools not installed') {
|
||||
echo '<td class="box-desc">Unknown (VMware Tools not installed)</td>';
|
||||
|
||||
@@ -12,20 +12,35 @@ if (is_admin() === false && is_read() === false) {
|
||||
|
||||
$sql .= " WHERE M.port_id = P.port_id AND P.device_id = D.device_id $where ";
|
||||
|
||||
if (isset($_POST['searchby']) && $_POST['searchby'] == 'ip') {
|
||||
$sql .= ' AND `ipv4_address` LIKE ?';
|
||||
$param[] = '%'.trim($_POST['address']).'%';
|
||||
}
|
||||
else if (isset($_POST['searchby']) && $_POST['searchby'] == 'mac') {
|
||||
$sql .= ' AND `mac_address` LIKE ?';
|
||||
$param[] = '%'.str_replace(array(':', ' ', '-', '.', '0x'), '', mres($_POST['address'])).'%';
|
||||
}
|
||||
|
||||
if (is_numeric($_POST['device_id'])) {
|
||||
$sql .= ' AND P.device_id = ?';
|
||||
$param[] = $_POST['device_id'];
|
||||
}
|
||||
|
||||
if (is_numeric($_POST['port_id'])) {
|
||||
$sql .= ' AND P.port_id = ?';
|
||||
$param[] = $_POST['port_id'];
|
||||
}
|
||||
|
||||
if (isset($_POST['searchPhrase']) && !empty($_POST['searchPhrase'])) {
|
||||
$ip_search = '%'.mres(trim($_POST['searchPhrase'])).'%';
|
||||
$mac_search = '%'.str_replace(array(':', ' ', '-', '.', '0x'), '', mres($_POST['searchPhrase'])).'%';
|
||||
|
||||
if (isset($_POST['searchby']) && $_POST['searchby'] == 'ip') {
|
||||
$sql .= ' AND `ipv4_address` LIKE ?';
|
||||
$param[] = $ip_search;
|
||||
}
|
||||
else if (isset($_POST['searchby']) && $_POST['searchby'] == 'mac') {
|
||||
$sql .= ' AND `mac_address` LIKE ?';
|
||||
$param[] = $mac_search;
|
||||
}
|
||||
else {
|
||||
$sql .= ' AND (`ipv4_address` LIKE ? OR `mac_address` LIKE ?)';
|
||||
$param[] = $ip_search;
|
||||
$param[] = $mac_search;
|
||||
}
|
||||
}
|
||||
|
||||
$count_sql = "SELECT COUNT(`M`.`port_id`) $sql";
|
||||
|
||||
$total = dbFetchCell($count_sql, $param);
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS device MIB association browser
|
||||
*
|
||||
* Copyright (c) 2015 Gear Consulting Pty Ltd <github@libertysys.com.au>
|
||||
*
|
||||
* by Paul Gear
|
||||
* based on code by Søren Friis Rosiak <sorenrosiak@gmail.com>
|
||||
* in commit 054bf3ae209f34a2c3bc8968300722004903df1b
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
$columns = array(
|
||||
'module',
|
||||
'mib',
|
||||
'included_by',
|
||||
'last_modified',
|
||||
);
|
||||
|
||||
if (isset($_POST['device_id'])) {
|
||||
// device_id supplied - get details for a single device
|
||||
// used by device MIB page
|
||||
$params = array(
|
||||
$_POST['device_id'],
|
||||
);
|
||||
$sql = 'SELECT * FROM `device_mibs`';
|
||||
$wheresql = ' WHERE `device_id` = ?';
|
||||
$sortcolumns = 3;
|
||||
$count_sql = "SELECT COUNT(*) FROM `device_mibs`".$wheresql;
|
||||
}
|
||||
else {
|
||||
// device_id not supplied - get details for a all devices
|
||||
// used by all device MIBs page
|
||||
$params = array();
|
||||
$sql = 'SELECT `d`.`hostname` as `hostname`, `dm`.* FROM `devices` `d`, `device_mibs` `dm`';
|
||||
$wheresql = ' WHERE `d`.`device_id` = `dm`.`device_id`';
|
||||
array_unshift($columns, 'hostname');
|
||||
$sortcolumns = 4;
|
||||
$count_sql = "SELECT COUNT(*) FROM `devices` `d`, `device_mibs` `dm`".$wheresql;
|
||||
}
|
||||
|
||||
// all columns are searchable - search across them
|
||||
if (isset($searchPhrase) && !empty($searchPhrase)) {
|
||||
$searchsql = implode(' OR ', array_map("search_phrase_column", array_map("mres", $columns)));
|
||||
$wheresql .= " AND ( $searchsql )";
|
||||
}
|
||||
$sql .= $wheresql;
|
||||
|
||||
// get total
|
||||
$total = dbFetchCell($count_sql, $params);
|
||||
if (empty($total)) {
|
||||
$total = 0;
|
||||
}
|
||||
|
||||
// set up default sort
|
||||
if (!isset($sort) || empty($sort)) {
|
||||
$sort = implode(', ', array_map("mres", array_slice($columns, 0, $sortcolumns)));
|
||||
}
|
||||
$sql .= " ORDER BY $sort";
|
||||
|
||||
// select only the required rows
|
||||
if (isset($current)) {
|
||||
$limit_low = (($current * $rowCount) - ($rowCount));
|
||||
$limit_high = $rowCount;
|
||||
}
|
||||
if ($rowCount != -1) {
|
||||
$sql .= " LIMIT $limit_low,$limit_high";
|
||||
}
|
||||
|
||||
// load data from database into response array
|
||||
$response = array();
|
||||
foreach (dbFetchRows($sql, $params) as $mib) {
|
||||
$mibrow = array();
|
||||
foreach ($columns as $col) {
|
||||
$mibrow[$col] = $mib[$col];
|
||||
}
|
||||
if (!isset($_POST['device_id'])) {
|
||||
$device = device_by_id_cache($mib['device_id']);
|
||||
$mibrow['hostname'] = generate_device_link($device,
|
||||
$mib['hostname'], array('tab' => 'mib'));
|
||||
}
|
||||
$response[] = $mibrow;
|
||||
}
|
||||
|
||||
$output = array(
|
||||
'current' => $current,
|
||||
'rowCount' => $rowCount,
|
||||
'rows' => $response,
|
||||
'total' => $total,
|
||||
);
|
||||
echo _json_encode($output);
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS device MIB OID browser
|
||||
*
|
||||
* Copyright (c) 2015 Gear Consulting Pty Ltd <github@libertysys.com.au>
|
||||
*
|
||||
* by Paul Gear
|
||||
* based on code by Søren Friis Rosiak <sorenrosiak@gmail.com>
|
||||
* in commit 054bf3ae209f34a2c3bc8968300722004903df1b
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
$columns = array(
|
||||
'module',
|
||||
'mib',
|
||||
'object_type',
|
||||
'oid',
|
||||
'value',
|
||||
'numvalue',
|
||||
'last_modified',
|
||||
);
|
||||
|
||||
|
||||
$params = array(
|
||||
$_POST['device_id'],
|
||||
);
|
||||
|
||||
// start of sql definition
|
||||
$sql = 'SELECT * FROM `device_oids`';
|
||||
|
||||
$wheresql = ' WHERE `device_id` = ?';
|
||||
|
||||
// all columns are searchable - search across them
|
||||
if (isset($searchPhrase) && !empty($searchPhrase)) {
|
||||
$searchsql = implode(' OR ', array_map("search_phrase_column", array_map("mres", $columns)));
|
||||
$wheresql .= " AND ( $searchsql )";
|
||||
}
|
||||
$sql .= $wheresql;
|
||||
|
||||
// get total
|
||||
$count_sql = "SELECT COUNT(*) FROM `device_oids`".$wheresql;
|
||||
$total = dbFetchCell($count_sql, $params);
|
||||
if (empty($total)) {
|
||||
$total = 0;
|
||||
}
|
||||
|
||||
// sort by first three columns by default
|
||||
if (!isset($sort) || empty($sort)) {
|
||||
$sort = implode(', ', array_map("mres", array_slice($columns, 0, 3)));
|
||||
}
|
||||
$sql .= " ORDER BY $sort";
|
||||
|
||||
// select only the required rows
|
||||
if (isset($current)) {
|
||||
$limit_low = (($current * $rowCount) - ($rowCount));
|
||||
$limit_high = $rowCount;
|
||||
}
|
||||
if ($rowCount != -1) {
|
||||
$sql .= " LIMIT $limit_low,$limit_high";
|
||||
}
|
||||
|
||||
// load data from database into response array
|
||||
$response = array();
|
||||
foreach (dbFetchRows($sql, $params) as $mib) {
|
||||
$mibrow = array();
|
||||
foreach ($columns as $col) {
|
||||
$mibrow[$col] = $mib[$col];
|
||||
}
|
||||
$response[] = $mibrow;
|
||||
}
|
||||
|
||||
$output = array(
|
||||
'current' => $current,
|
||||
'rowCount' => $rowCount,
|
||||
'rows' => $response,
|
||||
'total' => $total,
|
||||
);
|
||||
echo _json_encode($output);
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* LibreNMS MIB definition browser
|
||||
*
|
||||
* Copyright (c) 2015 Gear Consulting Pty Ltd <github@libertysys.com.au>
|
||||
*
|
||||
* by Paul Gear
|
||||
* based on code by Søren Friis Rosiak <sorenrosiak@gmail.com>
|
||||
* in commit 054bf3ae209f34a2c3bc8968300722004903df1b
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
$columns = array(
|
||||
'module',
|
||||
'mib',
|
||||
'object_type',
|
||||
'oid',
|
||||
'syntax',
|
||||
'description',
|
||||
'max_access',
|
||||
'status',
|
||||
'included_by',
|
||||
'last_modified',
|
||||
);
|
||||
|
||||
|
||||
// start of sql definition
|
||||
$sql = 'SELECT * FROM `mibdefs`';
|
||||
|
||||
// all columns are searchable - search across them
|
||||
if (isset($searchPhrase) && !empty($searchPhrase)) {
|
||||
$searchsql = implode(' OR ', array_map("search_phrase_column", array_map("mres", $columns)));
|
||||
$wheresql .= " WHERE ( $searchsql )";
|
||||
$sql .= $wheresql;
|
||||
}
|
||||
|
||||
// get total
|
||||
$count_sql = "SELECT COUNT(`object_type`) FROM `mibdefs`".$wheresql;
|
||||
$total = dbFetchCell($count_sql);
|
||||
if (empty($total)) {
|
||||
$total = 0;
|
||||
}
|
||||
|
||||
// sort by first three columns by default
|
||||
if (!isset($sort) || empty($sort)) {
|
||||
$sort = implode(', ', array_map("mres", array_slice($columns, 0, 3)));
|
||||
}
|
||||
$sql .= " ORDER BY $sort";
|
||||
|
||||
// select only the required rows
|
||||
if (isset($current)) {
|
||||
$limit_low = (($current * $rowCount) - ($rowCount));
|
||||
$limit_high = $rowCount;
|
||||
}
|
||||
if ($rowCount != -1) {
|
||||
$sql .= " LIMIT $limit_low,$limit_high";
|
||||
}
|
||||
|
||||
// load data from database into response array
|
||||
$response = array();
|
||||
foreach (dbFetchRows($sql) as $mib) {
|
||||
$mibrow = array();
|
||||
foreach ($columns as $col) {
|
||||
$mibrow[$col] = $mib[$col];
|
||||
}
|
||||
$response[] = $mibrow;
|
||||
}
|
||||
|
||||
$output = array(
|
||||
'current' => $current,
|
||||
'rowCount' => $rowCount,
|
||||
'rows' => $response,
|
||||
'total' => $total,
|
||||
);
|
||||
echo _json_encode($output);
|
||||
+2
-2
@@ -72,7 +72,7 @@ $config['memcached']['ttl'] = $config['time']['now']+300;
|
||||
|
||||
Plugins::start();
|
||||
|
||||
$runtime_start = utime();
|
||||
$runtime_start = microtime(true);
|
||||
|
||||
ob_start();
|
||||
|
||||
@@ -263,7 +263,7 @@ else {
|
||||
</div>
|
||||
<?php
|
||||
|
||||
$runtime_end = utime();
|
||||
$runtime_end = microtime(true);
|
||||
$runtime = $runtime_end - $runtime_start;
|
||||
$gentime = substr($runtime, 0, 5);
|
||||
|
||||
|
||||
+11
-4
@@ -15,8 +15,13 @@ if(file_exists('../config.php') && $stage != "6") {
|
||||
}
|
||||
|
||||
// List of php modules we expect to see
|
||||
$modules = array('gd','mysql','snmp','mcrypt');
|
||||
|
||||
// $version_id = $major_version * 10000 + $minor_version * 100 + $release_version;
|
||||
if (PHP_VERSION_ID < 70000) {
|
||||
$modules = array('gd','mysql','snmp','mcrypt');
|
||||
}
|
||||
else {
|
||||
$modules = array('gd','mysqli','snmp','mcrypt');
|
||||
}
|
||||
$dbhost = @$_POST['dbhost'] ?: 'localhost';
|
||||
$dbuser = @$_POST['dbuser'] ?: 'librenms';
|
||||
$dbpass = @$_POST['dbpass'] ?: '';
|
||||
@@ -231,7 +236,7 @@ if($stage == 0) {
|
||||
<td>pear</td>
|
||||
<td>$ext_loaded</td>");
|
||||
if($ext_loaded == 'no') {
|
||||
echo("<td>apt-get install php5-$extension / yum install php-$extension</td>");
|
||||
echo("<td>apt-get install php-pear / yum install php-pear</td>");
|
||||
}
|
||||
else {
|
||||
echo("<td></td>");
|
||||
@@ -537,7 +542,9 @@ elseif($stage == "6") {
|
||||
<div class="col-md-3">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="alert alert-success">Thank you for setting up LibreNMS, you can now click <a href="/">here to login to your new install.</a></div>
|
||||
<div class="alert alert-success">Thank you for setting up LibreNMS.<br />
|
||||
It would be great if you would consider contributing to our statistics, you can do this on the <a href="about/">/about/</a> page and check the box under Statistics.<br />
|
||||
You can now click <a href="/">here to login to your new install.</a></div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
</div>
|
||||
|
||||
@@ -145,14 +145,15 @@ echo "
|
||||
|
||||
<h3>LibreNMS is an autodiscovering PHP/MySQL-based network monitoring system.</h3>
|
||||
<?php
|
||||
$versions = version_info();
|
||||
$project_name = $config['project_name'];
|
||||
$project_version = $config['version'];
|
||||
$apache_version = str_replace('Apache/', '', $_SERVER['SERVER_SOFTWARE']);
|
||||
$php_version = phpversion();
|
||||
$mysql_version = dbFetchCell('SELECT version()');
|
||||
$netsnmp_version = shell_exec($config['snmpget'].' --version 2>&1');
|
||||
$rrdtool_version = implode(' ', array_slice(explode(' ', shell_exec($config['rrdtool'].' --version |head -n1')), 1, 1));
|
||||
$schema_version = dbFetchCell('SELECT version FROM dbSchema');
|
||||
$php_version = $versions['php_ver'];
|
||||
$mysql_version = $versions['mysql_ver'];
|
||||
$netsnmp_version = $versions['netsnmp_ver'];
|
||||
$rrdtool_version = $versions['rrdtool_ver'];
|
||||
$schema_version = $versions['db_schema'];
|
||||
$version = `git rev-parse --short HEAD`;
|
||||
|
||||
|
||||
|
||||
@@ -29,6 +29,6 @@
|
||||
You are about to delete this bill.
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<button id="deleteBtn" type="submit" class="btn btn-danger" disabled="disabled"><i class="icon-trash icon-white"></i> <strong>Delete Bill</strong></button>
|
||||
<button id="deleteBtn" type="submit" class="btn btn-danger" disabled="disabled"><i class="fa fa-trash"></i> <strong>Delete Bill</strong></button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
+202
-191
@@ -1,123 +1,123 @@
|
||||
<?php
|
||||
|
||||
require 'includes/javascript-interfacepicker.inc.php';
|
||||
|
||||
// This needs more verification. Is it already added? Does it exist?
|
||||
// Calculation to extract MB/GB/TB of Kbps/Mbps/Gbps
|
||||
$base = $config['billing']['base'];
|
||||
|
||||
if ($bill_data['bill_type'] == 'quota') {
|
||||
$data = $bill_data['bill_quota'];
|
||||
$tmp['mb'] = ($data / $base / $base);
|
||||
$tmp['gb'] = ($data / $base / $base / $base);
|
||||
$tmp['tb'] = ($data / $base / $base / $base / $base);
|
||||
if ($tmp['tb'] >= 1) {
|
||||
$quota = array(
|
||||
'type' => 'tb',
|
||||
'select_tb' => ' selected',
|
||||
'data' => $tmp['tb'],
|
||||
);
|
||||
}
|
||||
else if (($tmp['gb'] >= 1) and ($tmp['gb'] < $base)) {
|
||||
$quota = array(
|
||||
'type' => 'gb',
|
||||
'select_gb' => ' selected',
|
||||
'data' => $tmp['gb'],
|
||||
);
|
||||
}
|
||||
else if (($tmp['mb'] >= 1) and ($tmp['mb'] < $base)) {
|
||||
$quota = array(
|
||||
'type' => 'mb',
|
||||
'select_mb' => ' selected',
|
||||
'data' => $tmp['mb'],
|
||||
);
|
||||
}
|
||||
}//end if
|
||||
|
||||
if ($bill_data['bill_type'] == 'cdr') {
|
||||
$data = $bill_data['bill_cdr'];
|
||||
$tmp['kbps'] = ($data / $base);
|
||||
$tmp['mbps'] = ($data / $base / $base);
|
||||
$tmp['gbps'] = ($data / $base / $base / $base);
|
||||
if ($tmp['gbps'] >= 1) {
|
||||
$cdr = array(
|
||||
'type' => 'gbps',
|
||||
'select_gbps' => ' selected',
|
||||
'data' => $tmp['gbps'],
|
||||
);
|
||||
}
|
||||
else if (($tmp['mbps'] >= 1) and ($tmp['mbps'] < $base)) {
|
||||
$cdr = array(
|
||||
'type' => 'mbps',
|
||||
'select_mbps' => ' selected',
|
||||
'data' => $tmp['mbps'],
|
||||
);
|
||||
}
|
||||
else if (($tmp['kbps'] >= 1) and ($tmp['kbps'] < $base)) {
|
||||
$cdr = array(
|
||||
'type' => 'kbps',
|
||||
'select_kbps' => ' selected',
|
||||
'data' => $tmp['kbps'],
|
||||
);
|
||||
}
|
||||
}//end if
|
||||
|
||||
?>
|
||||
|
||||
require 'includes/javascript-interfacepicker.inc.php';
|
||||
|
||||
// This needs more verification. Is it already added? Does it exist?
|
||||
// Calculation to extract MB/GB/TB of Kbps/Mbps/Gbps
|
||||
$base = $config['billing']['base'];
|
||||
|
||||
if ($bill_data['bill_type'] == 'quota') {
|
||||
$data = $bill_data['bill_quota'];
|
||||
$tmp['mb'] = ($data / $base / $base);
|
||||
$tmp['gb'] = ($data / $base / $base / $base);
|
||||
$tmp['tb'] = ($data / $base / $base / $base / $base);
|
||||
if ($tmp['tb'] >= 1) {
|
||||
$quota = array(
|
||||
'type' => 'tb',
|
||||
'select_tb' => ' selected',
|
||||
'data' => $tmp['tb'],
|
||||
);
|
||||
}
|
||||
else if (($tmp['gb'] >= 1) and ($tmp['gb'] < $base)) {
|
||||
$quota = array(
|
||||
'type' => 'gb',
|
||||
'select_gb' => ' selected',
|
||||
'data' => $tmp['gb'],
|
||||
);
|
||||
}
|
||||
else if (($tmp['mb'] >= 1) and ($tmp['mb'] < $base)) {
|
||||
$quota = array(
|
||||
'type' => 'mb',
|
||||
'select_mb' => ' selected',
|
||||
'data' => $tmp['mb'],
|
||||
);
|
||||
}
|
||||
}//end if
|
||||
|
||||
if ($bill_data['bill_type'] == 'cdr') {
|
||||
$data = $bill_data['bill_cdr'];
|
||||
$tmp['kbps'] = ($data / $base);
|
||||
$tmp['mbps'] = ($data / $base / $base);
|
||||
$tmp['gbps'] = ($data / $base / $base / $base);
|
||||
if ($tmp['gbps'] >= 1) {
|
||||
$cdr = array(
|
||||
'type' => 'gbps',
|
||||
'select_gbps' => ' selected',
|
||||
'data' => $tmp['gbps'],
|
||||
);
|
||||
}
|
||||
else if (($tmp['mbps'] >= 1) and ($tmp['mbps'] < $base)) {
|
||||
$cdr = array(
|
||||
'type' => 'mbps',
|
||||
'select_mbps' => ' selected',
|
||||
'data' => $tmp['mbps'],
|
||||
);
|
||||
}
|
||||
else if (($tmp['kbps'] >= 1) and ($tmp['kbps'] < $base)) {
|
||||
$cdr = array(
|
||||
'type' => 'kbps',
|
||||
'select_kbps' => ' selected',
|
||||
'data' => $tmp['kbps'],
|
||||
);
|
||||
}
|
||||
}//end if
|
||||
|
||||
?>
|
||||
<form id="edit" name="edit" method="post" action="" class="form-horizontal" role="form">
|
||||
<input type=hidden name="action" value="update_bill">
|
||||
<script type="text/javascript">
|
||||
function billType() {
|
||||
$('#cdrDiv').toggle();
|
||||
$('#quotaDiv').toggle();
|
||||
}
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
function billType() {
|
||||
$('#cdrDiv').toggle();
|
||||
$('#quotaDiv').toggle();
|
||||
}
|
||||
</script>
|
||||
<h3>Bill Properties</h3>
|
||||
<hr>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" for="bill_name"><strong>Description</strong></label>
|
||||
<div class="col-sm-4">
|
||||
<label class="control-label" for="bill_name">
|
||||
<h5><strong>Description</strong></h5>
|
||||
</label>
|
||||
<input class="form-control input-sm" name="bill_name" value="<?php echo $bill_data['bill_name']; ?>" />
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" for="bill_type"><strong>Billing Type</strong></label>
|
||||
<div class="col-sm-10">
|
||||
<div class="col-sm-4">
|
||||
<label class="control-label" for="bill_type">
|
||||
<h5><strong>Billing Type</strong></h5>
|
||||
</label>
|
||||
<br>
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input type="radio" name="bill_type" value="cdr" onchange="javascript: billType();"
|
||||
<?php
|
||||
if ($bill_data['bill_type'] == 'cdr') {
|
||||
echo 'checked ';
|
||||
};
|
||||
?>
|
||||
/> CDR 95th
|
||||
<input type="radio" name="bill_type" value="cdr" onchange="javascript: billType();"
|
||||
<?php
|
||||
if ($bill_data['bill_type'] == 'cdr') {
|
||||
echo 'checked ';
|
||||
};
|
||||
?>
|
||||
/> CDR 95th
|
||||
</label>
|
||||
</div>
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input type="radio" name="bill_type" value="quota" onchange="javascript: billType();"
|
||||
<?php
|
||||
if ($bill_data['bill_type'] == 'quota') {
|
||||
echo 'checked ';
|
||||
};
|
||||
?>
|
||||
/> Quota
|
||||
<input type="radio" name="bill_type" value="quota" onchange="javascript: billType();"
|
||||
<?php
|
||||
if ($bill_data['bill_type'] == 'quota') {
|
||||
echo 'checked ';
|
||||
};
|
||||
?>
|
||||
/> Quota
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="cdrDiv"
|
||||
<?php
|
||||
if ($bill_data['bill_type'] == 'quota') {
|
||||
echo ' style="display: none"';
|
||||
};
|
||||
?>
|
||||
>
|
||||
<?php
|
||||
if ($bill_data['bill_type'] == 'quota') {
|
||||
echo ' style="display: none"';
|
||||
};
|
||||
?>
|
||||
>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-2">
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
<input class="form-control input-sm" type="text" name="bill_cdr" value="<?php echo $cdr['data']; ?>">
|
||||
</div>
|
||||
@@ -133,15 +133,13 @@ if ($bill_data['bill_type'] == 'quota') {
|
||||
</div>
|
||||
</div>
|
||||
<div id="quotaDiv"
|
||||
<?php
|
||||
if ($bill_data['bill_type'] == 'cdr') {
|
||||
echo ' style="display: none"';
|
||||
};
|
||||
?>
|
||||
>
|
||||
<?php
|
||||
if ($bill_data['bill_type'] == 'cdr') {
|
||||
echo ' style="display: none"';
|
||||
};
|
||||
?>
|
||||
>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-2">
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
<input class="form-control input-sm" type="text" name="bill_quota" value="<?php echo $quota['data']; ?>">
|
||||
</div>
|
||||
@@ -157,132 +155,145 @@ if ($bill_data['bill_type'] == 'cdr') {
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" for="bill_day"><strong>Billing Day</strong></label>
|
||||
<div class="col-sm-2">
|
||||
<label class="control-label" for="bill_day">
|
||||
<h5><strong>Billing Day</strong></h5>
|
||||
</label>
|
||||
<select name="bill_day" class="form-control input">
|
||||
<?php
|
||||
for ($x = 1; $x < 32; $x++) {
|
||||
$select = (($bill_data['bill_day'] == $x) ? ' selected' : '');
|
||||
echo ' <option value="'.$x.'"'.$select.'>'.$x."</option>\n";
|
||||
}
|
||||
|
||||
?>
|
||||
<?php
|
||||
for ($x = 1; $x < 32; $x++) {
|
||||
$select = (($bill_data['bill_day'] == $x) ? ' selected' : '');
|
||||
echo ' <option value="'.$x.'"'.$select.'>'.$x."</option>\n";
|
||||
}
|
||||
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<h3>Optional Information</h3>
|
||||
<hr>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" for="bill_custid"><strong>Customer Reference</strong></label>
|
||||
<div class="col-sm-4">
|
||||
<label class="control-label" for="bill_custid">
|
||||
<h5><strong>Customer Reference</strong></h5>
|
||||
</label>
|
||||
<input class="form-control input-sm" type="text" name="bill_custid" value="<?php echo $bill_data['bill_custid']; ?>" />
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" for="bill_ref"><strong>Billing Reference</strong></label>
|
||||
<div class="col-sm-4">
|
||||
<label class="control-label" for="bill_ref">
|
||||
<h5><strong>Billing Reference</strong></h5>
|
||||
</label>
|
||||
<input class="form-control input-sm" type="text" name="bill_ref" value="<?php echo $bill_data['bill_ref']; ?>" />
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" for="bill_notes"><strong>Notes</strong></label>
|
||||
<div class="col-sm-4">
|
||||
<label class="control-label" for="bill_notes">
|
||||
<h5><strong>Notes</strong></h5>
|
||||
</label>
|
||||
<textarea rows="3" class="form-control input-sm" name="bill_notes" value="<?php echo $bill_data['bill_notes']; ?>"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-success" name="Submit" value="Save" /><i class="icon-ok icon-white"></i> <strong>Save Properties</strong></button>
|
||||
<button type="submit" class="btn btn-success" name="Submit" value="Save" /><i class="fa fa-check"></i> <strong>Save Properties</strong></button>
|
||||
</form>
|
||||
|
||||
<h3>Billed Ports</h3>
|
||||
<div class="form-group">
|
||||
<?php
|
||||
$ports = dbFetchRows(
|
||||
'SELECT * FROM `bill_ports` AS B, `ports` AS P, `devices` AS D
|
||||
WHERE B.bill_id = ? AND P.port_id = B.port_id
|
||||
AND D.device_id = P.device_id ORDER BY D.device_id',
|
||||
array($bill_data['bill_id'])
|
||||
);
|
||||
|
||||
if (is_array($ports)) {
|
||||
foreach ($ports as $port) {
|
||||
$emptyCheck = true;
|
||||
$devicebtn = str_replace('list-device', 'btn', generate_device_link($port));
|
||||
$devicebtn = str_replace("overlib('", "overlib('<div style=\'border: 5px solid #e5e5e5; background: #fff; padding: 10px;\'>", $devicebtn);
|
||||
$devicebtn = str_replace("<div>',;", "</div></div>',", $devicebtn);
|
||||
$portbtn = str_replace('interface-upup', 'btn', generate_port_link($port));
|
||||
$portbtn = str_replace('interface-updown', 'btn btn-warning', $portbtn);
|
||||
$portbtn = str_replace('interface-downdown', 'btn btn-warning', $portbtn);
|
||||
$portbtn = str_replace('interface-admindown', 'btn btn-warning disabled', $portbtn);
|
||||
$portbtn = str_replace("overlib('", "overlib('<div style=\'border: 5px solid #e5e5e5; background: #fff; padding: 10px;\'>", $portbtn);
|
||||
$portbtn = str_replace("<div>',;", "</div></div>',", $portbtn);
|
||||
$portalias = (empty($port['ifAlias']) ? '' : ' - '.$port['ifAlias'].'');
|
||||
$devicebtn = str_replace('">'.$port['hostname'], '" style="color: #000;"><i class="glyphicon glyphicon-asterisk"></i> '.$port['hostname'], $devicebtn);
|
||||
$portbtn = str_replace('">'.strtolower($port['ifName']), '" style="color: #000;"><i class="glyphicon glyphicon-random"></i> '.$port['ifName'].''.$portalias, $portbtn);
|
||||
echo ' <form action="" class="form-inline" method="post" name="delete'.$port['port_id']."\" style=\"display: none;\">\n";
|
||||
echo " <input type=\"hidden\" name=\"action\" value=\"delete_bill_port\" />\n";
|
||||
echo ' <input type="hidden" name="port_id" value="'.$port['port_id']."\" />\n";
|
||||
echo " </form>\n";
|
||||
echo " <div class=\"btn-toolbar\">\n";
|
||||
echo " <div class=\"btn-group\" style=\"width: 600px;\">\n";
|
||||
// echo(" <a class=\"btn btn-danger\" href=\"javascript:;\" onclick=\"document.delete".$port['port_id'].".submit();\" style=\"color: #fff;\"><i class=\"icon-trash icon-white\"></i></a>\n");
|
||||
echo ' '.$devicebtn."\n";
|
||||
echo ' '.$portbtn."\n";
|
||||
echo " </div>\n";
|
||||
echo " <div class=\"btn-group\">\n";
|
||||
echo ' <a class="btn btn-danger btn-mini" href="javascript:;" onclick="document.delete'.$port['port_id'].".submit();\" style=\"color: #fff;\"><i class=\"icon-minus-sign icon-white\"></i> <strong>Remove Interface</strong></a>\n";
|
||||
echo " </div>\n";
|
||||
echo " </div>\n";
|
||||
}//end foreach
|
||||
|
||||
if (!$emptyCheck) {
|
||||
echo " <div class=\"alert alert-info\">\n";
|
||||
echo " <i class=\"icon-info-sign\"></i> <strong>There are no ports assigned to this bill</strong>\n";
|
||||
echo " </div>\n";
|
||||
<br>
|
||||
<h3>Billed Ports</h3>
|
||||
<hr>
|
||||
<div class="form-group">
|
||||
<?php
|
||||
//This needs a proper cleanup
|
||||
$ports = dbFetchRows(
|
||||
'SELECT * FROM `bill_ports` AS B, `ports` AS P, `devices` AS D
|
||||
WHERE B.bill_id = ? AND P.port_id = B.port_id
|
||||
AND D.device_id = P.device_id ORDER BY D.device_id',
|
||||
array($bill_data['bill_id'])
|
||||
);
|
||||
|
||||
if (is_array($ports)) {
|
||||
foreach ($ports as $port) {
|
||||
$emptyCheck = true;
|
||||
$devicebtn = str_replace('list-device', 'btn', generate_device_link($port));
|
||||
$devicebtn = str_replace("overlib('", "overlib('<div style=\'border: 5px solid #e5e5e5; background: #fff; padding: 10px;\'>", $devicebtn);
|
||||
$devicebtn = str_replace("<div>',;", "</div></div>',", $devicebtn);
|
||||
$portbtn = str_replace('interface-upup', 'btn', generate_port_link($port));
|
||||
$portbtn = str_replace('interface-updown', 'btn btn-warning', $portbtn);
|
||||
$portbtn = str_replace('interface-downdown', 'btn btn-warning', $portbtn);
|
||||
$portbtn = str_replace('interface-admindown', 'btn btn-warning disabled', $portbtn);
|
||||
$portbtn = str_replace("overlib('", "overlib('<div style=\'border: 5px solid #e5e5e5; background: #fff; padding: 10px;\'>", $portbtn);
|
||||
$portbtn = str_replace("<div>',;", "</div></div>',", $portbtn);
|
||||
$portalias = (empty($port['ifAlias']) ? '' : ' - '.$port['ifAlias'].'');
|
||||
$devicebtn = str_replace('">'.$port['hostname'], '" style="color: #000;"><i class="fa fa-asterisk"></i> '.$port['hostname'], $devicebtn);
|
||||
$portbtn = str_replace('">'.strtolower($port['ifName']), '" style="color: #000;"><i class="fa fa-random"></i> '.$port['ifName'].''.$portalias, $portbtn);
|
||||
echo ' <form action="" class="form-inline" method="post" name="delete'.$port['port_id']."\" style=\"display: none;\">\n";
|
||||
echo " <input type=\"hidden\" name=\"action\" value=\"delete_bill_port\" />\n";
|
||||
echo ' <input type="hidden" name="port_id" value="'.$port['port_id']."\" />\n";
|
||||
echo " </form>\n";
|
||||
echo " <div class=\"btn-toolbar\">\n";
|
||||
echo " <div class=\"btn-group\" style=\"width: 600px;\">\n";
|
||||
echo ' '.$devicebtn."\n";
|
||||
echo ' '.$portbtn."\n";
|
||||
echo " </div>\n";
|
||||
echo " <div class=\"btn-group\">\n";
|
||||
echo ' <a class="btn btn-danger btn-mini" href="javascript:;" onclick="document.forms[\'delete'.$port['port_id']."'].submit();\" style=\"color: #fff;\"><i class=\"fa fa-minus\"></i> <strong>Remove Interface</strong></a>\n";
|
||||
echo " </div>\n";
|
||||
echo " </div>\n";
|
||||
}
|
||||
|
||||
if (!$emptyCheck) {
|
||||
echo " <div class=\"alert alert-info\">\n";
|
||||
echo " <i class=\"fa fa-info\"></i> <strong>There are no ports assigned to this bill</strong>\n";
|
||||
echo " </div>\n";
|
||||
}
|
||||
}
|
||||
}//end if
|
||||
?>
|
||||
</div>
|
||||
</fieldset>
|
||||
?>
|
||||
</div>
|
||||
</fieldset>
|
||||
<form action="" method="post" class="form-horizontal" role="form">
|
||||
<input type="hidden" name="action" value="add_bill_port" />
|
||||
<input type="hidden" name="bill_id" value="<?php echo $bill_id; ?>" />
|
||||
<br>
|
||||
<h3>Add Port</h3>
|
||||
<hr>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" for="device"><strong>Device</strong></label>
|
||||
<div class="col-sm-4">
|
||||
<label class="control-label" for="device">
|
||||
<h5><strong>Device</strong></h5>
|
||||
</label>
|
||||
<select class="form-control input-sm" id="device" name="device" onchange="getInterfaceList(this)">
|
||||
<option value=''>Select a device</option>
|
||||
<?php
|
||||
$devices = dbFetchRows('SELECT * FROM `devices` ORDER BY hostname');
|
||||
foreach ($devices as $device) {
|
||||
unset($done);
|
||||
foreach ($access_list as $ac) {
|
||||
if ($ac == $device['device_id']) {
|
||||
$done = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$done) {
|
||||
echo " <option value='".$device['device_id']."'>".$device['hostname']."</option>\n";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<?php
|
||||
$devices = dbFetchRows('SELECT * FROM `devices` ORDER BY hostname');
|
||||
foreach ($devices as $device) {
|
||||
unset($done);
|
||||
foreach ($access_list as $ac) {
|
||||
if ($ac == $device['device_id']) {
|
||||
$done = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$done) {
|
||||
echo " <option value='".$device['device_id']."'>".$device['hostname']."</option>\n";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" for="port_id"><strong>Interface</strong></label>
|
||||
<div class="col-sm-4">
|
||||
<label class="control-label" for="port_id">
|
||||
<h5><strong>Port</strong></h5>
|
||||
</label>
|
||||
<select class="form-control input-sm" id="port_id" name="port_id"></select>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary" name="Submit" value=" Add " /><i class="icon-plus-sign icon-white"></i> <strong>Add Interface</strong></button>
|
||||
<button type="submit" class="btn btn-primary" name="Submit" value=" Add " /><i class="fa fa-plus"></i> <strong>Add Port</strong></button>
|
||||
</form>
|
||||
|
||||
@@ -37,6 +37,6 @@
|
||||
Are you sure you want to reset all <strong>MySQL</strong> and/or <strong>RRD</strong> data for all interface on this bill?
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<button id="resetBtn" type="submit" class="btn btn-danger" disabled="disabled"><i class="icon-refresh icon-white"></i> <strong>Reset Bill</strong></button>
|
||||
<button id="resetBtn" type="submit" class="btn btn-danger" disabled="disabled"><i class="fa fa-refresh"></i> <strong>Reset Bill</strong></button>
|
||||
</div>
|
||||
</form>
|
||||
@@ -76,7 +76,7 @@ if ($_POST['addbill'] == 'yes') {
|
||||
$message .= $message_break.'Port '.mres($_POST['port']).' added!';
|
||||
$message_break .= '<br />';
|
||||
}
|
||||
}//end if
|
||||
}
|
||||
|
||||
$pagetitle[] = 'Billing';
|
||||
|
||||
@@ -130,10 +130,10 @@ else if ($vars['view'] == 'add') {
|
||||
$devicebtn = str_replace('list-device', 'btn', generate_device_link($port));
|
||||
$portbtn = str_replace('interface-upup', 'btn', generate_port_link($port));
|
||||
$portalias = (empty($port['ifAlias']) ? '' : ' - '.$port['ifAlias'].'');
|
||||
$devicebtn = str_replace('">'.$port['hostname'], '" style="color: #000;"><i class="icon-asterisk"></i> '.$port['hostname'], $devicebtn);
|
||||
$devicebtn = str_replace('">'.$port['hostname'], '" style="color: #000;"><i class="fa fa-asterisk"></i> '.$port['hostname'], $devicebtn);
|
||||
$devicebtn = str_replace("overlib('", "overlib('<div style=\'border: 5px solid #e5e5e5; background: #fff; padding: 10px;\'>", $devicebtn);
|
||||
$devicebtn = str_replace("<div>',;", "</div></div>',", $devicebtn);
|
||||
$portbtn = str_replace('">'.strtolower($port['ifName']), '" style="color: #000;"><i class="icon-random"></i> '.$port['ifName'].''.$portalias, $portbtn);
|
||||
$portbtn = str_replace('">'.strtolower($port['ifName']), '" style="color: #000;"><i class="fa fa-random"></i> '.$port['ifName'].''.$portalias, $portbtn);
|
||||
$portbtn = str_replace("overlib('", "overlib('<div style=\'border: 5px solid #e5e5e5; background: #fff; padding: 10px;\'>", $portbtn);
|
||||
$portbtn = str_replace("<div>',;", "</div></div>',", $portbtn);
|
||||
echo " <fieldset>\n";
|
||||
@@ -148,7 +148,7 @@ else if ($vars['view'] == 'add') {
|
||||
echo " </div>\n";
|
||||
echo " </div>\n";
|
||||
echo " </fieldset>\n";
|
||||
}//end if
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="form-group">
|
||||
@@ -240,7 +240,7 @@ else if ($vars['view'] == 'add') {
|
||||
<div class="col-sm-6">
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-default"><i class="icon-ok-sign icon-white"></i> <strong>Add Bill</strong></button>
|
||||
<button type="submit" class="btn btn-success"><i class="fa fa-check"></i> <strong>Add Bill</strong></button>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
@@ -266,7 +266,6 @@ else {
|
||||
$day_data = getDates($bill['bill_day']);
|
||||
$datefrom = $day_data['0'];
|
||||
$dateto = $day_data['1'];
|
||||
// $rate_data = getRates($bill['bill_id'],$datefrom,$dateto);
|
||||
$rate_data = $bill;
|
||||
$rate_95th = $rate_data['rate_95th'];
|
||||
$dir_95th = $rate_data['dir_95th'];
|
||||
@@ -316,10 +315,8 @@ else {
|
||||
";
|
||||
|
||||
$i++;
|
||||
} //end if
|
||||
}//end foreach
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
echo '</table>';
|
||||
}//end if
|
||||
|
||||
// echo("</td></tr></table>");
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@ else if ($vars['purge']) {
|
||||
echo '<div class=infobox>Deleted '.generate_device_link($interface).' - '.generate_port_link($interface).'</div>';
|
||||
}
|
||||
|
||||
echo '<table cellpadding=5 cellspacing=0 border=0 width=100%>';
|
||||
echo "<tr><td></td><td></td><td></td><td><a href='deleted-ports/purge=all/'><img src='images/16/cross.png' align=absmiddle></img> Purge All</a></td></tr>";
|
||||
echo '<table class="table table-hover table-condensed">';
|
||||
echo "<tr><td>Device</td><td>Port</td><td></td><td><a href='deleted-ports/purge=all/'><i class='fa fa-times'></i> Purge All</a></td></tr>";
|
||||
|
||||
foreach (dbFetchRows("SELECT * FROM `ports` AS P, `devices` as D WHERE P.`deleted` = '1' AND D.device_id = P.device_id",array(),true) as $interface) {
|
||||
$interface = ifLabel($interface, $interface);
|
||||
@@ -29,7 +29,7 @@ foreach (dbFetchRows("SELECT * FROM `ports` AS P, `devices` as D WHERE P.`delete
|
||||
echo '<td width=250>'.generate_device_link($interface).'</td>';
|
||||
echo '<td width=250>'.generate_port_link($interface).'</td>';
|
||||
echo '<td></td>';
|
||||
echo "<td width=100><a href='deleted-ports/purge=".$interface['port_id']."/'><img src='images/16/cross.png' align=absmiddle></img> Purge</a></td>";
|
||||
echo "<td width=100><a href='deleted-ports/purge=".$interface['port_id']."/'><i class='fa fa-times'></i> Purge</a></td>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,11 @@ if (device_permitted($vars['device']) || $check_device == $vars['device']) {
|
||||
</a>
|
||||
</li>';
|
||||
|
||||
$health = (dbFetchCell("SELECT COUNT(*) FROM storage WHERE device_id = '".$device['device_id']."'") + dbFetchCell("SELECT COUNT(sensor_id) FROM sensors WHERE device_id = '".$device['device_id']."'") + dbFetchCell("SELECT COUNT(*) FROM mempools WHERE device_id = '".$device['device_id']."'") + dbFetchCell("SELECT COUNT(*) FROM processors WHERE device_id = '".$device['device_id']."'"));
|
||||
$health = dbFetchCell("SELECT COUNT(*) FROM storage WHERE device_id = '" . $device['device_id'] . "'") +
|
||||
dbFetchCell("SELECT COUNT(sensor_id) FROM sensors WHERE device_id = '" . $device['device_id'] . "'") +
|
||||
dbFetchCell("SELECT COUNT(*) FROM mempools WHERE device_id = '" . $device['device_id'] . "'") +
|
||||
dbFetchCell("SELECT COUNT(*) FROM processors WHERE device_id = '" . $device['device_id'] . "'") +
|
||||
count_mib_health($device);
|
||||
|
||||
if ($health) {
|
||||
echo '<li class="'.$select['health'].'">
|
||||
@@ -229,6 +233,14 @@ if (device_permitted($vars['device']) || $check_device == $vars['device']) {
|
||||
</a>
|
||||
</li>');
|
||||
|
||||
if (@dbFetchCell("SELECT 1 FROM stp WHERE device_id = '".$device['device_id']."'")) {
|
||||
echo '<li class="'.$select['stp'].'">
|
||||
<a href="'.generate_device_url($device, array('tab' => 'stp')).'">
|
||||
<img src="images/16/chart_organisation.png" align="absmiddle" border="0" /> STP
|
||||
</a>
|
||||
</li>';
|
||||
}
|
||||
|
||||
if (@dbFetchCell("SELECT COUNT(*) FROM `packages` WHERE device_id = '".$device['device_id']."'") > '0') {
|
||||
echo '<li class="'.$select['packages'].'">
|
||||
<a href="'.generate_device_url($device, array('tab' => 'packages')).'">
|
||||
@@ -367,6 +379,14 @@ if (device_permitted($vars['device']) || $check_device == $vars['device']) {
|
||||
</a>
|
||||
</li>';
|
||||
|
||||
if (device_permitted($device['device_id']) && is_mib_poller_enabled($device)) {
|
||||
echo '<li class="'.$select['mib'].'">
|
||||
<a href="'.generate_device_url($device, array('tab' => 'mib')).'">
|
||||
<i class="fa fa-file-text-o"></i> MIB
|
||||
</a>
|
||||
</li>';
|
||||
}
|
||||
|
||||
|
||||
echo '<li style="float: right;"><a href="https://'.$device['hostname'].'"><img src="images/16/http.png" alt="https" title="Launch browser to https://'.$device['hostname'].'" border="0" width="16" height="16" target="_blank"></a></li>
|
||||
<li style="float: right;"><a href="ssh://'.$device['hostname'].'"><img src="images/16/ssh.png" alt="ssh" title="SSH to '.$device['hostname'].'" border="0" width="16" height="16"></a></li>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<h3> Alert Rules </h3>
|
||||
<?php
|
||||
|
||||
/*
|
||||
|
||||
@@ -44,6 +44,7 @@ $override_sysContact_bool = get_dev_attrib($device, 'override_sysContact_bool'
|
||||
$override_sysContact_string = get_dev_attrib($device, 'override_sysContact_string');
|
||||
$disable_notify = get_dev_attrib($device, 'disable_notify');
|
||||
?>
|
||||
<h3>Alert settings</h3>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
@@ -51,7 +52,7 @@ $disable_notify = get_dev_attrib($device, 'disable_notify');
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3>Alert settings</h3>
|
||||
|
||||
|
||||
<form id="edit" name="edit" method="post" action="" role="form" class="form-horizontal">
|
||||
<input type="hidden" name="editing" value="yes">
|
||||
@@ -107,4 +108,4 @@ require_once 'includes/modal/new_alert_rule.inc.php';
|
||||
<div class="col-md-1 col-md-offset-3">
|
||||
<button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#create-alert" data-device_id="<?php echo $device['device_id']; ?>"><i class="fa fa-plus"></i> Create new alert rule</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<h3> Applications </h3>
|
||||
<?php
|
||||
|
||||
// Load our list of available applications
|
||||
|
||||
@@ -62,7 +62,7 @@ elseif ($update_message) {
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<h3> Device Settings </h3>
|
||||
<div class="row">
|
||||
<div class="col-md-1 col-md-offset-2">
|
||||
<form id="delete_host" name="delete_host" method="post" action="delhost/" role="form">
|
||||
@@ -114,9 +114,7 @@ elseif ($update_message) {
|
||||
<div class="form-group">
|
||||
<label for="sysLocation" class="col-sm-2 control-label">Override sysLocation:</label>
|
||||
<div class="col-sm-6">
|
||||
<div class="checkbox">
|
||||
<input onclick="edit.sysLocation.disabled=!edit.override_sysLocation.checked" type="checkbox" name="override_sysLocation"<?php if ($override_sysLocation) echo(' checked="1"'); ?> />
|
||||
</div>
|
||||
<input onclick="edit.sysLocation.disabled=!edit.override_sysLocation.checked" type="checkbox" name="override_sysLocation"<?php if ($override_sysLocation) echo(' checked="1"'); ?> />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<h3> Modules </h3>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<strong>Poller Modules</strong>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
</form>
|
||||
<h3> Port Settings </h3>
|
||||
<span id="message"><small><div class="alert alert-danger">n.b For the first time, please click any button twice.</div></small></span>
|
||||
|
||||
<form id='ignoreport' name='ignoreport' method='post' action='' role='form' class='form-inline'>
|
||||
|
||||
@@ -22,11 +22,7 @@ foreach (dbFetchRows('SELECT * FROM device_graphs WHERE device_id = ? ORDER BY g
|
||||
}
|
||||
}
|
||||
|
||||
// These are standard graphs we should have for all systems
|
||||
$graph_enable['poller']['poller_perf'] = 'device_poller_perf';
|
||||
if (can_ping_device($attribs) === true) {
|
||||
$graph_enable['poller']['ping_perf'] = 'device_ping_perf';
|
||||
}
|
||||
enable_graphs($device, $graph_enable);
|
||||
|
||||
$sep = '';
|
||||
foreach ($graph_enable as $section => $nothing) {
|
||||
@@ -56,7 +52,6 @@ print_optionbar_end();
|
||||
|
||||
$graph_enable = $graph_enable[$vars['group']];
|
||||
|
||||
// foreach ($config['graph_types']['device'] as $graph => $entry)
|
||||
foreach ($graph_enable as $graph => $entry) {
|
||||
$graph_array = array();
|
||||
if ($graph_enable[$graph]) {
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (is_file($config['rrd_dir'].'/'.$device['hostname'].'/ucd_cpu.rrd')) {
|
||||
$graph_title = 'Processor Utilisation';
|
||||
$graph_type = 'device_cpu';
|
||||
|
||||
include 'includes/print-device-graph.php';
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (is_file($config['rrd_dir'].'/'.$device['hostname'].'/hrSystem.rrd')) {
|
||||
$graph_title = 'Running Processes';
|
||||
$graph_type = 'device_hrprocesses';
|
||||
|
||||
include 'includes/print-device-graph.php';
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (is_file($config['rrd_dir'].'/'.$device['hostname'].'/hrSystem.rrd')) {
|
||||
$graph_title = 'Users Logged On';
|
||||
$graph_type = 'device_hrusers';
|
||||
|
||||
include 'includes/print-device-graph.php';
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (is_file($config['rrd_dir'].'/'.$device['hostname'].'/ipSystemStats-ipv6.rrd')) {
|
||||
$graph_title = 'IPv6 IP Packet Statistics';
|
||||
$graph_type = 'device_ipSystemStats_v6';
|
||||
|
||||
include 'includes/print-device-graph.php';
|
||||
|
||||
$graph_title = 'IPv6 IP Fragmentation Statistics';
|
||||
$graph_type = 'device_ipSystemStats_v6_frag';
|
||||
|
||||
include 'includes/print-device-graph.php';
|
||||
}
|
||||
|
||||
if (is_file($config['rrd_dir'].'/'.$device['hostname'].'/ipSystemStats-ipv4.rrd')) {
|
||||
$graph_title = 'IPv4 IP Packet Statistics';
|
||||
$graph_type = 'device_ipSystemStats_v4';
|
||||
|
||||
include 'includes/print-device-graph.php';
|
||||
}
|
||||
|
||||
if (is_file($config['rrd_dir'].'/'.$device['hostname'].'/netstats-ip.rrd')) {
|
||||
$graph_title = 'IP Statistics';
|
||||
$graph_type = 'device_ip';
|
||||
|
||||
include 'includes/print-device-graph.php';
|
||||
|
||||
$graph_title = 'IP Fragmented Statistics';
|
||||
$graph_type = 'device_ip_fragmented';
|
||||
|
||||
include 'includes/print-device-graph.php';
|
||||
}
|
||||
|
||||
if (is_file($config['rrd_dir'].'/'.$device['hostname'].'/netstats-tcp.rrd')) {
|
||||
$graph_title = 'TCP Statistics';
|
||||
$graph_type = 'device_tcp';
|
||||
|
||||
include 'includes/print-device-graph.php';
|
||||
}
|
||||
|
||||
if (is_file($config['rrd_dir'].'/'.$device['hostname'].'/netstats-udp.rrd')) {
|
||||
$graph_title = 'UDP Statistics';
|
||||
$graph_type = 'device_udp';
|
||||
|
||||
include 'includes/print-device-graph.php';
|
||||
}
|
||||
|
||||
if (is_file($config['rrd_dir'].'/'.$device['hostname'].'/netstats-snmp.rrd')) {
|
||||
$graph_title = 'SNMP Packets Statistics';
|
||||
$graph_type = 'device_snmp_packets';
|
||||
|
||||
include 'includes/print-device-graph.php';
|
||||
|
||||
$graph_title = 'SNMP Message Type Statistics';
|
||||
$graph_type = 'device_snmp_statistics';
|
||||
|
||||
include 'includes/print-device-graph.php';
|
||||
}
|
||||
|
||||
if (is_file($config['rrd_dir'].'/'.$device['hostname'].'/netstats-icmp.rrd')) {
|
||||
$graph_title = 'ICMP Statistics';
|
||||
$graph_type = 'device_icmp';
|
||||
|
||||
include 'includes/print-device-graph.php';
|
||||
|
||||
$graph_title = 'ICMP Informational Statistics';
|
||||
$graph_type = 'device_icmp_informational';
|
||||
|
||||
include 'includes/print-device-graph.php';
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (is_file($config['rrd_dir'].'/'.$device['hostname'].'/netstats-icmp.rrd')) {
|
||||
$graph_title = 'ICMP Informational Statistics';
|
||||
$graph_type = 'device_icmp_informational';
|
||||
|
||||
include 'includes/print-device-graph.php';
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (is_file($config['rrd_dir'].'/'.$device['hostname'].'/netstats-snmp.rrd')) {
|
||||
$graph_title = 'SNMP Packets Statistics';
|
||||
$graph_type = 'device_snmp_packets';
|
||||
|
||||
include 'includes/print-device-graph.php';
|
||||
|
||||
$graph_title = 'SNMP Message Type Statistics';
|
||||
$graph_type = 'device_snmp_statistics';
|
||||
|
||||
include 'includes/print-device-graph.php';
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
<?php
|
||||
|
||||
$graph_title = 'Device Uptime';
|
||||
$graph_type = 'device_uptime';
|
||||
|
||||
require 'includes/print-device-graph.php';
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
$storage = dbFetchCell('select count(*) from storage WHERE device_id = ?', array($device['device_id']));
|
||||
$diskio = dbFetchCell('select count(*) from ucd_diskio WHERE device_id = ?', array($device['device_id']));
|
||||
$mempools = dbFetchCell('select count(*) from mempools WHERE device_id = ?', array($device['device_id']));
|
||||
$processor = dbFetchCell('select count(*) from processors WHERE device_id = ?', array($device['device_id']));
|
||||
$mempools = dbFetchCell('select count(*) from mempools WHERE device_id = ?', array($device['device_id'])) + count_mib_mempools($device);
|
||||
$processor = dbFetchCell('select count(*) from processors WHERE device_id = ?', array($device['device_id'])) + count_mib_processors($device);
|
||||
|
||||
$charge = dbFetchCell("select count(*) from sensors WHERE sensor_class='charge' AND device_id = ?", array($device['device_id']));
|
||||
$temperatures = dbFetchCell("select count(*) from sensors WHERE sensor_class='temperature' AND device_id = ?", array($device['device_id']));
|
||||
|
||||
@@ -4,8 +4,16 @@ $graph_type = 'mempool_usage';
|
||||
|
||||
$i = '1';
|
||||
|
||||
if (count_mib_mempools($device) > 0) {
|
||||
$mempools = get_mib_mempools($device);
|
||||
$graph_type = 'device_mempool';
|
||||
}
|
||||
else {
|
||||
$mempools = dbFetchRows('SELECT * FROM `mempools` WHERE device_id = ?', array($device['device_id']));
|
||||
}
|
||||
|
||||
// FIXME css alternating colours
|
||||
foreach (dbFetchRows('SELECT * FROM `mempools` WHERE device_id = ?', array($device['device_id'])) as $mempool) {
|
||||
foreach ($mempools as $mempool) {
|
||||
if (!is_integer($i / 2)) {
|
||||
$row_colour = $list_colour_a;
|
||||
}
|
||||
@@ -15,30 +23,49 @@ foreach (dbFetchRows('SELECT * FROM `mempools` WHERE device_id = ?', array($devi
|
||||
|
||||
$text_descr = rewrite_entity_descr($mempool['mempool_descr']);
|
||||
|
||||
$mempool_url = 'graphs/id='.$mempool['mempool_id'].'/type=mempool_usage/';
|
||||
$mini_url = 'graph.php?id='.$mempool['mempool_id'].'&type='.$graph_type.'&from='.$config['time']['day'].'&to='.$config['time']['now'].'&width=80&height=20&bg=f4f4f4';
|
||||
if ($graph_type == 'device_mempool') {
|
||||
$id = 'device';
|
||||
$val = $device['device_id'];
|
||||
}
|
||||
else {
|
||||
$id = 'id';
|
||||
$val = $mempool['mempool_id'];
|
||||
}
|
||||
$mempool_url = 'graphs/'.$id.'='.$val.'/type='.$graph_type.'/';
|
||||
$mini_url = 'graph.php?'.$id.'='.$val.'&type='.$graph_type.'&from='.$config['time']['day'].'&to='.$config['time']['now'].'&width=80&height=20&bg=f4f4f4';
|
||||
|
||||
$mempool_popup = "onmouseover=\"return overlib('<div class=list-large>".$device['hostname'].' - '.$text_descr;
|
||||
$mempool_popup .= "</div><img src=\'graph.php?id=".$mempool['mempool_id'].'&type='.$graph_type.'&from='.$config['time']['month'].'&to='.$config['time']['now']."&width=400&height=125\'>";
|
||||
$mempool_popup .= "</div><img src=\'graph.php?'.$id.'=".$val.'&type='.$graph_type.'&from='.$config['time']['month'].'&to='.$config['time']['now']."&width=400&height=125\'>";
|
||||
$mempool_popup .= "', RIGHT".$config['overlib_defaults'].');" onmouseout="return nd();"';
|
||||
|
||||
$total = formatStorage($mempool['mempool_total']);
|
||||
$used = formatStorage($mempool['mempool_used']);
|
||||
$free = formatStorage($mempool['mempool_free']);
|
||||
|
||||
$perc = round(($mempool['mempool_used'] / $mempool['mempool_total'] * 100));
|
||||
// don't bother recalculating if mempools use percentage
|
||||
if ($mempool['percentage'] === true) {
|
||||
$perc = round($mempool['mempool_used']);
|
||||
}
|
||||
else {
|
||||
$perc = round(($mempool['mempool_used'] / $mempool['mempool_total'] * 100));
|
||||
}
|
||||
|
||||
$background = get_percentage_colours($percent);
|
||||
$right_background = $background['right'];
|
||||
$left_background = $background['left'];
|
||||
|
||||
$graph_array['id'] = $mempool['mempool_id'];
|
||||
$graph_array[$id] = $val;
|
||||
$graph_array['type'] = $graph_type;
|
||||
|
||||
echo "<div class='panel panel-default'>
|
||||
<div class='panel-heading'>
|
||||
<h3 class='panel-title'>$text_descr <div class='pull-right'>$used/$total - $perc% used</div></h3>
|
||||
</div>";
|
||||
<div class='panel-heading'>";
|
||||
if ($mempool['percentage'] === true) {
|
||||
echo " <h3 class='panel-title'>$text_descr <div class='pull-right'>$perc% used</div></h3>";
|
||||
}
|
||||
else {
|
||||
echo " <h3 class='panel-title'>$text_descr <div class='pull-right'>$used/$total - $perc% used</div></h3>";
|
||||
}
|
||||
echo " </div>";
|
||||
echo "<div class='panel-body'>";
|
||||
include 'includes/print-graphrow.inc.php';
|
||||
echo "</div></div>";
|
||||
|
||||
@@ -3,21 +3,36 @@
|
||||
$graph_type = 'processor_usage';
|
||||
|
||||
$i = '1';
|
||||
foreach (dbFetchRows('SELECT * FROM `processors` WHERE device_id = ?', array($device['device_id'])) as $proc) {
|
||||
$proc_url = 'graphs/id='.$proc['processor_id'].'/type=processor_usage/';
|
||||
|
||||
$mini_url = 'graph.php?id='.$proc['processor_id'].'&type='.$graph_type.'&from='.$config['time']['day'].'&to='.$config['time']['now'].'&width=80&height=20&bg=f4f4f4';
|
||||
if (count_mib_processors($device) > 0) {
|
||||
$processors = get_mib_processors($device);
|
||||
$graph_type = 'device_processor';
|
||||
}
|
||||
else {
|
||||
$processors = dbFetchRows('SELECT * FROM `processors` WHERE device_id = ?', array($device['device_id']));
|
||||
}
|
||||
|
||||
$text_descr = $proc['processor_descr'];
|
||||
foreach ($processors as $proc) {
|
||||
if ($graph_type == 'device_processor') {
|
||||
$id = 'device';
|
||||
$val = $device['device_id'];
|
||||
}
|
||||
else {
|
||||
$id = 'id';
|
||||
$val = $proc['processor_id'];
|
||||
}
|
||||
$proc_url = 'graphs/'.$id.'='.$val.'/type='.$graph_type.'/';
|
||||
$base_url = 'graph.php?'.$id.'='.$val.'&type='.$graph_type.'&from='.$config['time']['day'].'&to='.$config['time']['now'];
|
||||
$mini_url = $base_url.'&width=80&height=20&bg=f4f4f4';
|
||||
|
||||
$text_descr = rewrite_entity_descr($text_descr);
|
||||
$text_descr = rewrite_entity_descr($proc['processor_descr']);
|
||||
|
||||
$proc_popup = "onmouseover=\"return overlib('<div class=list-large>".$device['hostname'].' - '.$text_descr;
|
||||
$proc_popup .= "</div><img src=\'graph.php?id=".$proc['processor_id'].'&type='.$graph_type.'&from='.$config['time']['month'].'&to='.$config['time']['now']."&width=400&height=125\'>";
|
||||
$proc_popup .= "</div><img src=\'".$base_url."&width=400&height=125\'>";
|
||||
$proc_popup .= "', RIGHT".$config['overlib_defaults'].');" onmouseout="return nd();"';
|
||||
$percent = round($proc['processor_usage']);
|
||||
|
||||
$graph_array['id'] = $proc['processor_id'];
|
||||
$graph_array[$id] = $val;
|
||||
$graph_array['type'] = $graph_type;
|
||||
|
||||
echo "<div class='panel panel-default'>
|
||||
@@ -27,4 +42,4 @@ foreach (dbFetchRows('SELECT * FROM `processors` WHERE device_id = ?', array($de
|
||||
echo "<div class='panel-body'>";
|
||||
include 'includes/print-graphrow.inc.php';
|
||||
echo "</div></div>";
|
||||
}//end foreach
|
||||
}//end foreach
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS device MIB browser
|
||||
*
|
||||
* Copyright (c) 2015 Gear Consulting Pty Ltd <github@libertysys.com.au>
|
||||
*
|
||||
* Author: Paul Gear
|
||||
*
|
||||
* 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 (!isset($vars['section'])) {
|
||||
$vars['section'] = "mib";
|
||||
}
|
||||
if (is_module_enabled('poller', 'mib')) {
|
||||
?>
|
||||
|
||||
<h4><i class="fa fa-file-text-o"></i> Device MIB associations</h4>
|
||||
<div class="table-responsive">
|
||||
<table id="mibs" class="table table-hover table-condensed mibs">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-column-id="module">Module</th>
|
||||
<th data-column-id="mib">MIB</th>
|
||||
<th data-column-id="included_by">Included by</th>
|
||||
<th data-column-id="last_modified">Last Modified</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<h4><i class="fa fa-file-text-o"></i> Device MIB values</h4>
|
||||
<div class="table-responsive">
|
||||
<table id="oids" class="table table-hover table-condensed mibs">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-column-id="module">Module</th>
|
||||
<th data-column-id="mib">MIB</th>
|
||||
<th data-column-id="object_type">Object type</th>
|
||||
<th data-column-id="oid">OID</th>
|
||||
<th data-column-id="value">Value</th>
|
||||
<th data-column-id="numvalue">Numeric Value</th>
|
||||
<th data-column-id="last_modified">Last Modified</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var grid = $("#mibs").bootgrid({
|
||||
ajax: true,
|
||||
rowCount: [50,100,250,-1],
|
||||
post: function ()
|
||||
{
|
||||
return {
|
||||
id: "device_mibs",
|
||||
device_id: '<?php echo htmlspecialchars($device['device_id']); ?>',
|
||||
};
|
||||
},
|
||||
url: "/ajax_table.php",
|
||||
formatters: {
|
||||
},
|
||||
templates: {
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var grid2 = $("#oids").bootgrid({
|
||||
ajax: true,
|
||||
rowCount: [50,100,250,-1],
|
||||
post: function ()
|
||||
{
|
||||
return {
|
||||
id: "device_oids",
|
||||
device_id: '<?php echo htmlspecialchars($device['device_id']); ?>',
|
||||
};
|
||||
},
|
||||
url: "/ajax_table.php",
|
||||
formatters: {
|
||||
},
|
||||
templates: {
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
else {
|
||||
print_mib_poller_disabled();
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user