mirror of
https://github.com/stylersnico/librenms.git
synced 2026-08-04 00:11:51 +02:00
Rebased
This commit is contained in:
+20
-14
@@ -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)
|
||||
@@ -78,4 +77,11 @@ Contributors to LibreNMS:
|
||||
- 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 \
|
||||
|
||||
+1
-1
@@ -771,7 +771,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'] = '{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.0 KiB |
@@ -791,7 +791,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';
|
||||
|
||||
@@ -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>';
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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>";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>';
|
||||
|
||||
@@ -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);
|
||||
+8
-3
@@ -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>");
|
||||
|
||||
@@ -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'].'">
|
||||
@@ -367,6 +371,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>
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
@@ -10,8 +10,19 @@ if ($ports['total']) {
|
||||
</div>
|
||||
<table class="table table-hover table-condensed table-striped">';
|
||||
|
||||
$graph_array['height'] = '100';
|
||||
$graph_array['width'] = '485';
|
||||
if($_SESSION['screen_width']) {
|
||||
if($_SESSION['screen_width'] > 970) {
|
||||
$graph_array['width'] = round(($_SESSION['screen_width'] - 390 )/2,0);
|
||||
$graph_array['height'] = round($graph_array['width'] /3);
|
||||
$graph_array['lazy_w'] = $graph_array['width'] + 80;
|
||||
}
|
||||
else {
|
||||
$graph_array['width'] = $_SESSION['screen_width'] - 190;
|
||||
$graph_array['height'] = round($graph_array['width'] /3);
|
||||
$graph_array['lazy_w'] = $graph_array['width'] + 80;
|
||||
}
|
||||
}
|
||||
|
||||
$graph_array['to'] = $config['time']['now'];
|
||||
$graph_array['device'] = $device['device_id'];
|
||||
$graph_array['type'] = 'device_bits';
|
||||
@@ -19,6 +30,9 @@ if ($ports['total']) {
|
||||
$graph_array['legend'] = 'no';
|
||||
$graph = generate_lazy_graph_tag($graph_array);
|
||||
|
||||
#Generate tooltip
|
||||
$graph_array['width'] = 210;
|
||||
$graph_array['height'] = 100;
|
||||
$link_array = $graph_array;
|
||||
$link_array['page'] = 'graphs';
|
||||
unset($link_array['height'], $link_array['width']);
|
||||
|
||||
@@ -64,9 +64,20 @@ if (count($processors)) {
|
||||
if ($config['cpu_details_overview'] === false)
|
||||
{
|
||||
|
||||
if($_SESSION['screen_width']) {
|
||||
if($_SESSION['screen_width'] > 970) {
|
||||
$graph_array['width'] = round(($_SESSION['screen_width'] - 390 )/2,0);
|
||||
$graph_array['height'] = round($graph_array['width'] /3);
|
||||
$graph_array['lazy_w'] = $graph_array['width'] + 80;
|
||||
}
|
||||
else {
|
||||
$graph_array['width'] = $_SESSION['screen_width'] - 190;
|
||||
$graph_array['height'] = round($graph_array['width'] /3);
|
||||
$graph_array['lazy_w'] = $graph_array['width'] + 80;
|
||||
}
|
||||
}
|
||||
|
||||
//Generate average cpu graph
|
||||
$graph_array['height'] = '100';
|
||||
$graph_array['width'] = '485';
|
||||
$graph_array['device'] = $device['device_id'];
|
||||
$graph_array['type'] = 'device_processor';
|
||||
$graph = generate_lazy_graph_tag($graph_array);
|
||||
@@ -78,7 +89,8 @@ if (count($processors)) {
|
||||
$link = generate_url($link_array);
|
||||
|
||||
//Generate tooltip
|
||||
$graph_array['width'] = '210';
|
||||
$graph_array['width']=210;
|
||||
$graph_array['height']=100;
|
||||
$overlib_content = generate_overlib_content($graph_array, $device['hostname'].' - CPU usage');
|
||||
|
||||
echo '<tr>
|
||||
|
||||
@@ -73,6 +73,7 @@ $menu_options['realtime'] = 'Real time';
|
||||
// FIXME CONDITIONAL
|
||||
$menu_options['arp'] = 'ARP Table';
|
||||
$menu_options['events'] = 'Eventlog';
|
||||
$menu_options['notes'] = 'Notes';
|
||||
|
||||
if (dbFetchCell("SELECT COUNT(*) FROM `ports_adsl` WHERE `port_id` = '".$port['port_id']."'")) {
|
||||
$menu_options['adsl'] = 'ADSL';
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS
|
||||
*
|
||||
* Copyright (c) 2015 Søren Friis Rosiak <sorenrosiak@gmail.com>
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
$pagetitle[] = 'Notes';
|
||||
$port_id_notes = 'port_id_notes:' . $port['port_id'];
|
||||
$device_id = $device['device_id'];
|
||||
$data = get_dev_attrib($device,$port_id_notes);
|
||||
?>
|
||||
|
||||
<form class="form-horizontal" action="" method="post">
|
||||
<h3>Port Notes</h3>
|
||||
<hr>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-10">
|
||||
<textarea class="form-control" rows="6" name="notes" id="port-notes"><?php
|
||||
echo htmlentities($data); ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-10">
|
||||
<?php
|
||||
echo '
|
||||
<button type="submit" name="btn-update-notes" id="btn-update-notes" class="btn btn-primary">Submit</button>
|
||||
';
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<script>
|
||||
$("[name='btn-update-notes']").on('click', function(event) {
|
||||
event.preventDefault();
|
||||
var $this = $(this);
|
||||
var device_id = "<?php echo $device_id; ?>";
|
||||
var port_id_notes = "<?php echo $port_id_notes; ?>";
|
||||
var notes = $("#port-notes").val();
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'ajax_form.php',
|
||||
data: { type: "update-port-notes", notes: notes, port_id_notes: port_id_notes, device_id: device_id },
|
||||
dataType: "html",
|
||||
success: function(data){
|
||||
toastr.success('Saved');
|
||||
},
|
||||
error:function(){
|
||||
toastr.error('Error');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -384,7 +384,7 @@ if (passwordscanchange($users_details['username'])) {
|
||||
<div class='col-sm-4'><select class='form-control' name='dashboard'>";
|
||||
$defdash = dbFetchCell("SELECT dashboard FROM users WHERE user_id = ?",array($vars['user_id']));
|
||||
foreach(dbFetchRows("SELECT dashboards.*,users.username FROM `dashboards` INNER JOIN `users` ON users.user_id = dashboards.user_id WHERE (dashboards.access > 0 && dashboards.user_id != ?) || dashboards.user_id = ?",array($vars['user_id'],$vars['user_id'])) as $dash) {
|
||||
echo "<option value='".$dash['dashboard_id']."'".($defdash == $dash['dashboard_id'] ? ' selected' : '').">".$dash['dashboard_name']."</option>";
|
||||
echo "<option value='".$dash['dashboard_id']."'".($defdash == $dash['dashboard_id'] ? ' selected' : '').">".$dash['username'].':'.$dash['dashboard_name']."</option>";
|
||||
}
|
||||
echo "</select>
|
||||
</div>
|
||||
|
||||
@@ -37,7 +37,7 @@ if (!empty($vars['dashboard'])) {
|
||||
}
|
||||
if (empty($vars['dashboard'])) {
|
||||
if ($default_dash != 0) {
|
||||
$vars['dashboard'] = dbFetchRow('select * from dashboards where dashboard_id = ?',array($default_dash));
|
||||
$vars['dashboard'] = dbFetchRow('select dashboards.*,users.username from dashboards inner join users on dashboards.user_id = users.user_id where dashboards.dashboard_id = ?',array($default_dash));
|
||||
}
|
||||
else {
|
||||
$vars['dashboard'] = dbFetchRow('select * from dashboards where user_id = ? order by dashboard_id limit 1',array($_SESSION['user_id']));
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS global MIB association viewer
|
||||
*
|
||||
* 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 (is_module_enabled('poller', 'mib')) {
|
||||
?>
|
||||
|
||||
<h4>MIB associations for all devices</h4>
|
||||
<div class="table-responsive">
|
||||
<table id="mibs" class="table table-hover table-condensed mibs">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-column-id="hostname">Hostname</th>
|
||||
<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>
|
||||
|
||||
<script>
|
||||
var grid = $("#mibs").bootgrid({
|
||||
ajax: true,
|
||||
rowCount: [50,100,250,-1],
|
||||
post: function ()
|
||||
{
|
||||
return {
|
||||
id: "device_mibs",
|
||||
};
|
||||
},
|
||||
url: "/ajax_table.php",
|
||||
formatters: {
|
||||
},
|
||||
templates: {
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
else {
|
||||
print_mib_poller_disabled();
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS global MIB viewer
|
||||
*
|
||||
* 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 (is_module_enabled('poller', 'mib')) {
|
||||
?>
|
||||
|
||||
<h4><i class="fa fa-file-text-o"></i> All MIB definitions</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="object_type">Object Type</th>
|
||||
<th data-column-id="oid">Object Id</th>
|
||||
<th data-column-id="syntax">Syntax</th>
|
||||
<th data-column-id="description">Description</th>
|
||||
<!-- th data-column-id="max_access">Maximum Access</th>
|
||||
<th data-column-id="status">Status</th -->
|
||||
<th data-column-id="included_by">Included by</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: "mibs",
|
||||
view: '<?php echo $vars['view']; ?>'
|
||||
};
|
||||
},
|
||||
url: "/ajax_table.php",
|
||||
formatters: {
|
||||
},
|
||||
templates: {
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
else {
|
||||
print_mib_poller_disabled();
|
||||
}
|
||||
@@ -112,7 +112,7 @@ $notifications = new ObjCache('notifications');
|
||||
<?php } ?>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h3><a class="btn btn-default" href="/notifications/archive">Show Archive</a></h3>
|
||||
<h3><a class="btn btn-default" href="<?php echo $config['base_url']; ?>notifications/archive">Show Archive</a></h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -164,7 +164,7 @@ $(function() {
|
||||
success: function (data) {
|
||||
if( data.status == "ok" ) {
|
||||
$("#message").html('<div class="alert alert-info">' + data.message + '</div>');
|
||||
window.location.href="/notifications";
|
||||
window.location.href="<?php echo $config['base_url']; ?>notifications";
|
||||
}
|
||||
else {
|
||||
$("#message").html('<div class="alert alert-info">' + data.message + '</div>');
|
||||
@@ -208,7 +208,7 @@ $(function() {
|
||||
success: function (data) {
|
||||
if( data.status == "ok" ) {
|
||||
$("#message").html('<div class="alert alert-info">' + data.message + '</div>');
|
||||
window.location.href="/notifications";
|
||||
window.location.href="<?php echo $config['base_url']; ?>notifications";
|
||||
}
|
||||
else {
|
||||
$("#message").html('<div class="alert alert-info">' + data.message + '</div>');
|
||||
@@ -227,7 +227,7 @@ $(function() {
|
||||
success: function (data) {
|
||||
if( data.status == "ok" ) {
|
||||
$("#message").html('<div class="alert alert-info">' + data.message + '</div>');
|
||||
window.location.href="/notifications";
|
||||
window.location.href="<?php echo $config['base_url']; ?>notifications";
|
||||
}
|
||||
else {
|
||||
$("#message").html('<div class="alert alert-info">' + data.message + '</div>');
|
||||
|
||||
+243
-36
@@ -580,6 +580,7 @@ function edit_service($service, $descr, $service_ip, $service_param = "", $servi
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* convenience function - please use this instead of 'if ($debug) { echo ...; }'
|
||||
*/
|
||||
@@ -596,7 +597,8 @@ function d_echo($text, $no_debug_text = null) {
|
||||
elseif ($no_debug_text) {
|
||||
echo "$no_debug_text";
|
||||
}
|
||||
}
|
||||
} // d_echo
|
||||
|
||||
|
||||
/*
|
||||
* convenience function - please use this instead of 'if ($debug) { print_r ...; }'
|
||||
@@ -609,37 +611,8 @@ function d_print_r($var, $no_debug_text = null) {
|
||||
elseif ($no_debug_text) {
|
||||
echo "$no_debug_text";
|
||||
}
|
||||
}
|
||||
} // d_print_r
|
||||
|
||||
/*
|
||||
* Shorten the name so it works as an RRD data source name (limited to 19 chars by default).
|
||||
* Substitute for $subst if necessary.
|
||||
* @return the shortened name
|
||||
*/
|
||||
function name_shorten($name, $common = null, $subst = "mibval", $len = 19) {
|
||||
if ($common !== null) {
|
||||
// remove common from the beginning of the string, if present
|
||||
if (strlen($name) > $len && strpos($name, $common) >= 0) {
|
||||
$newname = str_replace($common, '', $name);
|
||||
$name = $newname;
|
||||
}
|
||||
}
|
||||
if (strlen($name) > $len) {
|
||||
$name = $subst;
|
||||
}
|
||||
return $name;
|
||||
}
|
||||
|
||||
/*
|
||||
* @return the name of the rrd file for $host's $extra component
|
||||
* @param host Host name
|
||||
* @param extra Components of RRD filename - will be separated with "-"
|
||||
*/
|
||||
function rrd_name($host, $extra, $exten = ".rrd") {
|
||||
global $config;
|
||||
$filename = safename(is_array($extra) ? implode("-", $extra) : $extra);
|
||||
return implode("/", array($config['rrd_dir'], $host, $filename.$exten));
|
||||
}
|
||||
|
||||
/*
|
||||
* @return true if the given graph type is a dynamic MIB graph
|
||||
@@ -647,7 +620,8 @@ function rrd_name($host, $extra, $exten = ".rrd") {
|
||||
function is_mib_graph($type, $subtype) {
|
||||
global $config;
|
||||
return $config['graph_types'][$type][$subtype]['section'] == 'mib';
|
||||
}
|
||||
} // is_mib_graph
|
||||
|
||||
|
||||
/*
|
||||
* @return true if client IP address is authorized to access graphs
|
||||
@@ -670,7 +644,8 @@ function is_client_authorized($clientip) {
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
} // is_client_authorized
|
||||
|
||||
|
||||
/*
|
||||
* @return an array of all graph subtypes for the given type
|
||||
@@ -702,7 +677,8 @@ function get_graph_subtypes($type) {
|
||||
|
||||
sort($types);
|
||||
return $types;
|
||||
}
|
||||
} // get_graph_subtypes
|
||||
|
||||
|
||||
function get_smokeping_files($device) {
|
||||
global $config;
|
||||
@@ -733,6 +709,7 @@ function get_smokeping_files($device) {
|
||||
return $smokeping_files;
|
||||
} // end get_smokeping_files
|
||||
|
||||
|
||||
function generate_smokeping_file($device,$file='') {
|
||||
global $config;
|
||||
if ($config['smokeping']['integration'] === true) {
|
||||
@@ -741,7 +718,8 @@ function generate_smokeping_file($device,$file='') {
|
||||
else {
|
||||
return $config['smokeping']['dir'] . '/' . $file;
|
||||
}
|
||||
}
|
||||
} // generate_smokeping_file
|
||||
|
||||
|
||||
/*
|
||||
* @return rounded value to 10th/100th/1000th depending on input (valid: 10, 100, 1000)
|
||||
@@ -758,6 +736,172 @@ function round_Nth($val = 0, $round_to) {
|
||||
}
|
||||
} // end round_Nth
|
||||
|
||||
|
||||
/*
|
||||
* @return true if this device should be polled with MIB-based discovery
|
||||
*/
|
||||
function is_mib_poller_enabled($device)
|
||||
{
|
||||
if (!is_module_enabled('poller', 'mib')) {
|
||||
d_echo("MIB polling module disabled globally.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!is_dev_attrib_enabled($device, 'poll_mib')) {
|
||||
d_echo('MIB module disabled for '.$device['hostname']."\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
} // is_mib_poller_enabled
|
||||
|
||||
|
||||
/*
|
||||
* FIXME: Dummy implementation
|
||||
*/
|
||||
function count_mib_mempools($device)
|
||||
{
|
||||
if (is_mib_poller_enabled($device) && $device['os'] == 'ruckuswireless') {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
} // count_mib_mempools
|
||||
|
||||
|
||||
/*
|
||||
* FIXME: Dummy implementation
|
||||
*/
|
||||
function count_mib_processors($device)
|
||||
{
|
||||
if (is_mib_poller_enabled($device) && $device['os'] == 'ruckuswireless') {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
} // count_mib_processors
|
||||
|
||||
|
||||
function count_mib_health($device)
|
||||
{
|
||||
return count_mib_mempools($device) + count_mib_processors($device);
|
||||
} // count_mib_health
|
||||
|
||||
|
||||
function get_mibval($device, $oid)
|
||||
{
|
||||
$sql = 'SELECT * FROM `device_oids` WHERE `device_id` = ? AND `oid` = ?';
|
||||
return dbFetchRow($sql, array($device['device_id'], $oid));
|
||||
} // get_mibval
|
||||
|
||||
|
||||
/*
|
||||
* FIXME: Dummy implementation - needs an abstraction for each device
|
||||
*/
|
||||
function get_mib_mempools($device)
|
||||
{
|
||||
$mempools = array();
|
||||
if (is_mib_poller_enabled($device) && $device['os'] == 'ruckuswireless') {
|
||||
$mempool = array();
|
||||
$mibvals = get_mibval($device, '.1.3.6.1.4.1.25053.1.2.1.1.1.15.14.0');
|
||||
$mempool['mempool_descr'] = $mibvals['object_type'];
|
||||
$mempool['mempool_id'] = 0;
|
||||
$mempool['mempool_total'] = 100;
|
||||
$mempool['mempool_used'] = $mibvals['numvalue'];
|
||||
$mempool['mempool_free'] = 100 - $mibvals['numvalue'];
|
||||
$mempool['percentage'] = true;
|
||||
$mempools[] = $mempool;
|
||||
}
|
||||
return $mempools;
|
||||
} // get_mib_mempools
|
||||
|
||||
|
||||
/*
|
||||
* FIXME: Dummy implementation - needs an abstraction for each device
|
||||
*/
|
||||
function get_mib_processors($device)
|
||||
{
|
||||
$processors = array();
|
||||
if (is_mib_poller_enabled($device) && $device['os'] == 'ruckuswireless') {
|
||||
$proc = array();
|
||||
$mibvals = get_mibval($device, '.1.3.6.1.4.1.25053.1.2.1.1.1.15.13.0');
|
||||
$proc['processor_descr'] = $mibvals['object_type'];
|
||||
$proc['processor_id'] = 0;
|
||||
$proc['processor_usage'] = $mibvals['numvalue'];
|
||||
$processors[] = $proc;
|
||||
}
|
||||
return $processors;
|
||||
} // get_mib_processors
|
||||
|
||||
|
||||
/*
|
||||
* FIXME: Dummy implementation - needs an abstraction for each device
|
||||
* @return true if there is a custom graph defined for this type, subtype, and device
|
||||
*/
|
||||
function is_custom_graph($type, $subtype, $device)
|
||||
{
|
||||
if (is_mib_poller_enabled($device) && $device['os'] == 'ruckuswireless' && $type == 'device') {
|
||||
switch ($subtype) {
|
||||
case 'cpumem':
|
||||
case 'mempool':
|
||||
case 'processor':
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} // is_custom_graph
|
||||
|
||||
|
||||
/*
|
||||
* FIXME: Dummy implementation
|
||||
* Set section/graph entries in $graph_enable for graphs specific to $os.
|
||||
*/
|
||||
function enable_os_graphs($os, &$graph_enable)
|
||||
{
|
||||
/*
|
||||
foreach (dbFetchRows("SELECT * FROM graph_conditions WHERE graph_type = 'device' AND condition_name = 'os' AND condition_value = ?", array($os)) as $graph) {
|
||||
$graph_enable[$graph['graph_section']][$graph['graph_subtype']] = "device_".$graph['graph_subtype'];
|
||||
}
|
||||
*/
|
||||
} // enable_os_graphs
|
||||
|
||||
|
||||
/*
|
||||
* For each os-based or global graph relevant to $device, set its section/graph entry in $graph_enable.
|
||||
*/
|
||||
function enable_graphs($device, &$graph_enable)
|
||||
{
|
||||
// These are standard graphs we should have for all systems
|
||||
$graph_enable['poller']['poller_perf'] = 'device_poller_perf';
|
||||
if (can_ping_device($device) === true) {
|
||||
$graph_enable['poller']['ping_perf'] = 'device_ping_perf';
|
||||
}
|
||||
|
||||
enable_os_graphs($device['os'], $graph_enable);
|
||||
} // enable_graphs
|
||||
|
||||
|
||||
//
|
||||
// maintain a simple cache of objects
|
||||
//
|
||||
|
||||
function object_add_cache($section, $obj)
|
||||
{
|
||||
global $object_cache;
|
||||
$object_cache[$section][$obj] = true;
|
||||
} // object_add_cache
|
||||
|
||||
|
||||
function object_is_cached($section, $obj)
|
||||
{
|
||||
global $object_cache;
|
||||
if (array_key_exists($obj, $object_cache)) {
|
||||
return $object_cache[$section][$obj];
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
} // object_is_cached
|
||||
|
||||
|
||||
/**
|
||||
* Checks if config allows us to ping this device
|
||||
* $attribs contains an array of all of this devices
|
||||
@@ -775,6 +919,69 @@ function can_ping_device($attribs) {
|
||||
}
|
||||
} // end can_ping_device
|
||||
|
||||
|
||||
/*
|
||||
* @return true if the requested module type & name is globally enabled
|
||||
*/
|
||||
function is_module_enabled($type, $module)
|
||||
{
|
||||
global $config;
|
||||
if (isset($config[$type.'_modules'][$module])) {
|
||||
return $config[$type.'_modules'][$module] == 1;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
} // is_module_enabled
|
||||
|
||||
|
||||
/*
|
||||
* @return true if every string in $arr begins with $str
|
||||
*/
|
||||
function begins_with($str, $arr)
|
||||
{
|
||||
foreach ($arr as $s) {
|
||||
$pos = strpos($s, $str);
|
||||
if ($pos === false || $pos > 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} // begins_with
|
||||
|
||||
|
||||
/*
|
||||
* @return the longest starting portion of $str that matches everything in $arr
|
||||
*/
|
||||
function longest_matching_prefix($str, $arr)
|
||||
{
|
||||
$len = strlen($str);
|
||||
while ($len > 0) {
|
||||
$prefix = substr($str, 0, $len);
|
||||
if (begins_with($prefix, $arr)) {
|
||||
return $prefix;
|
||||
}
|
||||
$len -= 1;
|
||||
}
|
||||
return '';
|
||||
} // longest_matching_prefix
|
||||
|
||||
|
||||
function search_phrase_column($c)
|
||||
{
|
||||
global $searchPhrase;
|
||||
return "$c LIKE '%$searchPhrase%'";
|
||||
} // search_phrase_column
|
||||
|
||||
|
||||
function print_mib_poller_disabled() {
|
||||
echo '<h4>MIB polling is not enabled</h4>
|
||||
<p>
|
||||
Set <tt>$config[\'poller_modules\'][\'mib\'] = 1;</tt> in <tt>config.php</tt> to enable.
|
||||
</p>';
|
||||
} // print_mib_poller_disabled
|
||||
|
||||
|
||||
/**
|
||||
* Constructs the path to an RRD for the Ceph application
|
||||
* @param string $gtype The type of rrd we're looking for
|
||||
@@ -794,7 +1001,7 @@ function ceph_rrd($gtype) {
|
||||
|
||||
$rrd = join('-', array('app', 'ceph', $vars['id'], $gtype, $var)).'.rrd';
|
||||
return join('/', array($config['rrd_dir'], $device['hostname'], $rrd));
|
||||
}
|
||||
} // ceph_rrd
|
||||
|
||||
/**
|
||||
* Parse location field for coordinates
|
||||
|
||||
@@ -316,6 +316,17 @@ $config['graph_colours']['purples'] = array(
|
||||
);
|
||||
$config['graph_colours']['default'] = $config['graph_colours']['blues'];
|
||||
|
||||
// Colour values from http://www.sapdesignguild.org/goodies/diagram_guidelines/color_palettes.html
|
||||
$config['graph_colours']['manycolours'] = array(
|
||||
"FFF8A3", "FAE16B", "F8D753", "F3C01C", "F0B400", // yellows
|
||||
"A9CC8F", "82B16A", "5C9746", "3D8128", "1E6C0B", // greens
|
||||
"B2C8D9", "779DBF", "3E75A7", "205F9A", "00488C", // blues
|
||||
"BEA37A", "907A52", "7A653E", "63522B", "3D3000", // browns
|
||||
"F3AA79", "EB8953", "E1662A", "DC5313", "D84000", // oranges
|
||||
"B5B5A9", "8B8D82", "74796F", "5D645A", "434C43", // greys
|
||||
"E6A4A5", "D6707B", "C4384F", "BC1C39", "B30023", // pinks
|
||||
);
|
||||
|
||||
// Map colors
|
||||
$config['network_map_legend'] = array(
|
||||
'0' => '#aeaeae',
|
||||
|
||||
@@ -511,6 +511,14 @@ $config['os'][$os]['icon'] = 'saf';
|
||||
$config['os'][$os]['over'][0]['graph'] = 'device_bits';
|
||||
$config['os'][$os]['over'][0]['text'] = 'Traffic';
|
||||
|
||||
// Sub10
|
||||
$os = 'sub10';
|
||||
$config['os'][$os]['text'] = 'Sub10 Systems';
|
||||
$config['os'][$os]['type'] = 'wireless';
|
||||
$config['os'][$os]['icon'] = 'sub10';
|
||||
$config['os'][$os]['over'][0]['graph'] = 'device_bits';
|
||||
$config['os'][$os]['over'][0]['text'] = 'Traffic';
|
||||
|
||||
// Supermicro Switch
|
||||
$os = 'supermicro-switch';
|
||||
$config['os'][$os]['group'] = 'supermicro';
|
||||
@@ -1546,6 +1554,31 @@ $config['graph_types']['device']['siklu_rfinterfaceOtherOctets']['section'] = 'w
|
||||
$config['graph_types']['device']['siklu_rfinterfaceOtherOctets']['order'] = '6';
|
||||
$config['graph_types']['device']['siklu_rfinterfaceOtherOctets']['descr'] = 'Other Octets';
|
||||
|
||||
// Sub10 support
|
||||
$config['graph_types']['device']['sub10_sub10RadioLclTxPower']['section'] = 'wireless';
|
||||
$config['graph_types']['device']['sub10_sub10RadioLclTxPower']['order'] = '0';
|
||||
$config['graph_types']['device']['sub10_sub10RadioLclTxPower']['descr'] = 'Radio Transmit Power';
|
||||
|
||||
$config['graph_types']['device']['sub10_sub10RadioLclRxPower']['section'] = 'wireless';
|
||||
$config['graph_types']['device']['sub10_sub10RadioLclRxPower']['order'] = '1';
|
||||
$config['graph_types']['device']['sub10_sub10RadioLclRxPower']['descr'] = 'Radio Receive Power';
|
||||
|
||||
$config['graph_types']['device']['sub10_sub10RadioLclVectErr']['section'] = 'wireless';
|
||||
$config['graph_types']['device']['sub10_sub10RadioLclVectErr']['order'] = '3';
|
||||
$config['graph_types']['device']['sub10_sub10RadioLclVectErr']['descr'] = 'Radio Vector Error';
|
||||
|
||||
$config['graph_types']['device']['sub10_sub10RadioLclLnkLoss']['section'] = 'wireless';
|
||||
$config['graph_types']['device']['sub10_sub10RadioLclLnkLoss']['order'] = '3';
|
||||
$config['graph_types']['device']['sub10_sub10RadioLclLnkLoss']['descr'] = 'Radio Link Loss';
|
||||
|
||||
$config['graph_types']['device']['sub10_sub10RadioLclAFER']['section'] = 'wireless';
|
||||
$config['graph_types']['device']['sub10_sub10RadioLclAFER']['order'] = '4';
|
||||
$config['graph_types']['device']['sub10_sub10RadioLclAFER']['descr'] = 'Radio Air Frame Error Rate';
|
||||
|
||||
$config['graph_types']['device']['sub10_sub10RadioLclDataRate']['section'] = 'wireless';
|
||||
$config['graph_types']['device']['sub10_sub10RadioLclDataRate']['order'] = '4';
|
||||
$config['graph_types']['device']['sub10_sub10RadioLclDataRate']['descr'] = 'Data Rate on the Airside interface';
|
||||
|
||||
$config['graph_types']['device']['wifi_clients']['section'] = 'wireless';
|
||||
$config['graph_types']['device']['wifi_clients']['order'] = '0';
|
||||
$config['graph_types']['device']['wifi_clients']['descr'] = 'Wireless Clients';
|
||||
|
||||
@@ -60,12 +60,12 @@ foreach (dbFetchRows($sql, array($deviceid)) as $entry) {
|
||||
}
|
||||
|
||||
// Attempt discovery of each IP only once per run.
|
||||
if (arp_discovery_is_cached($ip)) {
|
||||
if (object_is_cached('arp_discovery', $ip)) {
|
||||
echo '.';
|
||||
continue;
|
||||
}
|
||||
|
||||
arp_discovery_add_cache($ip);
|
||||
object_add_cache('arp_discovery', $ip);
|
||||
|
||||
$name = gethostbyaddr($ip);
|
||||
echo '+';
|
||||
|
||||
@@ -120,7 +120,10 @@ function discover_device($device, $options=null) {
|
||||
else {
|
||||
foreach ($config['discovery_modules'] as $module => $module_status) {
|
||||
if ($attribs['discover_'.$module] || ( $module_status && !isset($attribs['discover_'.$module]))) {
|
||||
$module_start = microtime(true);
|
||||
include 'includes/discovery/'.$module.'.inc.php';
|
||||
$module_time = microtime(true) - $module_start;
|
||||
echo "Runtime for discovery module '$module': $module_time\n";
|
||||
}
|
||||
else if (isset($attribs['discover_'.$module]) && $attribs['discover_'.$module] == '0') {
|
||||
echo "Module [ $module ] disabled on host.\n";
|
||||
@@ -131,6 +134,11 @@ function discover_device($device, $options=null) {
|
||||
}
|
||||
}
|
||||
|
||||
if (is_mib_poller_enabled($device)) {
|
||||
$devicemib = array($device['sysObjectID'] => 'all');
|
||||
register_mibs($device, $devicemib, "includes/discovery/functions.inc.php");
|
||||
}
|
||||
|
||||
// Set type to a predefined type for the OS if it's not already set
|
||||
if ($device['type'] == 'unknown' || $device['type'] == '') {
|
||||
if ($config['os'][$device['os']]['type']) {
|
||||
@@ -575,7 +583,6 @@ function discover_processor(&$valid, $device, $oid, $index, $type, $descr, $prec
|
||||
'processor_precision' => $precision,
|
||||
);
|
||||
dbUpdate($update_data, 'processors', '`device_id`=? AND `processor_index`=? AND `processor_type`=?', array($device['device_id'], $index, $type));
|
||||
d_echo($query."\n");
|
||||
}//end if
|
||||
$valid[$type][$index] = 1;
|
||||
}//end if
|
||||
@@ -630,7 +637,6 @@ function discover_mempool(&$valid, $device, $index, $type, $descr, $precision='1
|
||||
}
|
||||
|
||||
dbUpdate($update_data, 'mempools', 'device_id=? AND mempool_index=? AND mempool_type=?', array($device['device_id'], $index, $type));
|
||||
d_echo($query."\n");
|
||||
}//end if
|
||||
$valid[$type][$index] = 1;
|
||||
}//end if
|
||||
@@ -704,25 +710,3 @@ function discover_process_ipv6(&$valid, $ifIndex, $ipv6_address, $ipv6_prefixlen
|
||||
}//end if
|
||||
|
||||
}//end discover_process_ipv6()
|
||||
|
||||
|
||||
// maintain a simple cache of seen IPs during ARP discovery
|
||||
|
||||
|
||||
function arp_discovery_add_cache($ip) {
|
||||
global $arp_discovery;
|
||||
$arp_discovery[$ip] = true;
|
||||
|
||||
}//end arp_discovery_add_cache()
|
||||
|
||||
|
||||
function arp_discovery_is_cached($ip) {
|
||||
global $arp_discovery;
|
||||
if (array_key_exists($ip, $arp_discovery)) {
|
||||
return $arp_discovery[$ip];
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}//end arp_discovery_is_cached()
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* LibreNMS Ruckus Wireless OS information module
|
||||
*
|
||||
* Copyright (c) 2015 Søren Friis Rosiak <sorenrosiak@gmail.com>
|
||||
* 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
|
||||
@@ -13,5 +15,13 @@
|
||||
if (!$os) {
|
||||
if (strstr($sysObjectId, '.1.3.6.1.4.1.25053.3.1')) {
|
||||
$os = 'ruckuswireless';
|
||||
|
||||
$ruckus_mibs = array(
|
||||
"ruckusZDSystemStats" => "RUCKUS-ZD-SYSTEM-MIB",
|
||||
"ruckusZDWLANTable" => "RUCKUS-ZD-WLAN-MIB",
|
||||
"ruckusZDWLANAPTable" => "RUCKUS-ZD-WLAN-MIB",
|
||||
"ruckusZDWLANAPRadioStatsTable" => "RUCKUS-ZD-WLAN-MIB",
|
||||
);
|
||||
register_mibs($device, $ruckus_mibs, "includes/discovery/os/ruckuswireless.inc.php");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS Sub10 OS information module
|
||||
*/
|
||||
|
||||
if (!$os) {
|
||||
if (strstr($sysObjectId, '.1.3.6.1.4.1.39003')) {
|
||||
$os = 'sub10';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
if ($device['os'] == 'sub10') {
|
||||
echo 'Sub10 temperature ';
|
||||
|
||||
// Get Current Value
|
||||
$temp_oid = 'sub10UnitLclMWUTemperature.0';
|
||||
list($oid, $current) = explode(' ', snmp_get($device, $temp_oid, '-OsqnU', 'SUB10SYSTEMS-MIB'));
|
||||
|
||||
// Get Alarm Ranges
|
||||
$alarm_oid = 'sub10UnitMgmtAlarmName';
|
||||
$alarms = snmp_walk($device, $alarm_oid, '-OsqU', 'SUB10SYSTEMS-MIB');
|
||||
$indexes = array();
|
||||
foreach (explode("\n", $alarms) as $alarm) {
|
||||
if (preg_match('/^\w+\.(\d) MWU Temperature (.*)$/', $alarm, $matches)) {
|
||||
$indexes[strtolower($matches[2])] = $matches[1];
|
||||
}
|
||||
}
|
||||
|
||||
$thresh_oid = 'sub10UnitMgmtAlarmRaiseThresh';
|
||||
$threshes = snmp_walk($device, $thresh_oid, '-OsqU', 'SUB10SYSTEMS-MIB');
|
||||
$thresholds = array();
|
||||
foreach (explode("\n", $threshes) as $thresh) {
|
||||
preg_match('/^\w+\.(\d) (.*)$/', $thresh, $matches);
|
||||
$thresholds[$matches[1]] = $matches[2];
|
||||
}
|
||||
|
||||
// Create Sensor
|
||||
discover_sensor($valid['sensor'], 'temperature', $device, $oid, $oid,
|
||||
'sub10', 'Modem', '1', '1', $thresholds[$indexes['low']],
|
||||
null, null, $thresholds[$indexes['high']],
|
||||
$current);
|
||||
}
|
||||
@@ -19,81 +19,46 @@ if (($device['os'] == 'vmware') || ($device['os'] == 'linux')) {
|
||||
echo 'VMware VM: ';
|
||||
|
||||
/*
|
||||
* Fetch the list is Virtual Machines.
|
||||
*
|
||||
* vmwVmVMID.224 = INTEGER: 224
|
||||
* vmwVmVMID.416 = INTEGER: 416
|
||||
* ...
|
||||
* Fetch information about Virtual Machines.
|
||||
*/
|
||||
|
||||
$oids = snmp_walk($device, 'VMWARE-VMINFO-MIB::vmwVmVMID', '-Osqnv', '+VMWARE-ROOT-MIB:VMWARE-VMINFO-MIB', '+'.$config['install_dir'].'/mibs/vmware:'.$config['install_dir'].'/mibs');
|
||||
if (empty($oids)) {
|
||||
$oids = trim(snmp_walk($device, 'vmwVmUUID', '-Osq', '+VMWARE-ROOT-MIB:VMWARE-VMINFO-MIB', '+'.$config['install_dir'].'/mibs/vmware:'.$config['install_dir'].'/mibs'));
|
||||
$oids = str_replace('vmwVmUUID.', '', $oids);
|
||||
$oids = snmpwalk_cache_multi_oid($device, 'vmwVmTable', $oids, '+VMWARE-ROOT-MIB:VMWARE-VMINFO-MIB', '+'.$config['mib_dir'].'/vmware:'.$config['mib_dir']);
|
||||
|
||||
foreach ($oids as $index => $entry) {
|
||||
$vmwVmDisplayName = $entry['vmwVmDisplayName'];
|
||||
$vmwVmGuestOS = $entry['vmwVmGuestOS'];
|
||||
$vmwVmMemSize = $entry['vmwVmMemSize'];
|
||||
$vmwVmState = $entry['vmwVmState'];
|
||||
$vmwVmCpus = $entry['vmwVmCpus'];
|
||||
|
||||
/*
|
||||
* VMware does not return an INTEGER but a STRING of the vmwVmMemSize. This bug
|
||||
* might be resolved by VMware in the future making this code obsolete.
|
||||
*/
|
||||
if (preg_match('/^([0-9]+) .*$/', $vmwVmMemSize, $matches)) {
|
||||
$vmwVmMemSize = $matches[1];
|
||||
}
|
||||
|
||||
/*
|
||||
* Check whether the Virtual Machine is already known for this host.
|
||||
*/
|
||||
if (dbFetchCell("SELECT COUNT(id) FROM `vminfo` WHERE `device_id` = ? AND `vmwVmVMID` = ? AND vm_type='vmware'", array($device['device_id'], $index)) == 0) {
|
||||
$vmid = dbInsert(array('device_id' => $device['device_id'], 'vm_type' => 'vmware', 'vmwVmVMID' => $index, 'vmwVmDisplayName' => mres($vmwVmDisplayName), 'vmwVmGuestOS' => mres($vmwVmGuestOS), 'vmwVmMemSize' => mres($vmwVmMemSize), 'vmwVmCpus' => mres($vmwVmCpus), 'vmwVmState' => mres($vmwVmState)), 'vminfo');
|
||||
log_event(mres($vmwVmDisplayName)." ($vmwVmMemSize GB / $vmwVmCpus vCPU) Discovered", $device, 'system', $vmid);
|
||||
echo '+';
|
||||
// FIXME eventlog
|
||||
}
|
||||
else {
|
||||
echo '.';
|
||||
}
|
||||
|
||||
/*
|
||||
* Save the discovered Virtual Machine.
|
||||
*/
|
||||
|
||||
$vmw_vmlist[] = $index;
|
||||
}
|
||||
|
||||
if ($oids != '') {
|
||||
$oids = explode("\n", $oids);
|
||||
|
||||
foreach ($oids as $data) {
|
||||
$data = trim($data);
|
||||
list($oid,) = explode(' ', $data);
|
||||
/*
|
||||
* Fetch the Virtual Machine information.
|
||||
*
|
||||
* vmwVmDisplayName.224 = STRING: My First VM
|
||||
* vmwVmDisplayName.416 = STRING: My Second VM
|
||||
* vmwVmGuestOS.224 = STRING: windows7Server64Guest
|
||||
* vmwVmGuestOS.416 = STRING: winLonghornGuest
|
||||
* vmwVmMemSize.224 = INTEGER: 8192 megabytes
|
||||
* vmwVmMemSize.416 = INTEGER: 8192 megabytes
|
||||
* vmwVmState.224 = STRING: poweredOn
|
||||
* vmwVmState.416 = STRING: poweredOn
|
||||
* vmwVmVMID.224 = INTEGER: 224
|
||||
* vmwVmVMID.416 = INTEGER: 416
|
||||
* vmwVmCpus.224 = INTEGER: 2
|
||||
* vmwVmCpus.416 = INTEGER: 2
|
||||
*/
|
||||
|
||||
|
||||
$vmwVmDisplayName = snmp_get($device, 'vmwVmDisplayName.'.$oid, '-Osqnv', '+VMWARE-ROOT-MIB:VMWARE-VMINFO-MIB', '+'.$config['install_dir'].'/mibs/vmware:'.$config['install_dir'].'/mibs');
|
||||
$vmwVmGuestOS = snmp_get($device, 'vmwVmGuestOS.'.$oid, '-Osqnv', '+VMWARE-ROOT-MIB:VMWARE-VMINFO-MIB', '+'.$config['install_dir'].'/mibs/vmware:'.$config['install_dir'].'/mibs');
|
||||
$vmwVmMemSize = snmp_get($device, 'vmwVmMemSize.'.$oid, '-Osqnv', '+VMWARE-ROOT-MIB:VMWARE-VMINFO-MIB', '+'.$config['install_dir'].'/mibs/vmware:'.$config['install_dir'].'/mibs');
|
||||
$vmwVmState = snmp_get($device, 'vmwVmState.'.$oid, '-Osqnv', '+VMWARE-ROOT-MIB:VMWARE-VMINFO-MIB', '+'.$config['install_dir'].'/mibs/vmware:'.$config['install_dir'].'/mibs');
|
||||
$vmwVmCpus = snmp_get($device, 'vmwVmCpus.'.$oid, '-Osqnv', '+VMWARE-ROOT-MIB:VMWARE-VMINFO-MIB', '+'.$config['install_dir'].'/mibs/vmware:'.$config['install_dir'].'/mibs');
|
||||
|
||||
/*
|
||||
* VMware does not return an INTEGER but a STRING of the vmwVmMemSize. This bug
|
||||
* might be resolved by VMware in the future making this code obsolete.
|
||||
*/
|
||||
|
||||
if (preg_match('/^([0-9]+) .*$/', $vmwVmMemSize, $matches)) {
|
||||
$vmwVmMemSize = $matches[1];
|
||||
}
|
||||
|
||||
/*
|
||||
* Check whether the Virtual Machine is already known for this host.
|
||||
*/
|
||||
|
||||
if (dbFetchCell("SELECT COUNT(id) FROM `vminfo` WHERE `device_id` = ? AND `vmwVmVMID` = ? AND vm_type='vmware'", array($device['device_id'], $oid)) == 0) {
|
||||
$vmid = dbInsert(array('device_id' => $device['device_id'], 'vm_type' => 'vmware', 'vmwVmVMID' => $oid, 'vmwVmDisplayName' => mres($vmwVmDisplayName), 'vmwVmGuestOS' => mres($vmwVmGuestOS), 'vmwVmMemSize' => mres($vmwVmMemSize), 'vmwVmCpus' => mres($vmwVmCpus), 'vmwVmState' => mres($vmwVmState)), 'vminfo');
|
||||
log_event(mres($vmwVmDisplayName)." ($vmwVmMemSize GB / $vmwVmCpus vCPU) Discovered", $device, 'system', $vmid);
|
||||
echo '+';
|
||||
// FIXME eventlog
|
||||
}
|
||||
else {
|
||||
echo '.';
|
||||
}
|
||||
|
||||
// FIXME update code!
|
||||
/*
|
||||
* Save the discovered Virtual Machine.
|
||||
*/
|
||||
|
||||
$vmw_vmlist[] = $oid;
|
||||
}//end foreach
|
||||
}//end if
|
||||
|
||||
/*
|
||||
* Get a list of all the known Virtual Machines for this host.
|
||||
*/
|
||||
|
||||
@@ -22,6 +22,7 @@ include_once($config['install_dir'] . "/includes/dbFacile.php");
|
||||
|
||||
include_once($config['install_dir'] . "/includes/common.php");
|
||||
include_once($config['install_dir'] . "/includes/rrdtool.inc.php");
|
||||
include_once($config['install_dir'] . "/includes/influxdb.inc.php");
|
||||
include_once($config['install_dir'] . "/includes/billing.php");
|
||||
include_once($config['install_dir'] . "/includes/cisco-entities.php");
|
||||
include_once($config['install_dir'] . "/includes/syslog.php");
|
||||
@@ -1230,6 +1231,12 @@ function function_check($function) {
|
||||
return function_exists($function);
|
||||
}
|
||||
|
||||
function force_influx_data($type,$data) {
|
||||
if ($type == 'f' || $type == 'float') {
|
||||
return(sprintf("%.1f",$data));
|
||||
}
|
||||
}// end force_influx_data
|
||||
|
||||
/**
|
||||
* Try to determine the address family (IPv4 or IPv6) associated with an SNMP
|
||||
* transport specifier (like "udp", "udp6", etc.).
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* LibreNMS
|
||||
*
|
||||
* Copyright (c) 2014 Neil Lathwood <https://github.com/laf/ http://www.lathwood.co.uk/fa>
|
||||
*
|
||||
* 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 ($config['influxdb']['enable'] === true) {
|
||||
include $config['install_dir'].'/lib/influxdb-php/vendor/autoload.php';
|
||||
}//end if
|
||||
|
||||
function influxdb_connect() {
|
||||
global $config;
|
||||
|
||||
$influxdb_cred = '';
|
||||
if (!empty($config['influxdb']['username']) && !empty($config['influxdb']['password'])) {
|
||||
$influxdb_cred = $config['influxdb']['username'].':'.$config['influxdb']['password'].'@';
|
||||
d_echo('Using authentication for InfluxDB');
|
||||
}
|
||||
$influxdb_url = $influxdb_cred.$config['influxdb']['host'].':'.$config['influxdb']['port'].'/'.$config['influxdb']['db'];
|
||||
d_echo($config['influxdb']['transport'] . " transport being used");
|
||||
if ($config['influxdb']['transport'] == 'http') {
|
||||
$influxdb_conn = 'influxdb';
|
||||
}
|
||||
elseif ($config['influxdb']['transport'] == 'udp') {
|
||||
$influxdb_conn = 'udp+influxdb';
|
||||
}
|
||||
else {
|
||||
echo 'InfluxDB support enabled but no valid transport details provided';
|
||||
return false;
|
||||
}
|
||||
|
||||
$db = \InfluxDB\Client::fromDSN($influxdb_conn.'://'.$influxdb_url);
|
||||
return($db);
|
||||
|
||||
}// end influxdb_connect
|
||||
|
||||
function influx_update($device,$measurement,$tags=array(),$fields) {
|
||||
global $influxdb,$config,$console_color;
|
||||
if ($influxdb !== false) {
|
||||
$tmp_fields = array();
|
||||
$tmp_tags['hostname'] = $device['hostname'];
|
||||
foreach ($tags as $k => $v) {
|
||||
$v = preg_replace(array('/ /','/,/','/=/'),array('\ ','\,','\='), $v);
|
||||
if (empty($v)) {
|
||||
$v = '_blank_';
|
||||
}
|
||||
$tmp_tags[$k] = $v;
|
||||
}
|
||||
foreach ($fields as $k => $v) {
|
||||
$tmp_fields[$k] = force_influx_data('f',$v);
|
||||
}
|
||||
|
||||
d_echo("\nInfluxDB data:\n");
|
||||
d_echo($measurement);
|
||||
d_echo($tmp_tags);
|
||||
d_echo($tmp_fields);
|
||||
d_echo("\nEND\n");
|
||||
|
||||
if ($config['noinfluxdb'] !== true) {
|
||||
$points = array(
|
||||
new InfluxDB\Point(
|
||||
$measurement,
|
||||
null, // the measurement value
|
||||
$tmp_tags,
|
||||
$tmp_fields // optional additional fields
|
||||
)
|
||||
);
|
||||
$result = $influxdb->writePoints($points);
|
||||
}
|
||||
else {
|
||||
print $console_color->convert('[%gInfluxDB Disabled%n] ', false);
|
||||
}//end if
|
||||
}//end if
|
||||
}// end influx_update
|
||||
|
||||
@@ -14,9 +14,14 @@
|
||||
|
||||
// load graph types from the database
|
||||
foreach (dbFetchRows('select * from graph_types') as $graph) {
|
||||
// remove leading 'graph_' from column names
|
||||
foreach ($graph as $k => $v) {
|
||||
$key = strpos($k, 'graph_') == 0 ? str_replace('graph_', '', $k) : $k;
|
||||
if (strpos($k, 'graph_') == 0) {
|
||||
// remove leading 'graph_' from column name
|
||||
$key = str_replace('graph_', '', $k);
|
||||
}
|
||||
else {
|
||||
$key = $k;
|
||||
}
|
||||
$g[$key] = $v;
|
||||
}
|
||||
|
||||
|
||||
@@ -42,6 +42,10 @@ if ($device['os'] == 'asa' || $device['os'] == 'pix') {
|
||||
|
||||
if ($data_array[0]['alSslStatsTotalSessions'] || is_file($rrdfile)) {
|
||||
rrdtool_update($rrdfile, $fields);
|
||||
|
||||
$tags = array();
|
||||
influx_update($device,'altiga-ssl',$tags,$fields);
|
||||
|
||||
}
|
||||
|
||||
unset($rrdfile, $fields, $data_array);
|
||||
|
||||
@@ -70,3 +70,7 @@ $fields = array(
|
||||
);
|
||||
|
||||
rrdtool_update($rrd_filename, $fields);
|
||||
|
||||
$tags = array('name' => 'apache', 'app_id' => $app['app_id']);
|
||||
influx_update($device,'app',$tags,$fields);
|
||||
|
||||
|
||||
@@ -101,4 +101,7 @@ if (!empty($agent_data['app']['bind']) && $app['app_id'] > 0) {
|
||||
|
||||
rrdtool_update($rrd_filename, $fields);
|
||||
|
||||
$tags = array('name' => 'bind', 'app_id' => $app['app_id']);
|
||||
influx_update($device,'app',$tags,$fields);
|
||||
|
||||
}//end if
|
||||
|
||||
@@ -43,4 +43,7 @@ $fields = array(
|
||||
|
||||
rrdtool_update($rrd_filename, $fields);
|
||||
|
||||
$tags = array('name' => 'drbd', 'app_id' => $app['app_id']);
|
||||
influx_update($device,'app',$tags,$fields);
|
||||
|
||||
unset($drbd);
|
||||
|
||||
@@ -36,3 +36,7 @@ $fields = array(
|
||||
);
|
||||
|
||||
rrdtool_update($rrd_filename, $fields);
|
||||
|
||||
$tags = array('name' => 'mailscannerV2', 'app_id' => $app['app_id']);
|
||||
influx_update($device,'app',$tags,$fields);
|
||||
|
||||
|
||||
@@ -54,3 +54,7 @@ $fields = array(
|
||||
);
|
||||
|
||||
rrdtool_update($rrd_filename, $fields);
|
||||
|
||||
$tags = array('name' => 'memcached', 'app_id' => $app['app_id']);
|
||||
influx_update($device,'app',$tags,$fields);
|
||||
|
||||
|
||||
@@ -204,6 +204,9 @@ if (!is_file($mysql_rrd)) {
|
||||
|
||||
rrdtool_update($mysql_rrd, $fields);
|
||||
|
||||
$tags = array('name' => 'mysql', 'app_id' => $app['app_id']);
|
||||
influx_update($device,'app',$tags,$fields);
|
||||
|
||||
// Process state statistics
|
||||
$mysql_status_rrd = $config['rrd_dir'].'/'.$device['hostname'].'/app-mysql-'.$app['app_id'].'-status.rrd';
|
||||
|
||||
@@ -241,3 +244,7 @@ if (!is_file($mysql_status_rrd)) {
|
||||
}
|
||||
|
||||
rrdtool_update($mysql_status_rrd, $fields);
|
||||
|
||||
$tags = array('name' => 'mysql', 'app_id' => $app['app_id'], 'status' => true);
|
||||
influx_update($device,'app',$tags,$fields);
|
||||
|
||||
|
||||
@@ -36,6 +36,9 @@ $fields = array(
|
||||
|
||||
rrdtool_update($nginx_rrd, $fields);
|
||||
|
||||
$tags = array('name' => 'nginx', 'app_id' => $app['app_id']);
|
||||
influx_update($device,'app',$tags,$fields);
|
||||
|
||||
// Unset the variables we set here
|
||||
unset($nginx);
|
||||
unset($nginx_rrd);
|
||||
|
||||
@@ -32,3 +32,7 @@ $fields = array(
|
||||
);
|
||||
|
||||
rrdtool_update($rrd_filename, $fields);
|
||||
|
||||
$tags = array('name' => 'ntpclient', 'app_id' => $app['app_id']);
|
||||
influx_update($device,'app',$tags,$fields);
|
||||
|
||||
|
||||
@@ -53,3 +53,6 @@ $fields = array(
|
||||
);
|
||||
|
||||
rrdtool_update($rrd_filename, $fields);
|
||||
|
||||
$tags = array('name' => 'ntpdserver', 'app_id' => $app['app_id']);
|
||||
influx_update($device,'app',$tags,$fields);
|
||||
|
||||
@@ -76,3 +76,7 @@ $fields = array(
|
||||
);
|
||||
|
||||
rrdtool_update($rrd_filename, $fields);
|
||||
|
||||
$tags = array('name' => 'powerdns', 'app_id' => $app['app_id']);
|
||||
influx_update($device,'app',$tags,$fields);
|
||||
|
||||
|
||||
@@ -54,5 +54,8 @@ foreach ($servers as $item => $server) {
|
||||
|
||||
rrdtool_update($rrdfile, $fields);
|
||||
|
||||
$tags = array('name' => 'shoutcast', 'app_id' => $app['app_id'], 'host' => $host, 'port' => $port);
|
||||
influx_update($device,'app',$tags,$fields);
|
||||
|
||||
}//end if
|
||||
}//end foreach
|
||||
|
||||
@@ -55,4 +55,8 @@ if (!empty($agent_data['app']['tinydns']) && $app['app_id'] > 0) {
|
||||
}//end if
|
||||
|
||||
rrdtool_update($rrd_filename, 'N:'.$agent_data['app']['tinydns']);
|
||||
|
||||
$tags = array('name' => 'tinydns', 'app_id' => $app['app_id']);
|
||||
influx_update($device,'app',$tags,$fields);
|
||||
|
||||
}//end if
|
||||
|
||||
@@ -56,6 +56,9 @@ if ($device['type'] == 'wireless' && $device['os'] == 'arubaos') {
|
||||
);
|
||||
$ret = rrdtool_update($rrdfile, $fields);
|
||||
|
||||
$tags = array();
|
||||
influx_update($device,'aruba-controller',$tags,$fields);
|
||||
|
||||
// also save the info about how many clients in the same place as the wireless module
|
||||
$wificlientsrrd = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename('wificlients-radio1.rrd');
|
||||
|
||||
@@ -68,6 +71,9 @@ if ($device['type'] == 'wireless' && $device['os'] == 'arubaos') {
|
||||
);
|
||||
rrdtool_update($wificlientsrrd, $fields);
|
||||
|
||||
$tags = array('radio' => '1');
|
||||
influx_update($device,'wificlients',$tags,$fields);
|
||||
|
||||
$graphs['wifi_clients'] = true;
|
||||
|
||||
|
||||
@@ -127,6 +133,9 @@ if ($device['type'] == 'wireless' && $device['os'] == 'arubaos') {
|
||||
|
||||
rrdtool_update($rrd_file, $fields);
|
||||
|
||||
$tags = array('name' => $name, 'radionum' => $radionum);
|
||||
influx_update($device,'aruba',$tags,$fields);
|
||||
|
||||
}
|
||||
|
||||
// generate the mac address
|
||||
|
||||
@@ -160,6 +160,9 @@ if ($config['enable_bgp']) {
|
||||
);
|
||||
rrdtool_update("$peerrrd", $fields);
|
||||
|
||||
$tags = array('bgpPeerIdentifier' => $peer['bgpPeerIdentifier']);
|
||||
influx_update($device,'bgp',$tags,$fields);
|
||||
|
||||
$peer['update']['bgpPeerState'] = $bgpPeerState;
|
||||
$peer['update']['bgpPeerAdminStatus'] = $bgpPeerAdminStatus;
|
||||
$peer['update']['bgpPeerFsmEstablishedTime'] = $bgpPeerFsmEstablishedTime;
|
||||
@@ -322,6 +325,9 @@ if ($config['enable_bgp']) {
|
||||
);
|
||||
rrdtool_update("$cbgp_rrd", $fields);
|
||||
|
||||
$tags = array('bgpPeerIdentifier' => $peer['bgpPeerIdentifier'], 'afi' => $afi, 'safi' => $safi);
|
||||
influx_update($device,'cbgp',$tags,$fields);
|
||||
|
||||
} //end foreach
|
||||
} //end if
|
||||
echo "\n";
|
||||
|
||||
@@ -96,6 +96,10 @@ foreach ($ipsec_array as $index => $tunnel) {
|
||||
rrdtool_create($rrd_file, $rrd_create);
|
||||
}
|
||||
rrdtool_update($rrd_file, $fields);
|
||||
|
||||
$tags = array('address' => $address);
|
||||
influx_update($device,'ipsectunnel',$tags,$fields);
|
||||
|
||||
// $graphs['ipsec_tunnels'] = TRUE;
|
||||
}
|
||||
}//end foreach
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user