mirror of
https://github.com/stylersnico/librenms.git
synced 2026-08-01 16:26:55 +02:00
rebased
This commit is contained in:
@@ -0,0 +1,19 @@
|
|||||||
|
# EditorConfig is awesome: http://EditorConfig.org
|
||||||
|
|
||||||
|
# top-most EditorConfig file
|
||||||
|
root = true
|
||||||
|
|
||||||
|
# Unix-style newlines with a newline ending every file
|
||||||
|
[*]
|
||||||
|
end_of_line = lf
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
|
[**.css]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
[**.php]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
@@ -11,3 +11,11 @@ nbproject
|
|||||||
.ircbot.alert
|
.ircbot.alert
|
||||||
.metadata_never_index
|
.metadata_never_index
|
||||||
*.swp
|
*.swp
|
||||||
|
|
||||||
|
# OS generated files #
|
||||||
|
######################
|
||||||
|
.DS_Store
|
||||||
|
.DS_Store?
|
||||||
|
.Spotlight-V100
|
||||||
|
.Trashes
|
||||||
|
Thumbs.db
|
||||||
|
|||||||
+24
-15
@@ -1,17 +1,16 @@
|
|||||||
LibreNMS is a fork of [Observium][1]. Observium was written by:
|
LibreNMS is a fork of [Observium][1].
|
||||||
- Adam Armstrong
|
|
||||||
- Tom Laermans
|
|
||||||
- various others as indicated in the file contents and commit logs
|
|
||||||
|
|
||||||
Contributors to LibreNMS:
|
LibreNMS core team:
|
||||||
- Paul Gear <paul@librenms.org> (paulgear)
|
- Paul Gear <paul@librenms.org> (paulgear)
|
||||||
- Neil Lathwood <neil@librenms.org> (laf)
|
- Neil Lathwood <neil@librenms.org> (laf)
|
||||||
- Daniel Preussker <f0o@librenms.org> (f0o)
|
- 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)
|
- Bohdan Sanders <git@bohdans.com> (bohdan-s)
|
||||||
- Toni Cunyat <elbuit@gmail.com> (elbuit)
|
- Toni Cunyat <elbuit@gmail.com> (elbuit)
|
||||||
- Tuomas Riihimäki <tuomari@iudex.fi> (tuomari)
|
- 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)
|
- Nicolas Armando <nicearma@yahoo.com> (nicearma)
|
||||||
- Micah Chasteen <mjchasteen@gmail.com> (mchasteen)
|
- Micah Chasteen <mjchasteen@gmail.com> (mchasteen)
|
||||||
- Kevin Fleshman <fleshmank@hotmail.com> (KFleshman)
|
- Kevin Fleshman <fleshmank@hotmail.com> (KFleshman)
|
||||||
@@ -26,13 +25,13 @@ Contributors to LibreNMS:
|
|||||||
- Mickael Marchand <mmarchand@corp.free.fr> (mmarchand)
|
- Mickael Marchand <mmarchand@corp.free.fr> (mmarchand)
|
||||||
- Mohammad Al-Shami <mohammad@al-shami.net> (mohshami)
|
- Mohammad Al-Shami <mohammad@al-shami.net> (mohshami)
|
||||||
- Rudy Hardeman <zarya@gigafreak.net> (zarya)
|
- Rudy Hardeman <zarya@gigafreak.net> (zarya)
|
||||||
- Freddie Cash (fjwcash@gmail.com) (fjwcash)
|
- Freddie Cash <fjwcash@gmail.com> (fjwcash)
|
||||||
- Thom Seddon <thom@seddonmedia.co.uk> (thomseddon)
|
- Thom Seddon <thom@seddonmedia.co.uk> (thomseddon)
|
||||||
- Vitali Kari <vitali.kari@gmail.com> (vitalisator)
|
- Vitali Kari <vitali.kari@gmail.com> (vitalisator)
|
||||||
- James Campbell <neokjames@gmail.com> (neokjames)
|
- James Campbell <neokjames@gmail.com> (neokjames)
|
||||||
- Steve Calvário <calvario.steve@gmail.com> (Calvario)
|
- Steve Calvário <calvario.steve@gmail.com> (Calvario)
|
||||||
- Christian Marg <marg@rz.tu-clausthal.de> (einhirn)
|
- 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)
|
- Clint Armstrong <clint@clintarmstrong.net> (clinta)
|
||||||
- Tony Ditchfield <tony.ditchfield@gmail.com> (arnoldthebat)
|
- Tony Ditchfield <tony.ditchfield@gmail.com> (arnoldthebat)
|
||||||
- Travis Hegner <travis.hegner@gmail.com> (travishegner)
|
- Travis Hegner <travis.hegner@gmail.com> (travishegner)
|
||||||
@@ -47,9 +46,9 @@ Contributors to LibreNMS:
|
|||||||
- Michael Newton <mnewton@pofp.com> (miken32)
|
- Michael Newton <mnewton@pofp.com> (miken32)
|
||||||
- Tom Ferguson <tom.ferguson.public@outlook.com> (Tawmu)
|
- Tom Ferguson <tom.ferguson.public@outlook.com> (Tawmu)
|
||||||
- Jimmy Cleuren <jimmy.cleuren@gmail.com> (jimmycleuren)
|
- 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)
|
- 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)
|
- Sergiusz Paprzycki <serek@walcz.net> (spaprzycki)
|
||||||
- Juho Vanhanen <juho@vanhanen.me> (juhovan)
|
- Juho Vanhanen <juho@vanhanen.me> (juhovan)
|
||||||
- Bart de Bruijn <bart_de_bruijn@yahoo.com> (bartdebruijn)
|
- Bart de Bruijn <bart_de_bruijn@yahoo.com> (bartdebruijn)
|
||||||
@@ -65,7 +64,7 @@ Contributors to LibreNMS:
|
|||||||
- Sebastian Neuner <sebastian@sneuner.org> (9er)
|
- Sebastian Neuner <sebastian@sneuner.org> (9er)
|
||||||
- Robert Zollner <wolfit_ro@yahoo.com> (Lupul)
|
- Robert Zollner <wolfit_ro@yahoo.com> (Lupul)
|
||||||
- Richard Hartmann <richih@debian.org> (RichiH)
|
- 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)
|
- Rob Gormley <robert@gormley.me> (rgormley)
|
||||||
- Richard Kojedzinszky <krichy@nmdps.net> (rkojedzinszky)
|
- Richard Kojedzinszky <krichy@nmdps.net> (rkojedzinszky)
|
||||||
- Tony Murray <murraytony@gmail.com> (murrant)
|
- Tony Murray <murraytony@gmail.com> (murrant)
|
||||||
@@ -74,5 +73,15 @@ Contributors to LibreNMS:
|
|||||||
- Rick Hodger <rick@fuzzi.org.uk> (Tatermen)
|
- Rick Hodger <rick@fuzzi.org.uk> (Tatermen)
|
||||||
- Eldon Koyle <ekoyle@gmail.com> (ekoyle)
|
- Eldon Koyle <ekoyle@gmail.com> (ekoyle)
|
||||||
- Jonathan Bailey <jcbailey@code0.net> (jcbailey2)
|
- Jonathan Bailey <jcbailey@code0.net> (jcbailey2)
|
||||||
- Ruairi Carroll <ruairi.carroll@gmail.com> (rucarrol)
|
- Ruairi Carroll <ruairi.carroll@gmail.com> (rucarrol)
|
||||||
|
- Maxim Tsyplakov <maxim.tsyplakov@gmail.com> (tsypa)
|
||||||
|
- D. Britz <github@wrind.de> (flatterlight)
|
||||||
|
- Tobias Herrmann <tobias@fiveninedigital.ch> (Mightea)
|
||||||
|
- Nicolas Guillaumin <nicolas+github@guillaumin.me> (nguillaumin)
|
||||||
|
|
||||||
[1]: http://observium.org/ "Observium web site"
|
[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
|
$(GIT_SUBTREE) --prefix=lib/vis https://github.com/almende/vis.git master
|
||||||
|
|
||||||
typeahead:
|
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:
|
gridster:
|
||||||
$(GIT_SUBTREE) --prefix=lib/gridster https://github.com/dsmorse/gridster.js.git master
|
$(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:
|
You can participate in the project by:
|
||||||
- Joining the [librenms-project][1] mailing list to post questions and
|
- Talking to us on IRC ([##librenms on Freenode][4]) or [Twitter][3].
|
||||||
suggestions.
|
- Joining the [librenms-project][1] mailing list.
|
||||||
- Talking to us on [Twitter][3] or [IRC][4].
|
|
||||||
- Improving the [documentation][5].
|
- 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.
|
See [CONTRIBUTING][15] for more details.
|
||||||
|
|
||||||
|
|
||||||
Try It
|
VM image
|
||||||
------
|
--------
|
||||||
|
|
||||||
You can try LibreNMS by downloading a VM image. Currently, a Ubuntu-based
|
You can try LibreNMS by downloading a VM image. Currently, a Ubuntu-based
|
||||||
image is supplied and has been tested with [VirtualBox][8].
|
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) 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
|
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
|
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/
|
[15]: http://docs.librenms.org/General/Contributing/
|
||||||
[16]: http://docs.librenms.org/
|
[16]: http://docs.librenms.org/
|
||||||
[17]: http://docs.librenms.org/General/Acknowledgement/
|
[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/geshi -prune -o \
|
||||||
-path ./html/includes/jpgraph -prune -o \
|
-path ./html/includes/jpgraph -prune -o \
|
||||||
-path ./html/js/jqplot -prune -o \
|
-path ./html/js/jqplot -prune -o \
|
||||||
|
-path ./lib -prune -o \
|
||||||
-path ./junk -prune -o \
|
-path ./junk -prune -o \
|
||||||
-path ./logs -prune -o \
|
-path ./logs -prune -o \
|
||||||
-path ./mibs -prune -o \
|
-path ./mibs -prune -o \
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ Take a look at https://dev.mysql.com/doc/refman/5.6/en/innodb-buffer-pool.html f
|
|||||||
|
|
||||||
The ' . $config['project_name'] . ' team.';
|
The ' . $config['project_name'] . ' team.';
|
||||||
send_mail($config['alert']['default_mail'],$subject,$message,$html=false);
|
send_mail($config['alert']['default_mail'],$subject,$message,$html=false);
|
||||||
}
|
}
|
||||||
echo warn_innodb_buffer($innodb_buffer);
|
echo warn_innodb_buffer($innodb_buffer);
|
||||||
exit(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
@@ -110,3 +110,19 @@ if ($options['f'] === 'device_perf') {
|
|||||||
if ($options['f'] === 'notifications') {
|
if ($options['f'] === 'notifications') {
|
||||||
include_once 'notifications.php';
|
include_once 'notifications.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($options['f'] === 'purgeusers') {
|
||||||
|
$purge = 0;
|
||||||
|
if (is_numeric($config['radius']['users_purge']) && $config['auth_mechanism'] === 'radius') {
|
||||||
|
$purge = $config['radius']['users_purge'];
|
||||||
|
}
|
||||||
|
if ($purge > 0) {
|
||||||
|
foreach (dbFetchRows("SELECT DISTINCT(`user`) FROM `authlog` WHERE `datetime` >= DATE_SUB(NOW(), INTERVAL ? DAY)", array($purge)) as $user) {
|
||||||
|
$users[] = $user['user'];
|
||||||
|
}
|
||||||
|
$del_users = '"'.implode('","',$users).'"';
|
||||||
|
if (dbDelete('users', "username NOT IN ($del_users)",array($del_users))) {
|
||||||
|
echo "Removed users that haven't logged in for $purge days";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,12 +4,12 @@
|
|||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
@@ -64,6 +64,7 @@ else
|
|||||||
php daily.php -f perf_times
|
php daily.php -f perf_times
|
||||||
php daily.php -f callback
|
php daily.php -f callback
|
||||||
php daily.php -f device_perf
|
php daily.php -f device_perf
|
||||||
|
php daily.php -f purgeusers
|
||||||
;;
|
;;
|
||||||
submodules)
|
submodules)
|
||||||
# Init+Update our submodules
|
# Init+Update our submodules
|
||||||
|
|||||||
+156
-1
@@ -19,6 +19,10 @@
|
|||||||
- [`add_device`](#api-route-11)
|
- [`add_device`](#api-route-11)
|
||||||
- [`list_oxidized`](#api-route-21)
|
- [`list_oxidized`](#api-route-21)
|
||||||
- [`update_device_field`](#api-route-update_device_field)
|
- [`update_device_field`](#api-route-update_device_field)
|
||||||
|
- [`get_device_groups`](#api-route-get_device_groups)
|
||||||
|
- [`devicegroups`](#api-devicegroups)
|
||||||
|
- [`get_devicegroups`](#api-route-get_devicegroups)
|
||||||
|
- [`get_devices_by_group`](#api-route-get_devices_by_group)
|
||||||
- [`routing`](#api-routing)
|
- [`routing`](#api-routing)
|
||||||
- [`list_bgp`](#api-route-1)
|
- [`list_bgp`](#api-route-1)
|
||||||
- [`switching`](#api-switching)
|
- [`switching`](#api-switching)
|
||||||
@@ -316,6 +320,7 @@ Input:
|
|||||||
- to: This is the date you would like the graph to end - See http://oss.oetiker.ch/rrdtool/doc/rrdgraph.en.html for more information.
|
- to: This is the date you would like the graph to end - See http://oss.oetiker.ch/rrdtool/doc/rrdgraph.en.html for more information.
|
||||||
- width: The graph width, defaults to 1075.
|
- width: The graph width, defaults to 1075.
|
||||||
- height: The graph height, defaults to 300.
|
- height: The graph height, defaults to 300.
|
||||||
|
- ifDescr: If this is set to true then we will use ifDescr to lookup the port instead of ifName. Pass the ifDescr value you want to search as you would ifName.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
```curl
|
```curl
|
||||||
@@ -469,6 +474,8 @@ Update devices field in the database.
|
|||||||
|
|
||||||
Route: /api/v0/devices/:hostname
|
Route: /api/v0/devices/:hostname
|
||||||
|
|
||||||
|
- hostname can be either the device hostname or id
|
||||||
|
|
||||||
Input (JSON):
|
Input (JSON):
|
||||||
|
|
||||||
- field: The column name within the database
|
- field: The column name within the database
|
||||||
@@ -490,6 +497,154 @@ Output:
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### <a name="api-route-get_device_groups">Function `get_device_groups`</a> [`top`](#top)
|
||||||
|
|
||||||
|
List the device groups that a device is matched on.
|
||||||
|
|
||||||
|
Route: /api/v0/devices/:hostname/groups
|
||||||
|
|
||||||
|
- hostname can be either the device hostname or id
|
||||||
|
|
||||||
|
Input (JSON):
|
||||||
|
|
||||||
|
-
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
```curl
|
||||||
|
curl -H 'X-Auth-Token: YOURAPITOKENHERE' https://librenms.org/api/v0/devices/localhost/groups
|
||||||
|
```
|
||||||
|
|
||||||
|
Output:
|
||||||
|
```text
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"status": "ok",
|
||||||
|
"message": "Found 1 device groups",
|
||||||
|
"count": 1,
|
||||||
|
"groups": [
|
||||||
|
{
|
||||||
|
"id": "1",
|
||||||
|
"name": "Testing",
|
||||||
|
"desc": "Testing",
|
||||||
|
"pattern": "%devices.status = \"1\" &&"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
## <a name="api-devicegroups">`Device Groups`</a> [`top`](#top)
|
||||||
|
|
||||||
|
### <a name="api-route-get_devicegroups">Function `get_devicegroups`</a> [`top`](#top)
|
||||||
|
|
||||||
|
List all device groups.
|
||||||
|
|
||||||
|
Route: /api/v0/devicegroups
|
||||||
|
|
||||||
|
Input (JSON):
|
||||||
|
|
||||||
|
-
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
```curl
|
||||||
|
curl -H 'X-Auth-Token: YOURAPITOKENHERE' https://librenms.org/api/v0/devicegroups
|
||||||
|
```
|
||||||
|
|
||||||
|
Output:
|
||||||
|
```text
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"status": "ok",
|
||||||
|
"message": "Found 1 device groups",
|
||||||
|
"count": 1,
|
||||||
|
"groups": [
|
||||||
|
{
|
||||||
|
"id": "1",
|
||||||
|
"name": "Testing",
|
||||||
|
"desc": "Testing",
|
||||||
|
"pattern": "%devices.status = \"1\" &&"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
### <a name="api-route-get_devices_by_group">Function `get_devices_by_group`</a> [`top`](#top)
|
||||||
|
|
||||||
|
List all devices matching the group provided.
|
||||||
|
|
||||||
|
Route: /api/v0/devicegroups/:name
|
||||||
|
|
||||||
|
- name Is the name of the device group which can be obtained using [`get_devicegroups`](#api-route-get_devicegroups). Please ensure that the name is urlencoded if it needs to be (i.e Linux Servers would need to be urlencoded.
|
||||||
|
|
||||||
|
Input (JSON):
|
||||||
|
|
||||||
|
-
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
```curl
|
||||||
|
curl -H 'X-Auth-Token: YOURAPITOKENHERE' https://librenms.org/api/v0/devicegroups/LinuxServers
|
||||||
|
```
|
||||||
|
|
||||||
|
Output:
|
||||||
|
```text
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"status": "error",
|
||||||
|
"message": "Found 1 in group LinuxServers",
|
||||||
|
"count": 1,
|
||||||
|
"devices": [
|
||||||
|
{
|
||||||
|
"device_id": "1",
|
||||||
|
"hostname": "localhost",
|
||||||
|
"sysName": "hostname",
|
||||||
|
"community": "librenms",
|
||||||
|
"authlevel": null,
|
||||||
|
"authname": null,
|
||||||
|
"authpass": null,
|
||||||
|
"authalgo": null,
|
||||||
|
"cryptopass": null,
|
||||||
|
"cryptoalgo": null,
|
||||||
|
"snmpver": "v2c",
|
||||||
|
"port": "161",
|
||||||
|
"transport": "udp",
|
||||||
|
"timeout": null,
|
||||||
|
"retries": null,
|
||||||
|
"bgpLocalAs": null,
|
||||||
|
"sysObjectID": ".1.3.6.1.4.1.8072.3.2.10",
|
||||||
|
"sysDescr": "Linux li1045-133.members.linode.com 4.1.5-x86_64-linode61 #7 SMP Mon Aug 24 13:46:31 EDT 2015 x86_64",
|
||||||
|
"sysContact": "",
|
||||||
|
"version": "4.1.5-x86_64-linode61",
|
||||||
|
"hardware": "Generic x86 64-bit",
|
||||||
|
"features": "CentOS 7.1.1503",
|
||||||
|
"location": "",
|
||||||
|
"os": "linux",
|
||||||
|
"status": "1",
|
||||||
|
"status_reason": "",
|
||||||
|
"ignore": "0",
|
||||||
|
"disabled": "0",
|
||||||
|
"uptime": "4615964",
|
||||||
|
"agent_uptime": "0",
|
||||||
|
"last_polled": "2015-12-12 13:20:04",
|
||||||
|
"last_poll_attempted": null,
|
||||||
|
"last_polled_timetaken": "1.90",
|
||||||
|
"last_discovered_timetaken": "79.53",
|
||||||
|
"last_discovered": "2015-12-12 12:34:21",
|
||||||
|
"last_ping": "2015-12-12 13:20:04",
|
||||||
|
"last_ping_timetaken": "0.08",
|
||||||
|
"purpose": null,
|
||||||
|
"type": "server",
|
||||||
|
"serial": null,
|
||||||
|
"icon": null,
|
||||||
|
"poller_group": "0",
|
||||||
|
"override_sysLocation": "0",
|
||||||
|
"notes": "Nope"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
## <a name="api-routing">`Routing`</a> [`top`](#top)
|
## <a name="api-routing">`Routing`</a> [`top`](#top)
|
||||||
|
|
||||||
### <a name="api-route-1">Function: `list_bgp`</a> [`top`](#top)
|
### <a name="api-route-1">Function: `list_bgp`</a> [`top`](#top)
|
||||||
@@ -616,7 +771,7 @@ Output:
|
|||||||
{
|
{
|
||||||
"status": "ok",
|
"status": "ok",
|
||||||
"err-msg": "",
|
"err-msg": "",
|
||||||
"message": "Alert has been ackgnowledged"
|
"message": "Alert has been acknowledged"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ if ($foo == 5) {
|
|||||||
```
|
```
|
||||||
|
|
||||||
### Line length
|
### 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
|
### Control structures
|
||||||
A space should be used both before and after the parenthesis and also surrounding the condition operator.
|
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:
|
_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`
|
* With IPv6: `gcc -Wall -O2 -fstack-protector -DWITH_IPV6 -o tinystats tinystats.c`
|
||||||
* Without IPv6: `gcc -Wall -O2 -fstack-protector -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__:
|
__Configuration__:
|
||||||
|
|
||||||
_Note_: In this part we assume that you use DJB's [Daemontools](http://cr.yp.to/daemontools.html) to start/stop tinydns.
|
_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:
|
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:
|
2. Create tinystats directory and chown:
|
||||||
`mkdir /service/dns/log/main/tinystats && chown dnslog:nofiles /service/dns/log/main/tinystats`
|
`mkdir /service/dns/log/main/tinystats && chown dnslog:nofiles /service/dns/log/main/tinystats`
|
||||||
3. Restart TinyDNS and Daemontools: `/etc/init.d/svscan restart`
|
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
|
### MySQL
|
||||||
|
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ Placeholders:
|
|||||||
- Time Elapsed, Only available on recovery (`%state == 0`): `%elapsed`
|
- Time Elapsed, Only available on recovery (`%state == 0`): `%elapsed`
|
||||||
- Alert-ID: `%id`
|
- Alert-ID: `%id`
|
||||||
- Unique-ID: `%uid`
|
- 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`
|
- State: `%state`
|
||||||
- Severity: `%severity`
|
- Severity: `%severity`
|
||||||
- Rule: `%rule`
|
- Rule: `%rule`
|
||||||
@@ -379,7 +379,7 @@ $config['alert']['transports']['pushbullet'] = 'MYFANCYACCESSTOKEN';
|
|||||||
## <a name="transports-clickatell">Clickatell</a>
|
## <a name="transports-clickatell">Clickatell</a>
|
||||||
|
|
||||||
Clickatell provides a REST-API requiring an Authorization-Token and at least one Cellphone number.
|
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:
|
Here an example using 3 numbers, any amount of numbers is supported:
|
||||||
|
|
||||||
~~
|
~~
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ Here we will provide configuration details for these modules.
|
|||||||
|
|
||||||
- HTTP Auth: http-auth
|
- HTTP Auth: http-auth
|
||||||
|
|
||||||
|
- Radius: radius
|
||||||
|
|
||||||
#### User levels
|
#### User levels
|
||||||
|
|
||||||
- 1: Normal User. You will need to assign device / port permissions for users at this level.
|
- 1: Normal User. You will need to assign device / port permissions for users at this level.
|
||||||
@@ -125,3 +127,19 @@ $config['auth_ad_groups']['admin']['level'] = 10;
|
|||||||
$config['auth_ad_groups']['pfy']['level'] = 7;
|
$config['auth_ad_groups']['pfy']['level'] = 7;
|
||||||
$config['auth_ad_require_groupmembership'] = 0;
|
$config['auth_ad_require_groupmembership'] = 0;
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Radius Authentication
|
||||||
|
|
||||||
|
Please note that a mysql user is created for each user the logs in successfully. User level 1 is assigned to those accounts so you will then need to assign the relevant permissions unless you set `$config['radius']['userlevel']` to be something other than 1.
|
||||||
|
|
||||||
|
> Cleanup of old accounts is done using the authlog. You will need to set the cleanup date for when old accounts will be purged which will happen AUTOMATICALLY.
|
||||||
|
> Please ensure that you set the $config['authlog_purge'] value to be greater than $config['radius']['users_purge'] otherwise old users won't be removed.
|
||||||
|
|
||||||
|
```php
|
||||||
|
$config['radius']['hostname'] = 'localhost';
|
||||||
|
$config['radius']['port'] = '1812';
|
||||||
|
$config['radius']['secret'] = 'testing123';
|
||||||
|
$config['radius']['timeout'] = 3;
|
||||||
|
$config['radius']['users_purge'] = 14;//Purge users who haven't logged in for 14 days.
|
||||||
|
$config['radius']['default_level'] = 1;//Set the default user level when automatically creating a user.
|
||||||
|
```
|
||||||
|
|||||||
@@ -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.
|
The MySQL server should be contactable from this layer on port 3306 unless it's changed.
|
||||||
|
|
||||||
####Database Server
|
####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.
|
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
|
||||||
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
|
||||||
Pollers can be installed and run from anywhere, the only requirements are:
|
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.
|
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
|
####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).
|
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.
|
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
|
```php
|
||||||
$config['front_page'] = "pages/front/map.php";
|
$config['front_page'] = "pages/front/map.php";
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# Graylog integration
|
# 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
|
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.
|
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
|
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.
|
`.join <channel>` | Joins `<channel>` if user has admin-level.
|
||||||
`.listdevices` | Lists the hostnames of all known devices.
|
`.listdevices` | Lists the hostnames of all known devices.
|
||||||
`.log [<N>]` | Prints `N` lines or last line of the eventlog.
|
`.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.
|
`.quit` | Disconnect from IRC and exit.
|
||||||
`.reload` | Reload configuration.
|
`.reload` | Reload configuration.
|
||||||
`.status <type>` | Prints status informations for given `type`. Type can be `devices`, `services`, `ports`. Shorthands are: `dev`,`srv`,`prt`
|
`.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>
|
# <a name="extensions">Extensions?!</a>
|
||||||
|
|
||||||
The bot is coded in a unified way.
|
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.
|
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 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)`.
|
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);
|
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!):
|
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
|
* 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:
|
* Add to `snmpd.conf` something like:
|
||||||
``pass .1.3.6.1.2.1.31.1.1.1.18 /path/to/ifAlias``
|
``pass .1.3.6.1.2.1.31.1.1.1.18 /path/to/ifAlias``
|
||||||
* Restart your `net-snmpd`
|
* Restart your `net-snmpd`
|
||||||
@@ -50,6 +50,6 @@ See [examples](#examples) for formats.
|
|||||||
# eth2: Peering: Peering Exchange
|
# eth2: Peering: Peering Exchange
|
||||||
```
|
```
|
||||||
|
|
||||||
# <a name="source">Sourcecode</a>:
|
# <a name="source">Source code</a>:
|
||||||
|
|
||||||
* https://github.com/librenms/librenms/blob/master/scripts/ifAlias
|
* 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.
|
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.
|
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.
|
Please see http://visjs.org/docs/network/ for details on the configuration parameters.
|
||||||
```php
|
```php
|
||||||
$config['network_map_vis_options'] = '{
|
$config['network_map_vis_options'] = '{
|
||||||
|
|||||||
@@ -23,15 +23,15 @@ $config['poller_service_single_connection'] = false;
|
|||||||
```
|
```
|
||||||
|
|
||||||
## Distributed Polling
|
## 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
|
## 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.
|
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
|
## 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
|
## 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`.
|
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.
|
# 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:
|
The following information is used from interface descriptions:
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ $config['rrdtool_version'] = 1.5;
|
|||||||
```
|
```
|
||||||
|
|
||||||
### RRDCached installation CentOS 6
|
### 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.
|
In this example, we'll use the Repoforge repository.
|
||||||
|
|
||||||
```ssh
|
```ssh
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ Now configure LibreNMS (make sure you point dir to your smokeping data directory
|
|||||||
|
|
||||||
```php
|
```php
|
||||||
$config['smokeping']['dir'] = '/opt/smokeping/data';
|
$config['smokeping']['dir'] = '/opt/smokeping/data';
|
||||||
|
$config['smokeping']['pings'] = 20; // should be equal to "pings" in your smokeping config
|
||||||
$config['smokeping']['integration'] = true;
|
$config['smokeping']['integration'] = true;
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -39,6 +40,7 @@ This is quite simple, just point your dir at the smokeping data directory - plea
|
|||||||
|
|
||||||
```php
|
```php
|
||||||
$config['smokeping']['dir'] = '/opt/smokeping/data';
|
$config['smokeping']['dir'] = '/opt/smokeping/data';
|
||||||
|
$config['smokeping']['pings'] = 20; // should be equal to "pings" in your smokeping config
|
||||||
$config['own_hostname']
|
$config['own_hostname']
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -148,6 +150,7 @@ Scroll to the bottom, and paste in the following:
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
$config['smokeping']['dir'] = '/var/lib/smokeping';
|
$config['smokeping']['dir'] = '/var/lib/smokeping';
|
||||||
|
$config['smokeping']['pings'] = 20; // should be equal to "pings" in your smokeping config
|
||||||
$config['smokeping']['integration'] = true;
|
$config['smokeping']['integration'] = true;
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ Table of Content:
|
|||||||
# <a name="about">About</a>
|
# <a name="about">About</a>
|
||||||
|
|
||||||
Over the last couple of years, the primary attack vector for internet accounts has been static passwords.
|
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.
|
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.
|
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>
|
## <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.
|
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 doesnt only need to know the Secretkey but also the server's Counter in order to create valid 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.
|
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>
|
# <a name="config">Configuration</a>
|
||||||
@@ -44,7 +44,7 @@ Enable Two-Factor:
|
|||||||
$config['twofactor'] = true;
|
$config['twofactor'] = true;
|
||||||
```
|
```
|
||||||
|
|
||||||
Set throttle-time (in secconds):
|
Set throttle-time (in seconds):
|
||||||
```php
|
```php
|
||||||
$config['twofactor_lock'] = 300;
|
$config['twofactor_lock'] = 300;
|
||||||
```
|
```
|
||||||
@@ -57,12 +57,12 @@ Create a Two-Factor key:
|
|||||||
- Go to 'My Settings' (/preferences/)
|
- Go to 'My Settings' (/preferences/)
|
||||||
- Choose TwoFactor type
|
- Choose TwoFactor type
|
||||||
- Click on 'Generate TwoFactor Secret Key'
|
- 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
|
- Scan provided QR or click on 'Manual' to see the Key
|
||||||
|
|
||||||
## <a name="usage-google">Google Authenticator</a>
|
## <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:
|
Usage:
|
||||||
- Create a key like described above
|
- Create a key like described above
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ LibreNMS 3rd party acknowledgements
|
|||||||
- Tag Manager (http://soliantconsulting.github.io/tagmanager/): MIT
|
- Tag Manager (http://soliantconsulting.github.io/tagmanager/): MIT
|
||||||
- TW Sack (https://code.google.com/p/tw-sack/): GPLv3
|
- TW Sack (https://code.google.com/p/tw-sack/): GPLv3
|
||||||
- Gridster (http://gridster.net/): MIT
|
- Gridster (http://gridster.net/): MIT
|
||||||
|
- Pure PHP radius class (http://developer.sysco.ch/php/): GPLv3
|
||||||
|
|
||||||
#### 3rd Party GPLv3 Non-compliant
|
#### 3rd Party GPLv3 Non-compliant
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,19 @@
|
|||||||
|
### January 2016
|
||||||
|
|
||||||
|
#### Bug fixes
|
||||||
|
- Discovery / Polling:
|
||||||
|
- Ignore HC Broadcast and Multicast counters for Cisco SB (PR2552)
|
||||||
|
|
||||||
|
#### Improvements
|
||||||
|
- WebUI:
|
||||||
|
- Converted arp pages to use bootgrid (PR2669)
|
||||||
|
- Updated VMWare listing page (PR2684)
|
||||||
|
- Added detection for:
|
||||||
|
- Added support for Samsung printers (PR2680)
|
||||||
|
- Added support for Canon printers (PR2687)
|
||||||
|
- Misc:
|
||||||
|
- Added option to specify Smokeping ping value (PR2676)
|
||||||
|
|
||||||
### December 2015
|
### December 2015
|
||||||
|
|
||||||
#### Bug fixes
|
#### Bug fixes
|
||||||
@@ -5,26 +21,61 @@
|
|||||||
- Fixed regex for negative lat/lng coords (PR2524)
|
- Fixed regex for negative lat/lng coords (PR2524)
|
||||||
- Fixed map page looping due to device connected to itself (PR2545)
|
- Fixed map page looping due to device connected to itself (PR2545)
|
||||||
- Fixed PATH_INFO for nginx (PR2551)
|
- Fixed PATH_INFO for nginx (PR2551)
|
||||||
|
- urlencode the custom port types (PR2597)
|
||||||
|
- Stop non-admin users from being able to get to settings pages (PR2627)
|
||||||
|
- Fix JpGraph php version compare (PR2631)
|
||||||
- Discovery / Polling:
|
- Discovery / Polling:
|
||||||
- Pointed snmp calls for Huawei to correct MIB folder (PR2541)
|
- Pointed snmp calls for Huawei to correct MIB folder (PR2541)
|
||||||
|
- Fixed Ceph unix-agent support. (PR2588)
|
||||||
|
- Moved memory graphs from storage to memory polling (PR2616)
|
||||||
|
- Mask alert_log mysql output when debug is enabled to stop console crashes (PR2618)
|
||||||
|
- Stop Quanta devices being detected as Ubiquiti (PR2632)
|
||||||
|
- Fix MySQL unix-agent graphs (PR2645)
|
||||||
|
- Added MTA-MIB and NETWORK-SERVICES-MIB to stop warnings printed in poller debug (PR2653)
|
||||||
|
- Services:
|
||||||
|
- Fix SSL check for PHP 7 (PR2647)
|
||||||
- Alerting:
|
- Alerting:
|
||||||
- Fix glue-expansion for alerts (PR2522)
|
- Fix glue-expansion for alerts (PR2522)
|
||||||
|
- Fix HipChat transport (PR2586)
|
||||||
- Documentation:
|
- Documentation:
|
||||||
- Removed duplicate mysql-client install from Debian/Ubuntu install docs (PR2543)
|
- Removed duplicate mysql-client install from Debian/Ubuntu install docs (PR2543)
|
||||||
|
- Misc:
|
||||||
|
- Update daily.sh to ignore issues writing to log file (PR2595)
|
||||||
|
|
||||||
#### Improvements
|
#### Improvements
|
||||||
- WebUI:
|
- WebUI:
|
||||||
- Converted sensors page to use bootgrid (PR2531)
|
- Converted sensors page to use bootgrid (PR2531)
|
||||||
|
- Added new widgets for dashboard. Notes (PR2582), Generic image (PR2617)
|
||||||
|
- Added config option to disable lazy loading of images (PR2589)
|
||||||
|
- Visual update to Navbar. (PR2593)
|
||||||
|
- Update alert rules to show actual alert rule ID (PR2603)
|
||||||
|
- Initial support added for per user default dashboard (PR2620)
|
||||||
|
- Updated Worldmap to show clusters in red if one device is down (PR2621)
|
||||||
|
- Cleaned up Billing pages (PR2671)
|
||||||
- Discovery / Polling
|
- Discovery / Polling
|
||||||
- Added traffic bits as default for Cambium devices (PR2525)
|
- Added traffic bits as default for Cambium devices (PR2525)
|
||||||
- Overwrite eth0 port data from UniFi MIBs for AirFibre devices (PR2544)
|
- Overwrite eth0 port data from UniFi MIBs for AirFibre devices (PR2544)
|
||||||
|
- Added lastupdate column to sensors table for use with alerts (PR2590,PR2592)
|
||||||
|
- Updated auto discovery via lldp to check for devices that use mac address in lldpRemPortId (PR2591)
|
||||||
|
- Updated auto discovery via lldp with absent lldpRemSysName (PR2619)
|
||||||
- API:
|
- API:
|
||||||
- Added ability to filter devices by type and os for Oxidized API call (PR2539)
|
- Added ability to filter devices by type and os for Oxidized API call (PR2539)
|
||||||
|
- Added ability to update device information (PR2585)
|
||||||
|
- Added support for returning device groups (PR2611)
|
||||||
|
- Added ability to select port graphs based on ifDescr (PR2648)
|
||||||
- Documentation:
|
- Documentation:
|
||||||
- Improved alerting docs explaining more options (PR2560)
|
- Improved alerting docs explaining more options (PR2560)
|
||||||
|
- Added Docs for Ubuntu/Debian Smokeping integration (PR2610)
|
||||||
- Added detection for:
|
- Added detection for:
|
||||||
- Updated Netonix switch MIBs (PR2523)
|
- Updated Netonix switch MIBs (PR2523)
|
||||||
- Updated Fotinet MIBs (PR2529, PR2534)
|
- Updated Fotinet MIBs (PR2529, PR2534)
|
||||||
|
- Cisco SG500 (PR2609)
|
||||||
|
- Updated processor support for Fortigate (PR2613)
|
||||||
|
- Added CPU / Memory support for PBN (PR2672)
|
||||||
|
- Misc:
|
||||||
|
- Updated validation to check for php extension and classes required (PR2602)
|
||||||
|
- Added Radius Authentication support (PR2615)
|
||||||
|
- Removed distinct() from alerts query to use indexes (PR2649)
|
||||||
|
|
||||||
### November 2015
|
### November 2015
|
||||||
|
|
||||||
@@ -37,6 +88,7 @@
|
|||||||
- Fix netcmd.php URI for sub dir installations (PR2428)
|
- Fix netcmd.php URI for sub dir installations (PR2428)
|
||||||
- Fixed Oxidized fetch config with groups (PR2501)
|
- Fixed Oxidized fetch config with groups (PR2501)
|
||||||
- Fixed background colour to white for some graphs (PR2516)
|
- Fixed background colour to white for some graphs (PR2516)
|
||||||
|
- Added missing Service description on services page (PR2679)
|
||||||
- API:
|
- API:
|
||||||
- Added missing quotes for MySQL queries (PR2382)
|
- Added missing quotes for MySQL queries (PR2382)
|
||||||
- Discovery / Polling:
|
- Discovery / Polling:
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ General Guidelines
|
|||||||
web chat](http://webchat.freenode.net/) and follow the prompts to chat
|
web chat](http://webchat.freenode.net/) and follow the prompts to chat
|
||||||
via the web client.
|
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].
|
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)
|
Mika Tuupola <tuupola@appelsiini.net> (@tuupola on github)
|
||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
|
- influxdb-php
|
||||||
|
https://github.com/influxdb/influxdb-php
|
||||||
|
MIT License
|
||||||
|
|
||||||
Other components (needs details filled in):
|
Other components (needs details filled in):
|
||||||
- JpGraph (html/includes/jpgraph): QPL 1.0 license
|
- 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
|
|
||||||
@@ -359,6 +359,13 @@ $config['smokeping']['dir'] = "/var/lib/smokeping/";
|
|||||||
```
|
```
|
||||||
Set the smokeping directory location.
|
Set the smokeping directory location.
|
||||||
|
|
||||||
|
```php
|
||||||
|
$config['smokeping']['pings'] = 20;
|
||||||
|
```
|
||||||
|
Should be equal to "pings" in your smokeping config. On Debian/Ubuntu, this is set in `/etc/smokeping/config.d/Database`.
|
||||||
|
|
||||||
|
You can also set it to less than the value of "pings" in your smokeping config if you don't want LibreNMS to graph all of the ping data.
|
||||||
|
|
||||||
```php
|
```php
|
||||||
$config['nfsen_enable'] = 0;
|
$config['nfsen_enable'] = 0;
|
||||||
$config['nfsen_split_char'] = "_";
|
$config['nfsen_split_char'] = "_";
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ if (!$os) {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Here is the file location for polling the new OS within a vendor MIB or a standart one:
|
Here is the file location for polling the new OS within a vendor MIB or a standard one:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
includes/polling/os/pulse.inc.php
|
includes/polling/os/pulse.inc.php
|
||||||
@@ -73,7 +73,7 @@ Quick explanation and examples :
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
snmpwalk -v2c -c public -m SNMPv2-MIB -M mibs
|
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
|
//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
|
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._
|
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
|
```bash
|
||||||
//for example the OID iveCpuUtil.0:
|
//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 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
|
```bash
|
||||||
sql-schema/xxx.sql
|
sql-schema/xxx.sql
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ if (!$_SESSION['authenticated']) {
|
|||||||
|
|
||||||
$device = array();
|
$device = array();
|
||||||
$ports = array();
|
$ports = array();
|
||||||
|
$bgp = array();
|
||||||
|
|
||||||
if (isset($_REQUEST['search'])) {
|
if (isset($_REQUEST['search'])) {
|
||||||
$search = mres($_REQUEST['search']);
|
$search = mres($_REQUEST['search']);
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ $app->group(
|
|||||||
// api/v0/devices/$hostname/graphs
|
// api/v0/devices/$hostname/graphs
|
||||||
$app->get('/:hostname/ports', 'authToken', 'get_port_graphs')->name('get_port_graphs');
|
$app->get('/:hostname/ports', 'authToken', 'get_port_graphs')->name('get_port_graphs');
|
||||||
// api/v0/devices/$hostname/ports
|
// api/v0/devices/$hostname/ports
|
||||||
|
$app->get('/:hostname/groups', 'authToken', 'get_device_groups')->name('get_device_groups');
|
||||||
$app->get('/:hostname/:type', 'authToken', 'get_graph_generic_by_hostname')->name('get_graph_generic_by_hostname');
|
$app->get('/:hostname/:type', 'authToken', 'get_graph_generic_by_hostname')->name('get_graph_generic_by_hostname');
|
||||||
// api/v0/devices/$hostname/$type
|
// api/v0/devices/$hostname/$type
|
||||||
$app->get('/:hostname/ports/:ifname', 'authToken', 'get_port_stats_by_port_hostname')->name('get_port_stats_by_port_hostname');
|
$app->get('/:hostname/ports/:ifname', 'authToken', 'get_port_stats_by_port_hostname')->name('get_port_stats_by_port_hostname');
|
||||||
@@ -61,6 +62,13 @@ $app->group(
|
|||||||
// api/v0/devices
|
// api/v0/devices
|
||||||
$app->post('/devices', 'authToken', 'add_device')->name('add_device');
|
$app->post('/devices', 'authToken', 'add_device')->name('add_device');
|
||||||
// api/v0/devices (json data needs to be passed)
|
// api/v0/devices (json data needs to be passed)
|
||||||
|
$app->group(
|
||||||
|
'/devicegroups',
|
||||||
|
function () use ($app) {
|
||||||
|
$app->get('/:name', 'authToken', 'get_devices_by_group')->name('get_devices_by_group');
|
||||||
|
}
|
||||||
|
);
|
||||||
|
$app->get('/devicegroups', 'authToken', 'get_device_groups')->name('get_devicegroups');
|
||||||
$app->group(
|
$app->group(
|
||||||
'/portgroups',
|
'/portgroups',
|
||||||
function () use ($app) {
|
function () use ($app) {
|
||||||
|
|||||||
@@ -1834,3 +1834,24 @@ label {
|
|||||||
|
|
||||||
@media only screen and (min-width: 1024px) {
|
@media only screen and (min-width: 1024px) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.redCluster {
|
||||||
|
background-color: rgba(255,0,0);
|
||||||
|
background-color: rgba(255,0,0,0.7);
|
||||||
|
text-align: center;
|
||||||
|
width: 25px !important;
|
||||||
|
height: 25px !important;
|
||||||
|
font-size: 14px;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.greenCluster {
|
||||||
|
background-color: rgba(0,255,0);
|
||||||
|
background-color: rgba(0,255,0,0.7);
|
||||||
|
text-align: center;
|
||||||
|
width: 25px !important;
|
||||||
|
height: 25px !important;
|
||||||
|
font-size: 14px;
|
||||||
|
color: black;
|
||||||
|
border-color:transparent;
|
||||||
|
}
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.0 KiB |
@@ -13,7 +13,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
require_once '../includes/functions.php';
|
require_once '../includes/functions.php';
|
||||||
|
require_once '../includes/device-groups.inc.php';
|
||||||
|
|
||||||
function authToken(\Slim\Route $route) {
|
function authToken(\Slim\Route $route) {
|
||||||
$app = \Slim\Slim::getInstance();
|
$app = \Slim\Slim::getInstance();
|
||||||
@@ -62,10 +62,17 @@ function get_graph_by_port_hostname() {
|
|||||||
$vars['to'] = $_GET['to'];
|
$vars['to'] = $_GET['to'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($_GET['ifDescr'] == true) {
|
||||||
|
$port = 'ifDescr';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$port = 'ifName';
|
||||||
|
}
|
||||||
|
|
||||||
$vars['width'] = $_GET['width'] ?: 1075;
|
$vars['width'] = $_GET['width'] ?: 1075;
|
||||||
$vars['height'] = $_GET['height'] ?: 300;
|
$vars['height'] = $_GET['height'] ?: 300;
|
||||||
$auth = '1';
|
$auth = '1';
|
||||||
$vars['id'] = dbFetchCell('SELECT `P`.`port_id` FROM `ports` AS `P` JOIN `devices` AS `D` ON `P`.`device_id` = `D`.`device_id` WHERE `D`.`hostname`=? AND `P`.`ifName`=?', array($hostname, $vars['port']));
|
$vars['id'] = dbFetchCell("SELECT `P`.`port_id` FROM `ports` AS `P` JOIN `devices` AS `D` ON `P`.`device_id` = `D`.`device_id` WHERE `D`.`hostname`=? AND `P`.`$port`=?", array($hostname, $vars['port']));
|
||||||
$app->response->headers->set('Content-Type', 'image/png');
|
$app->response->headers->set('Content-Type', 'image/png');
|
||||||
include 'includes/graphs/graph.inc.php';
|
include 'includes/graphs/graph.inc.php';
|
||||||
|
|
||||||
@@ -784,7 +791,7 @@ function ack_alert() {
|
|||||||
$status = 'ok';
|
$status = 'ok';
|
||||||
$code = 200;
|
$code = 200;
|
||||||
if (dbUpdate(array('state' => 2), 'alerts', '`id` = ? LIMIT 1', array($alert_id))) {
|
if (dbUpdate(array('state' => 2), 'alerts', '`id` = ? LIMIT 1', array($alert_id))) {
|
||||||
$message = 'Alert has been ackgnowledged';
|
$message = 'Alert has been acknowledged';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$message = 'No alert by that ID';
|
$message = 'No alert by that ID';
|
||||||
@@ -1014,3 +1021,73 @@ function update_device() {
|
|||||||
$app->response->headers->set('Content-Type', 'application/json');
|
$app->response->headers->set('Content-Type', 'application/json');
|
||||||
echo _json_encode($output);
|
echo _json_encode($output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function get_device_groups() {
|
||||||
|
$app = \Slim\Slim::getInstance();
|
||||||
|
$router = $app->router()->getCurrentRoute()->getParams();
|
||||||
|
$status = 'error';
|
||||||
|
$code = 404;
|
||||||
|
$hostname = $router['hostname'];
|
||||||
|
// use hostname as device_id if it's all digits
|
||||||
|
$device_id = ctype_digit($hostname) ? $hostname : getidbyname($hostname);
|
||||||
|
if (is_numeric($device_id)) {
|
||||||
|
$groups = GetGroupsFromDevice($device_id,1);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$groups = GetDeviceGroups();
|
||||||
|
}
|
||||||
|
if (empty($groups)) {
|
||||||
|
$message = 'No device groups found';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$status = 'ok';
|
||||||
|
$code = 200;
|
||||||
|
$message = 'Found ' . count($groups) . ' device groups';
|
||||||
|
}
|
||||||
|
|
||||||
|
$output = array(
|
||||||
|
'status' => $status,
|
||||||
|
'message' => $message,
|
||||||
|
'count' => count($groups),
|
||||||
|
'groups' => $groups,
|
||||||
|
);
|
||||||
|
$app->response->setStatus($code);
|
||||||
|
$app->response->headers->set('Content-Type', 'application/json');
|
||||||
|
echo _json_encode($output);
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_devices_by_group() {
|
||||||
|
$app = \Slim\Slim::getInstance();
|
||||||
|
$router = $app->router()->getCurrentRoute()->getParams();
|
||||||
|
$status = 'error';
|
||||||
|
$code = 404;
|
||||||
|
$count = 0;
|
||||||
|
$name = urldecode($router['name']);
|
||||||
|
$devices = array();
|
||||||
|
if (empty($name)) {
|
||||||
|
$message = 'No device group name provided';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$group_id = dbFetchCell("SELECT `id` FROM `device_groups` WHERE `name`=?",array($name));
|
||||||
|
$devices = GetDevicesFromGroup($group_id);
|
||||||
|
$count = count($devices);
|
||||||
|
if (empty($devices)) {
|
||||||
|
$message = 'No devices found in group ' . $name;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$message = "Found $count in group $name";
|
||||||
|
$code = 200;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$output = array(
|
||||||
|
'status' => $status,
|
||||||
|
'message' => $message,
|
||||||
|
'count' => $count,
|
||||||
|
'devices' => $devices,
|
||||||
|
);
|
||||||
|
|
||||||
|
$app->response->setStatus($code);
|
||||||
|
$app->response->headers->set('Content-Type', 'application/json');
|
||||||
|
echo _json_encode($output);
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ else {
|
|||||||
$auth_success = 0;
|
$auth_success = 0;
|
||||||
|
|
||||||
if ((isset($_SESSION['username'])) || (isset($_COOKIE['sess_id'],$_COOKIE['token']))) {
|
if ((isset($_SESSION['username'])) || (isset($_COOKIE['sess_id'],$_COOKIE['token']))) {
|
||||||
if ((authenticate($_SESSION['username'], $_SESSION['password'])) || (reauthenticate($_COOKIE['sess_id'], $_COOKIE['token']))) {
|
if (reauthenticate($_COOKIE['sess_id'], $_COOKIE['token']) || authenticate($_SESSION['username'], $_SESSION['password'])) {
|
||||||
$_SESSION['userlevel'] = get_userlevel($_SESSION['username']);
|
$_SESSION['userlevel'] = get_userlevel($_SESSION['username']);
|
||||||
$_SESSION['user_id'] = get_userid($_SESSION['username']);
|
$_SESSION['user_id'] = get_userid($_SESSION['username']);
|
||||||
if (!$_SESSION['authenticated']) {
|
if (!$_SESSION['authenticated']) {
|
||||||
|
|||||||
@@ -0,0 +1,120 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once $config['install_dir'].'/lib/pure_php_radius/radius.class.php';
|
||||||
|
|
||||||
|
$radius = new Radius($config['radius']['hostname'], $config['radius']['secret'], $config['radius']['suffix'], $config['radius']['timeout'], $config['radius']['port']);
|
||||||
|
|
||||||
|
function authenticate($username, $password) {
|
||||||
|
global $config, $radius, $debug;
|
||||||
|
|
||||||
|
if (empty($username)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if ($debug) {
|
||||||
|
$radius->SetDebugMode(TRUE);
|
||||||
|
}
|
||||||
|
$rad = $radius->AccessRequest($username,$password);
|
||||||
|
if($rad === true) {
|
||||||
|
adduser($username);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function reauthenticate() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function passwordscanchange() {
|
||||||
|
// not supported so return 0
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function changepassword() {
|
||||||
|
// not supported so return 0
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function auth_usermanagement() {
|
||||||
|
// not supported so return 0
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function adduser($username, $password, $level=1, $email='', $realname='', $can_modify_passwd=0, $description='', $twofactor=0) {
|
||||||
|
// Check to see if user is already added in the database
|
||||||
|
global $config;
|
||||||
|
if (!user_exists($username)) {
|
||||||
|
$hasher = new PasswordHash(8, false);
|
||||||
|
$encrypted = $hasher->HashPassword($password);
|
||||||
|
if ($config['radius']['default_level'] > 0) {
|
||||||
|
$level = $config['radius']['default_level'];
|
||||||
|
}
|
||||||
|
$userid = dbInsert(array('username' => $username, 'password' => $encrypted, 'realname' => $realname, 'email' => $email, 'descr' => $description, 'level' => $level, 'can_modify_passwd' => $can_modify_passwd, 'twofactor' => $twofactor), 'users');
|
||||||
|
if ($userid == false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
foreach (dbFetchRows('select notifications.* from notifications where not exists( select 1 from notifications_attribs where notifications.notifications_id = notifications_attribs.notifications_id and notifications_attribs.user_id = ?) order by notifications.notifications_id desc',array($userid)) as $notif) {
|
||||||
|
dbInsert(array('notifications_id'=>$notif['notifications_id'],'user_id'=>$userid,'key'=>'read','value'=>1),'notifications_attribs');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $userid;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function user_exists($username) {
|
||||||
|
return dbFetchCell('SELECT COUNT(*) FROM users WHERE username = ?', array($username), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function get_userlevel($username) {
|
||||||
|
return dbFetchCell('SELECT `level` FROM `users` WHERE `username` = ?', array($username), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function get_userid($username) {
|
||||||
|
return dbFetchCell('SELECT `user_id` FROM `users` WHERE `username` = ?', array($username), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function deluser($username) {
|
||||||
|
dbDelete('bill_perms', '`user_name` = ?', array($username));
|
||||||
|
dbDelete('devices_perms', '`user_name` = ?', array($username));
|
||||||
|
dbDelete('ports_perms', '`user_name` = ?', array($username));
|
||||||
|
dbDelete('users_prefs', '`user_name` = ?', array($username));
|
||||||
|
dbDelete('users', '`user_name` = ?', array($username));
|
||||||
|
return dbDelete('users', '`username` = ?', array($username));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function get_userlist() {
|
||||||
|
return dbFetchRows('SELECT * FROM `users`');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function can_update_users() {
|
||||||
|
// supported so return 1
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function get_user($user_id) {
|
||||||
|
return dbFetchRow('SELECT * FROM `users` WHERE `user_id` = ?', array($user_id), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function update_user($user_id, $realname, $level, $can_modify_passwd, $email) {
|
||||||
|
dbUpdate(array('realname' => $realname, 'level' => $level, 'can_modify_passwd' => $can_modify_passwd, 'email' => $email), 'users', '`user_id` = ?', array($user_id));
|
||||||
|
|
||||||
|
}
|
||||||
@@ -137,6 +137,17 @@ L.tileLayer(\'//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png\', {
|
|||||||
|
|
||||||
var markers = L.markerClusterGroup({
|
var markers = L.markerClusterGroup({
|
||||||
maxClusterRadius: ' . $group_radius . ',
|
maxClusterRadius: ' . $group_radius . ',
|
||||||
|
iconCreateFunction: function (cluster) {
|
||||||
|
var markers = cluster.getAllChildMarkers();
|
||||||
|
var n = 0;
|
||||||
|
newClass = "greenCluster marker-cluster marker-cluster-small leaflet-zoom-animated leaflet-clickable";
|
||||||
|
for (var i = 0; i < markers.length; i++) {
|
||||||
|
if (markers[i].options.icon.options.markerColor == "red") {
|
||||||
|
newClass = "redCluster marker-cluster marker-cluster-small leaflet-zoom-animated leaflet-clickable";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return L.divIcon({ html: cluster.getChildCount(), className: newClass, iconSize: L.point(40, 40) });
|
||||||
|
},
|
||||||
});
|
});
|
||||||
var redMarker = L.AwesomeMarkers.icon({
|
var redMarker = L.AwesomeMarkers.icon({
|
||||||
icon: \'server\',
|
icon: \'server\',
|
||||||
|
|||||||
@@ -49,6 +49,13 @@ if ($device['serial']) {
|
|||||||
</tr>';
|
</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($device['sysObjectID']) {
|
||||||
|
echo '<tr>
|
||||||
|
<td>Object ID</td>
|
||||||
|
<td>'.$device['sysObjectID'].'</td>
|
||||||
|
</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
if ($device['sysContact']) {
|
if ($device['sysContact']) {
|
||||||
echo '<tr>
|
echo '<tr>
|
||||||
<td>Contact</td>';
|
<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':
|
case 'height':
|
||||||
$h = $arg;
|
$h = $arg;
|
||||||
break;
|
break;
|
||||||
|
case 'lazy_w':
|
||||||
|
$lazy_w = $arg;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
$urlargs[] = $key."=".urlencode($arg);
|
$urlargs[] = $key."=".urlencode($arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(isset($lazy_w)) {
|
||||||
|
$w=$lazy_w;
|
||||||
|
}
|
||||||
|
|
||||||
if ($config['enable_lazy_load'] === true) {
|
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 {
|
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()
|
}//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();
|
$rrd_list = array();
|
||||||
$prefix = rrd_name($device['hostname'], array($subtype, ''), '');
|
$prefix = rrd_name($device['hostname'], array($subtype, ''), '');
|
||||||
foreach (glob($prefix.'*.rrd') as $filename) {
|
$filenames = glob($prefix."*.rrd");
|
||||||
|
$count = count($filenames);
|
||||||
|
foreach ($filenames as $filename) {
|
||||||
// find out what * expanded to
|
// find out what * expanded to
|
||||||
$globpart = str_replace($prefix, '', $filename);
|
$globpart = str_replace($prefix, '', $filename); // take off the prefix
|
||||||
// take off the prefix
|
$instance = substr($globpart, 0, -4); // take off ".rrd"
|
||||||
$instance = substr($globpart, 0, -4);
|
|
||||||
// take off ".rrd"
|
|
||||||
$ds = array();
|
$ds = array();
|
||||||
$mibparts = explode('-', $subtype);
|
$mibparts = explode('-', $subtype);
|
||||||
$mibvar = end($mibparts);
|
$mibvar = end($mibparts);
|
||||||
$ds['ds'] = name_shorten($mibvar);
|
$ds['ds'] = 'mibval';
|
||||||
$ds['descr'] = "$mibvar-$instance";
|
$ds['descr'] = "$mibvar-$instance";
|
||||||
$ds['filename'] = $filename;
|
$ds['filename'] = $filename;
|
||||||
$rrd_list[] = $ds;
|
$rrd_list[] = $ds;
|
||||||
}
|
}
|
||||||
|
|
||||||
$colours = 'mixed';
|
|
||||||
$scale_min = '0';
|
$scale_min = '0';
|
||||||
$nototal = 0;
|
|
||||||
$simple_rrd = true;
|
$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 %';
|
$unit_text = 'Load %';
|
||||||
|
|
||||||
$units = '%';
|
$units = '';
|
||||||
$total_units = '%';
|
$total_units = '%';
|
||||||
$colours = 'mixed';
|
$colours = 'mixed';
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// Dear Tobias. You write in Perl, this makes me hate you forever.
|
|
||||||
// This is my translation of Smokeping's graphing.
|
// This is my translation of Smokeping's graphing.
|
||||||
// Thanks to Bill Fenner for Perl->Human translation:>
|
// Thanks to Bill Fenner for Perl->Human translation:>
|
||||||
$scale_min = 0;
|
$scale_min = 0;
|
||||||
@@ -10,7 +9,7 @@ require 'includes/graphs/common.inc.php';
|
|||||||
require 'smokeping_common.inc.php';
|
require 'smokeping_common.inc.php';
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$pings = 20;
|
$pings = $config['smokeping']['pings'];
|
||||||
$iter = 0;
|
$iter = 0;
|
||||||
$colourset = 'mixed';
|
$colourset = 'mixed';
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// Dear Tobias. You write in Perl, this makes me hate you forever.
|
|
||||||
// This is my translation of Smokeping's graphing.
|
// This is my translation of Smokeping's graphing.
|
||||||
// Thanks to Bill Fenner for Perl->Human translation:>
|
// Thanks to Bill Fenner for Perl->Human translation:>
|
||||||
$scale_min = 0;
|
$scale_min = 0;
|
||||||
@@ -10,7 +9,7 @@ require 'includes/graphs/common.inc.php';
|
|||||||
require 'smokeping_common.inc.php';
|
require 'smokeping_common.inc.php';
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$pings = 20;
|
$pings = $config['smokeping']['pings'];
|
||||||
$iter = 0;
|
$iter = 0;
|
||||||
$colourset = 'mixed';
|
$colourset = 'mixed';
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$scale_max = 100;
|
||||||
|
|
||||||
|
require 'includes/graphs/common.inc.php';
|
||||||
|
|
||||||
|
$rrdfilename = $config['rrd_dir'].'/'.$device['hostname'].'/sub10systems.rrd';
|
||||||
|
|
||||||
|
|
||||||
|
if (file_exists($rrdfilename)) {
|
||||||
|
$rrd_options .= " COMMENT:' Now Min Max\\n'";
|
||||||
|
$rrd_options .= ' DEF:sub10RadioLclAFER='.$rrdfilename.':sub10RadioLclAFER:AVERAGE ';
|
||||||
|
$rrd_options .= " LINE1:sub10RadioLclAFER#CC0000:'Percent ' ";
|
||||||
|
$rrd_options .= ' GPRINT:sub10RadioLclAFER:LAST:%3.2lf ';
|
||||||
|
$rrd_options .= ' GPRINT:sub10RadioLclAFER:MIN:%3.2lf ';
|
||||||
|
$rrd_options .= ' GPRINT:sub10RadioLclAFER:MAX:%3.2lf\\\l ';
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// $scale_min = 0;
|
||||||
|
|
||||||
|
require 'includes/graphs/common.inc.php';
|
||||||
|
|
||||||
|
$rrdfilename = $config['rrd_dir'].'/'.$device['hostname'].'/sub10systems.rrd';
|
||||||
|
|
||||||
|
|
||||||
|
if (file_exists($rrdfilename)) {
|
||||||
|
$rrd_options .= " COMMENT:'dBm Now Min Max\\n'";
|
||||||
|
$rrd_options .= ' DEF:sub10RadioLclDataRa='.$rrdfilename.':sub10RadioLclDataRa:AVERAGE ';
|
||||||
|
$rrd_options .= " LINE1:sub10RadioLclDataRa#CC0000:'Tx Power ' ";
|
||||||
|
$rrd_options .= ' GPRINT:sub10RadioLclDataRa:LAST:%3.2lf ';
|
||||||
|
$rrd_options .= ' GPRINT:sub10RadioLclDataRa:MIN:%3.2lf ';
|
||||||
|
$rrd_options .= ' GPRINT:sub10RadioLclDataRa:MAX:%3.2lf\\\l ';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require 'includes/graphs/common.inc.php';
|
||||||
|
|
||||||
|
$rrdfilename = $config['rrd_dir'].'/'.$device['hostname'].'/sub10systems.rrd';
|
||||||
|
|
||||||
|
|
||||||
|
if (file_exists($rrdfilename)) {
|
||||||
|
$rrd_options .= " COMMENT:'dB Now Min Max\\n'";
|
||||||
|
$rrd_options .= ' DEF:sub10RadioLclLnkLos='.$rrdfilename.':sub10RadioLclLnkLos:AVERAGE ';
|
||||||
|
$rrd_options .= " LINE1:sub10RadioLclLnkLos#CC0000:'Link Loss ' ";
|
||||||
|
$rrd_options .= ' GPRINT:sub10RadioLclLnkLos:LAST:%3.2lf ';
|
||||||
|
$rrd_options .= ' GPRINT:sub10RadioLclLnkLos:MIN:%3.2lf ';
|
||||||
|
$rrd_options .= ' GPRINT:sub10RadioLclLnkLos:MAX:%3.2lf\\\l ';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$scale_max = 0;
|
||||||
|
|
||||||
|
require 'includes/graphs/common.inc.php';
|
||||||
|
|
||||||
|
$rrdfilename = $config['rrd_dir'].'/'.$device['hostname'].'/sub10systems.rrd';
|
||||||
|
|
||||||
|
|
||||||
|
if (file_exists($rrdfilename)) {
|
||||||
|
$rrd_options .= " COMMENT:'dBm Now Min Max\\n'";
|
||||||
|
$rrd_options .= ' DEF:sub10RadioLclRxPowe='.$rrdfilename.':sub10RadioLclRxPowe:AVERAGE ';
|
||||||
|
$rrd_options .= " LINE1:sub10RadioLclRxPowe#CC0000:'Rx Power ' ";
|
||||||
|
$rrd_options .= ' GPRINT:sub10RadioLclRxPowe:LAST:%3.2lf ';
|
||||||
|
$rrd_options .= ' GPRINT:sub10RadioLclRxPowe:MIN:%3.2lf ';
|
||||||
|
$rrd_options .= ' GPRINT:sub10RadioLclRxPowe:MAX:%3.2lf\\\l ';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$scale_min = 0;
|
||||||
|
|
||||||
|
require 'includes/graphs/common.inc.php';
|
||||||
|
|
||||||
|
$rrdfilename = $config['rrd_dir'].'/'.$device['hostname'].'/sub10systems.rrd';
|
||||||
|
|
||||||
|
|
||||||
|
if (file_exists($rrdfilename)) {
|
||||||
|
$rrd_options .= " COMMENT:'dBm Now Min Max\\n'";
|
||||||
|
$rrd_options .= ' DEF:sub10RadioLclTxPowe='.$rrdfilename.':sub10RadioLclTxPowe:AVERAGE ';
|
||||||
|
$rrd_options .= " LINE1:sub10RadioLclTxPowe#CC0000:'Tx Power ' ";
|
||||||
|
$rrd_options .= ' GPRINT:sub10RadioLclTxPowe:LAST:%3.2lf ';
|
||||||
|
$rrd_options .= ' GPRINT:sub10RadioLclTxPowe:MIN:%3.2lf ';
|
||||||
|
$rrd_options .= ' GPRINT:sub10RadioLclTxPowe:MAX:%3.2lf\\\l ';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$scale_max = 0;
|
||||||
|
|
||||||
|
require 'includes/graphs/common.inc.php';
|
||||||
|
|
||||||
|
$rrdfilename = $config['rrd_dir'].'/'.$device['hostname'].'/sub10systems.rrd';
|
||||||
|
|
||||||
|
|
||||||
|
if (file_exists($rrdfilename)) {
|
||||||
|
$rrd_options .= " COMMENT:'dB Now Min Max\\n'";
|
||||||
|
$rrd_options .= ' DEF:sub10RadioLclVectEr='.$rrdfilename.':sub10RadioLclVectEr:AVERAGE ';
|
||||||
|
$rrd_options .= " LINE1:sub10RadioLclVectEr#CC0000:'Vector Error ' ";
|
||||||
|
$rrd_options .= ' GPRINT:sub10RadioLclVectEr:LAST:%3.2lf ';
|
||||||
|
$rrd_options .= ' GPRINT:sub10RadioLclVectEr:MIN:%3.2lf ';
|
||||||
|
$rrd_options .= ' GPRINT:sub10RadioLclVectEr:MAX:%3.2lf\\\l ';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -123,9 +123,9 @@ if ($config['rrdgraph_real_95th']) {
|
|||||||
$rrd_options .= " GPRINT:95thhigh:\"%30.2lf%s\\n\"";
|
$rrd_options .= " GPRINT:95thhigh:\"%30.2lf%s\\n\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
$rrd_options .= " GPRINT:tot:'Total %6.2lf%s'";
|
$rrd_options .= " GPRINT:tot:'Total %6.2lf%sB'";
|
||||||
$rrd_options .= " GPRINT:totin:'(In %6.2lf%s'";
|
$rrd_options .= " GPRINT:totin:'(In %6.2lf%sB'";
|
||||||
$rrd_options .= " GPRINT:totout:'Out %6.2lf%s)\\l'";
|
$rrd_options .= " GPRINT:totout:'Out %6.2lf%sB)\\l'";
|
||||||
$rrd_options .= ' LINE1:95thin#aa0000';
|
$rrd_options .= ' LINE1:95thin#aa0000';
|
||||||
$rrd_options .= ' LINE1:d95thout#aa0000';
|
$rrd_options .= ' LINE1:d95thout#aa0000';
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,9 @@ foreach ($rrd_list as $rrd) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$colour = $config['graph_colours'][$colours][$iter];
|
$colour = $config['graph_colours'][$colours][$iter];
|
||||||
|
if (!empty($rrd['area']) && empty($rrd['areacolour'])) {
|
||||||
|
$rrd['areacolour'] = $colour."20";
|
||||||
|
}
|
||||||
|
|
||||||
$ds = $rrd['ds'];
|
$ds = $rrd['ds'];
|
||||||
$filename = $rrd['filename'];
|
$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.':LAST:%5.2lf%s'.$units.' GPRINT:'.$id.'min:MIN:%5.2lf%s'.$units;
|
||||||
$rrd_optionsb .= ' GPRINT:'.$id.'max:MAX:%5.2lf%s GPRINT:'.$id.":AVERAGE:'%5.2lf%s\\n'";
|
$rrd_optionsb .= ' GPRINT:'.$id.'max:MAX:%5.2lf%s'.$units.' GPRINT:'.$id.":AVERAGE:'%5.2lf%s$units\\n'";
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
$iter++;
|
$iter++;
|
||||||
|
|||||||
@@ -43,12 +43,15 @@ if ($auth !== true && $auth != 1) {
|
|||||||
|
|
||||||
require $config['install_dir']."/html/includes/graphs/$type/auth.inc.php";
|
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")) {
|
if ($auth === true && is_custom_graph($type, $subtype, $device)) {
|
||||||
include $config['install_dir']."/html/includes/graphs/$type/$subtype.inc.php";
|
include($config['install_dir'] . "/html/includes/graphs/custom.inc.php");
|
||||||
}
|
}
|
||||||
else if ($auth === true && is_mib_graph($type, $subtype)) {
|
else if ($auth === true && is_mib_graph($type, $subtype)) {
|
||||||
include $config['install_dir']."/html/includes/graphs/$type/mib.inc.php";
|
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 {
|
else {
|
||||||
graph_error("$type*$subtype ");
|
graph_error("$type*$subtype ");
|
||||||
// Graph Template Missing");
|
// Graph Template Missing");
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
$src = device_by_id_cache($_GET['src']);
|
$src = device_by_id_cache($_GET['src']);
|
||||||
|
|
||||||
// Dear Tobias. You write in Perl, this makes me hate you forever.
|
|
||||||
// This is my translation of Smokeping's graphing.
|
// This is my translation of Smokeping's graphing.
|
||||||
// Thanks to Bill Fenner for Perl->Human translation:>
|
// Thanks to Bill Fenner for Perl->Human translation:>
|
||||||
$scale_min = 0;
|
$scale_min = 0;
|
||||||
@@ -12,7 +11,7 @@ require 'includes/graphs/common.inc.php';
|
|||||||
require 'smokeping_common.inc.php';
|
require 'smokeping_common.inc.php';
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$pings = 20;
|
$pings = $config['smokeping']['pings'];
|
||||||
$iter = 0;
|
$iter = 0;
|
||||||
$colourset = 'mixed';
|
$colourset = 'mixed';
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
$dest = device_by_id_cache($_GET['dest']);
|
$dest = device_by_id_cache($_GET['dest']);
|
||||||
|
|
||||||
// Dear Tobias. You write in Perl, this makes me hate you forever.
|
|
||||||
// This is my translation of Smokeping's graphing.
|
// This is my translation of Smokeping's graphing.
|
||||||
// Thanks to Bill Fenner for Perl->Human translation:>
|
// Thanks to Bill Fenner for Perl->Human translation:>
|
||||||
$scale_min = 0;
|
$scale_min = 0;
|
||||||
@@ -12,7 +11,7 @@ require 'includes/graphs/common.inc.php';
|
|||||||
require 'smokeping_common.inc.php';
|
require 'smokeping_common.inc.php';
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$pings = 20;
|
$pings = $config['smokeping']['pings'];
|
||||||
$iter = 0;
|
$iter = 0;
|
||||||
$colourset = 'mixed';
|
$colourset = 'mixed';
|
||||||
|
|
||||||
|
|||||||
@@ -222,21 +222,16 @@ if (!defined('MBTTF_DIR')) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Check minimum PHP version
|
* Check minimum PHP version
|
||||||
//
|
* @author f0o <f0o@devilcode.org>
|
||||||
|
* @copyright 2015 f0o, LibreNMS
|
||||||
|
* @license GPL
|
||||||
|
* @package LibreNMS
|
||||||
|
* @subpackage Billing
|
||||||
|
*/
|
||||||
function CheckPHPVersion($aMinVersion) {
|
function CheckPHPVersion($aMinVersion) {
|
||||||
list($majorC, $minorC, $editC) = preg_split('/[\/.-]/', PHP_VERSION);
|
return version_compare(PHP_VERSION, $aMinVersion, '>=');
|
||||||
list($majorR, $minorR, $editR) = preg_split('/[\/.-]/', $aMinVersion);
|
|
||||||
|
|
||||||
if ($majorC != $majorR) return false;
|
|
||||||
if ($majorC < $majorR) return false;
|
|
||||||
// same major - check minor
|
|
||||||
if ($minorC > $minorR) return true;
|
|
||||||
if ($minorC < $minorR) return false;
|
|
||||||
// and same minor
|
|
||||||
if ($editC >= $editR) return true;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ echo '<div class="panel panel-default">
|
|||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
';
|
';
|
||||||
|
echo "<div class='row'>";
|
||||||
require 'includes/print-graphrow.inc.php';
|
require 'includes/print-graphrow.inc.php';
|
||||||
|
echo '</div>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
$g_i++;
|
$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);
|
$graph_data[] = overlib_link($link, generate_lazy_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL);
|
||||||
}
|
}
|
||||||
else {
|
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(overlib_link($link, generate_lazy_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL));
|
||||||
|
echo "</div>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,9 +38,18 @@ else {
|
|||||||
|
|
||||||
echo "<tr style=\"background-color: $row_colour;\" valign=top onmouseover=\"this.style.backgroundColor='$list_highlight';\" onmouseout=\"this.style.backgroundColor='$row_colour';\" style='cursor: pointer;'>
|
echo "<tr style=\"background-color: $row_colour;\" valign=top onmouseover=\"this.style.backgroundColor='$list_highlight';\" onmouseout=\"this.style.backgroundColor='$row_colour';\" style='cursor: pointer;'>
|
||||||
<td valign=top width=350 onclick=\"location.href='".generate_port_url($port)."'\">";
|
<td valign=top width=350 onclick=\"location.href='".generate_port_url($port)."'\">";
|
||||||
echo ' <span class=list-large>
|
|
||||||
|
// Don't echo out ports ifIndex if it's a NOS device since their ifIndex is, for lack of better words....different
|
||||||
|
if ($device['os'] == 'nos') {
|
||||||
|
echo ' <span class=list-large>
|
||||||
|
'.generate_port_link($port, $port['label'])." $error_img $mac
|
||||||
|
</span><br /><span class=interface-desc>".$port['ifAlias'].'</span>';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo ' <span class=list-large>
|
||||||
'.generate_port_link($port, $port['ifIndex'].'. '.$port['label'])." $error_img $mac
|
'.generate_port_link($port, $port['ifIndex'].'. '.$port['label'])." $error_img $mac
|
||||||
</span><br /><span class=interface-desc>".$port['ifAlias'].'</span>';
|
</span><br /><span class=interface-desc>".$port['ifAlias'].'</span>';
|
||||||
|
}
|
||||||
|
|
||||||
if ($port['ifAlias']) {
|
if ($port['ifAlias']) {
|
||||||
echo '<br />';
|
echo '<br />';
|
||||||
|
|||||||
@@ -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'=>'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'=>'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>
|
<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>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li class="dropdown">
|
<li class="dropdown">
|
||||||
@@ -166,8 +174,13 @@ if ($_SESSION['userlevel'] >= '10') {
|
|||||||
');
|
');
|
||||||
}
|
}
|
||||||
echo '
|
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>
|
<li role="presentation" class="divider"></li>
|
||||||
';
|
';
|
||||||
|
}
|
||||||
|
|
||||||
if ($config['navbar']['manage_groups']['hide'] === 0) {
|
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>';
|
echo '<li><a href="'.generate_url(array('page'=>'device-groups')).'"><i class="fa fa-th fa-fw fa-lg"></i> Manage Groups</a></li>';
|
||||||
|
|||||||
@@ -24,6 +24,9 @@ else if ($service[service_status] == '2') {
|
|||||||
$message = trim($service['service_message']);
|
$message = trim($service['service_message']);
|
||||||
$message = str_replace("\n", '<br />', $message);
|
$message = str_replace("\n", '<br />', $message);
|
||||||
|
|
||||||
|
$desc = trim($service['service_desc']);
|
||||||
|
$desc = str_replace("\n", '<br />', $desc);
|
||||||
|
|
||||||
$since = (time() - $service['service_changed']);
|
$since = (time() - $service['service_changed']);
|
||||||
$since = formatUptime($since);
|
$since = formatUptime($since);
|
||||||
|
|
||||||
@@ -63,6 +66,9 @@ echo "
|
|||||||
<td>
|
<td>
|
||||||
<span class=box-desc>$message</span>
|
<span class=box-desc>$message</span>
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
<span class=box-desc>$desc</span>
|
||||||
|
</td>
|
||||||
</tr>";
|
</tr>";
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
echo '<tr class="list">';
|
echo '<tr class="list">';
|
||||||
|
|
||||||
echo '<td class="list">';
|
echo '<td class="list">';
|
||||||
|
|
||||||
if (getidbyname($vm['vmwVmDisplayName'])) {
|
if (getidbyname($vm['vmwVmDisplayName'])) {
|
||||||
@@ -12,7 +10,13 @@ else {
|
|||||||
}
|
}
|
||||||
|
|
||||||
echo '</td>';
|
echo '</td>';
|
||||||
echo '<td class="list">'.$vm['vmwVmState'].'</td>';
|
|
||||||
|
if ($vm['vmwVmState'] == 'powered off') {
|
||||||
|
echo '<td class="list"><span style="min-width:40px; display:inline-block;" class="label label-default">OFF</span></td>';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo '<td class="list"><span style="min-width:40px; display:inline-block;" class="label label-success">ON</span></td>';
|
||||||
|
}
|
||||||
|
|
||||||
if ($vm['vmwVmGuestOS'] == 'E: tools not installed') {
|
if ($vm['vmwVmGuestOS'] == 'E: tools not installed') {
|
||||||
echo '<td class="box-desc">Unknown (VMware Tools not installed)</td>';
|
echo '<td class="box-desc">Unknown (VMware Tools not installed)</td>';
|
||||||
|
|||||||
@@ -12,20 +12,35 @@ if (is_admin() === false && is_read() === false) {
|
|||||||
|
|
||||||
$sql .= " WHERE M.port_id = P.port_id AND P.device_id = D.device_id $where ";
|
$sql .= " WHERE M.port_id = P.port_id AND P.device_id = D.device_id $where ";
|
||||||
|
|
||||||
if (isset($_POST['searchby']) && $_POST['searchby'] == 'ip') {
|
|
||||||
$sql .= ' AND `ipv4_address` LIKE ?';
|
|
||||||
$param[] = '%'.trim($_POST['address']).'%';
|
|
||||||
}
|
|
||||||
else if (isset($_POST['searchby']) && $_POST['searchby'] == 'mac') {
|
|
||||||
$sql .= ' AND `mac_address` LIKE ?';
|
|
||||||
$param[] = '%'.str_replace(array(':', ' ', '-', '.', '0x'), '', mres($_POST['address'])).'%';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_numeric($_POST['device_id'])) {
|
if (is_numeric($_POST['device_id'])) {
|
||||||
$sql .= ' AND P.device_id = ?';
|
$sql .= ' AND P.device_id = ?';
|
||||||
$param[] = $_POST['device_id'];
|
$param[] = $_POST['device_id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_numeric($_POST['port_id'])) {
|
||||||
|
$sql .= ' AND P.port_id = ?';
|
||||||
|
$param[] = $_POST['port_id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_POST['searchPhrase']) && !empty($_POST['searchPhrase'])) {
|
||||||
|
$ip_search = '%'.mres(trim($_POST['searchPhrase'])).'%';
|
||||||
|
$mac_search = '%'.str_replace(array(':', ' ', '-', '.', '0x'), '', mres($_POST['searchPhrase'])).'%';
|
||||||
|
|
||||||
|
if (isset($_POST['searchby']) && $_POST['searchby'] == 'ip') {
|
||||||
|
$sql .= ' AND `ipv4_address` LIKE ?';
|
||||||
|
$param[] = $ip_search;
|
||||||
|
}
|
||||||
|
else if (isset($_POST['searchby']) && $_POST['searchby'] == 'mac') {
|
||||||
|
$sql .= ' AND `mac_address` LIKE ?';
|
||||||
|
$param[] = $mac_search;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$sql .= ' AND (`ipv4_address` LIKE ? OR `mac_address` LIKE ?)';
|
||||||
|
$param[] = $ip_search;
|
||||||
|
$param[] = $mac_search;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$count_sql = "SELECT COUNT(`M`.`port_id`) $sql";
|
$count_sql = "SELECT COUNT(`M`.`port_id`) $sql";
|
||||||
|
|
||||||
$total = dbFetchCell($count_sql, $param);
|
$total = dbFetchCell($count_sql, $param);
|
||||||
|
|||||||
@@ -0,0 +1,96 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* LibreNMS device MIB association browser
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015 Gear Consulting Pty Ltd <github@libertysys.com.au>
|
||||||
|
*
|
||||||
|
* by Paul Gear
|
||||||
|
* based on code by Søren Friis Rosiak <sorenrosiak@gmail.com>
|
||||||
|
* in commit 054bf3ae209f34a2c3bc8968300722004903df1b
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by the
|
||||||
|
* Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
* option) any later version. Please see LICENSE.txt at the top level of
|
||||||
|
* the source code distribution for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
$columns = array(
|
||||||
|
'module',
|
||||||
|
'mib',
|
||||||
|
'included_by',
|
||||||
|
'last_modified',
|
||||||
|
);
|
||||||
|
|
||||||
|
if (isset($_POST['device_id'])) {
|
||||||
|
// device_id supplied - get details for a single device
|
||||||
|
// used by device MIB page
|
||||||
|
$params = array(
|
||||||
|
$_POST['device_id'],
|
||||||
|
);
|
||||||
|
$sql = 'SELECT * FROM `device_mibs`';
|
||||||
|
$wheresql = ' WHERE `device_id` = ?';
|
||||||
|
$sortcolumns = 3;
|
||||||
|
$count_sql = "SELECT COUNT(*) FROM `device_mibs`".$wheresql;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// device_id not supplied - get details for a all devices
|
||||||
|
// used by all device MIBs page
|
||||||
|
$params = array();
|
||||||
|
$sql = 'SELECT `d`.`hostname` as `hostname`, `dm`.* FROM `devices` `d`, `device_mibs` `dm`';
|
||||||
|
$wheresql = ' WHERE `d`.`device_id` = `dm`.`device_id`';
|
||||||
|
array_unshift($columns, 'hostname');
|
||||||
|
$sortcolumns = 4;
|
||||||
|
$count_sql = "SELECT COUNT(*) FROM `devices` `d`, `device_mibs` `dm`".$wheresql;
|
||||||
|
}
|
||||||
|
|
||||||
|
// all columns are searchable - search across them
|
||||||
|
if (isset($searchPhrase) && !empty($searchPhrase)) {
|
||||||
|
$searchsql = implode(' OR ', array_map("search_phrase_column", array_map("mres", $columns)));
|
||||||
|
$wheresql .= " AND ( $searchsql )";
|
||||||
|
}
|
||||||
|
$sql .= $wheresql;
|
||||||
|
|
||||||
|
// get total
|
||||||
|
$total = dbFetchCell($count_sql, $params);
|
||||||
|
if (empty($total)) {
|
||||||
|
$total = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// set up default sort
|
||||||
|
if (!isset($sort) || empty($sort)) {
|
||||||
|
$sort = implode(', ', array_map("mres", array_slice($columns, 0, $sortcolumns)));
|
||||||
|
}
|
||||||
|
$sql .= " ORDER BY $sort";
|
||||||
|
|
||||||
|
// select only the required rows
|
||||||
|
if (isset($current)) {
|
||||||
|
$limit_low = (($current * $rowCount) - ($rowCount));
|
||||||
|
$limit_high = $rowCount;
|
||||||
|
}
|
||||||
|
if ($rowCount != -1) {
|
||||||
|
$sql .= " LIMIT $limit_low,$limit_high";
|
||||||
|
}
|
||||||
|
|
||||||
|
// load data from database into response array
|
||||||
|
$response = array();
|
||||||
|
foreach (dbFetchRows($sql, $params) as $mib) {
|
||||||
|
$mibrow = array();
|
||||||
|
foreach ($columns as $col) {
|
||||||
|
$mibrow[$col] = $mib[$col];
|
||||||
|
}
|
||||||
|
if (!isset($_POST['device_id'])) {
|
||||||
|
$device = device_by_id_cache($mib['device_id']);
|
||||||
|
$mibrow['hostname'] = generate_device_link($device,
|
||||||
|
$mib['hostname'], array('tab' => 'mib'));
|
||||||
|
}
|
||||||
|
$response[] = $mibrow;
|
||||||
|
}
|
||||||
|
|
||||||
|
$output = array(
|
||||||
|
'current' => $current,
|
||||||
|
'rowCount' => $rowCount,
|
||||||
|
'rows' => $response,
|
||||||
|
'total' => $total,
|
||||||
|
);
|
||||||
|
echo _json_encode($output);
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* LibreNMS device MIB OID browser
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015 Gear Consulting Pty Ltd <github@libertysys.com.au>
|
||||||
|
*
|
||||||
|
* by Paul Gear
|
||||||
|
* based on code by Søren Friis Rosiak <sorenrosiak@gmail.com>
|
||||||
|
* in commit 054bf3ae209f34a2c3bc8968300722004903df1b
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by the
|
||||||
|
* Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
* option) any later version. Please see LICENSE.txt at the top level of
|
||||||
|
* the source code distribution for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
$columns = array(
|
||||||
|
'module',
|
||||||
|
'mib',
|
||||||
|
'object_type',
|
||||||
|
'oid',
|
||||||
|
'value',
|
||||||
|
'numvalue',
|
||||||
|
'last_modified',
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
$params = array(
|
||||||
|
$_POST['device_id'],
|
||||||
|
);
|
||||||
|
|
||||||
|
// start of sql definition
|
||||||
|
$sql = 'SELECT * FROM `device_oids`';
|
||||||
|
|
||||||
|
$wheresql = ' WHERE `device_id` = ?';
|
||||||
|
|
||||||
|
// all columns are searchable - search across them
|
||||||
|
if (isset($searchPhrase) && !empty($searchPhrase)) {
|
||||||
|
$searchsql = implode(' OR ', array_map("search_phrase_column", array_map("mres", $columns)));
|
||||||
|
$wheresql .= " AND ( $searchsql )";
|
||||||
|
}
|
||||||
|
$sql .= $wheresql;
|
||||||
|
|
||||||
|
// get total
|
||||||
|
$count_sql = "SELECT COUNT(*) FROM `device_oids`".$wheresql;
|
||||||
|
$total = dbFetchCell($count_sql, $params);
|
||||||
|
if (empty($total)) {
|
||||||
|
$total = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// sort by first three columns by default
|
||||||
|
if (!isset($sort) || empty($sort)) {
|
||||||
|
$sort = implode(', ', array_map("mres", array_slice($columns, 0, 3)));
|
||||||
|
}
|
||||||
|
$sql .= " ORDER BY $sort";
|
||||||
|
|
||||||
|
// select only the required rows
|
||||||
|
if (isset($current)) {
|
||||||
|
$limit_low = (($current * $rowCount) - ($rowCount));
|
||||||
|
$limit_high = $rowCount;
|
||||||
|
}
|
||||||
|
if ($rowCount != -1) {
|
||||||
|
$sql .= " LIMIT $limit_low,$limit_high";
|
||||||
|
}
|
||||||
|
|
||||||
|
// load data from database into response array
|
||||||
|
$response = array();
|
||||||
|
foreach (dbFetchRows($sql, $params) as $mib) {
|
||||||
|
$mibrow = array();
|
||||||
|
foreach ($columns as $col) {
|
||||||
|
$mibrow[$col] = $mib[$col];
|
||||||
|
}
|
||||||
|
$response[] = $mibrow;
|
||||||
|
}
|
||||||
|
|
||||||
|
$output = array(
|
||||||
|
'current' => $current,
|
||||||
|
'rowCount' => $rowCount,
|
||||||
|
'rows' => $response,
|
||||||
|
'total' => $total,
|
||||||
|
);
|
||||||
|
echo _json_encode($output);
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* LibreNMS MIB definition browser
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015 Gear Consulting Pty Ltd <github@libertysys.com.au>
|
||||||
|
*
|
||||||
|
* by Paul Gear
|
||||||
|
* based on code by Søren Friis Rosiak <sorenrosiak@gmail.com>
|
||||||
|
* in commit 054bf3ae209f34a2c3bc8968300722004903df1b
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by the
|
||||||
|
* Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
* option) any later version. Please see LICENSE.txt at the top level of
|
||||||
|
* the source code distribution for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
$columns = array(
|
||||||
|
'module',
|
||||||
|
'mib',
|
||||||
|
'object_type',
|
||||||
|
'oid',
|
||||||
|
'syntax',
|
||||||
|
'description',
|
||||||
|
'max_access',
|
||||||
|
'status',
|
||||||
|
'included_by',
|
||||||
|
'last_modified',
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// start of sql definition
|
||||||
|
$sql = 'SELECT * FROM `mibdefs`';
|
||||||
|
|
||||||
|
// all columns are searchable - search across them
|
||||||
|
if (isset($searchPhrase) && !empty($searchPhrase)) {
|
||||||
|
$searchsql = implode(' OR ', array_map("search_phrase_column", array_map("mres", $columns)));
|
||||||
|
$wheresql .= " WHERE ( $searchsql )";
|
||||||
|
$sql .= $wheresql;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get total
|
||||||
|
$count_sql = "SELECT COUNT(`object_type`) FROM `mibdefs`".$wheresql;
|
||||||
|
$total = dbFetchCell($count_sql);
|
||||||
|
if (empty($total)) {
|
||||||
|
$total = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// sort by first three columns by default
|
||||||
|
if (!isset($sort) || empty($sort)) {
|
||||||
|
$sort = implode(', ', array_map("mres", array_slice($columns, 0, 3)));
|
||||||
|
}
|
||||||
|
$sql .= " ORDER BY $sort";
|
||||||
|
|
||||||
|
// select only the required rows
|
||||||
|
if (isset($current)) {
|
||||||
|
$limit_low = (($current * $rowCount) - ($rowCount));
|
||||||
|
$limit_high = $rowCount;
|
||||||
|
}
|
||||||
|
if ($rowCount != -1) {
|
||||||
|
$sql .= " LIMIT $limit_low,$limit_high";
|
||||||
|
}
|
||||||
|
|
||||||
|
// load data from database into response array
|
||||||
|
$response = array();
|
||||||
|
foreach (dbFetchRows($sql) as $mib) {
|
||||||
|
$mibrow = array();
|
||||||
|
foreach ($columns as $col) {
|
||||||
|
$mibrow[$col] = $mib[$col];
|
||||||
|
}
|
||||||
|
$response[] = $mibrow;
|
||||||
|
}
|
||||||
|
|
||||||
|
$output = array(
|
||||||
|
'current' => $current,
|
||||||
|
'rowCount' => $rowCount,
|
||||||
|
'rows' => $response,
|
||||||
|
'total' => $total,
|
||||||
|
);
|
||||||
|
echo _json_encode($output);
|
||||||
+8
-3
@@ -15,8 +15,13 @@ if(file_exists('../config.php') && $stage != "6") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// List of php modules we expect to see
|
// 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';
|
$dbhost = @$_POST['dbhost'] ?: 'localhost';
|
||||||
$dbuser = @$_POST['dbuser'] ?: 'librenms';
|
$dbuser = @$_POST['dbuser'] ?: 'librenms';
|
||||||
$dbpass = @$_POST['dbpass'] ?: '';
|
$dbpass = @$_POST['dbpass'] ?: '';
|
||||||
@@ -231,7 +236,7 @@ if($stage == 0) {
|
|||||||
<td>pear</td>
|
<td>pear</td>
|
||||||
<td>$ext_loaded</td>");
|
<td>$ext_loaded</td>");
|
||||||
if($ext_loaded == 'no') {
|
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 {
|
else {
|
||||||
echo("<td></td>");
|
echo("<td></td>");
|
||||||
|
|||||||
@@ -29,6 +29,6 @@
|
|||||||
You are about to delete this bill.
|
You are about to delete this bill.
|
||||||
</div>
|
</div>
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
<button id="deleteBtn" type="submit" class="btn btn-danger" disabled="disabled"><i class="icon-trash icon-white"></i> <strong>Delete Bill</strong></button>
|
<button id="deleteBtn" type="submit" class="btn btn-danger" disabled="disabled"><i class="fa fa-trash"></i> <strong>Delete Bill</strong></button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
+202
-191
@@ -1,123 +1,123 @@
|
|||||||
<?php
|
<?php
|
||||||
|
require 'includes/javascript-interfacepicker.inc.php';
|
||||||
require 'includes/javascript-interfacepicker.inc.php';
|
|
||||||
|
// This needs more verification. Is it already added? Does it exist?
|
||||||
// This needs more verification. Is it already added? Does it exist?
|
// Calculation to extract MB/GB/TB of Kbps/Mbps/Gbps
|
||||||
// Calculation to extract MB/GB/TB of Kbps/Mbps/Gbps
|
$base = $config['billing']['base'];
|
||||||
$base = $config['billing']['base'];
|
|
||||||
|
if ($bill_data['bill_type'] == 'quota') {
|
||||||
if ($bill_data['bill_type'] == 'quota') {
|
$data = $bill_data['bill_quota'];
|
||||||
$data = $bill_data['bill_quota'];
|
$tmp['mb'] = ($data / $base / $base);
|
||||||
$tmp['mb'] = ($data / $base / $base);
|
$tmp['gb'] = ($data / $base / $base / $base);
|
||||||
$tmp['gb'] = ($data / $base / $base / $base);
|
$tmp['tb'] = ($data / $base / $base / $base / $base);
|
||||||
$tmp['tb'] = ($data / $base / $base / $base / $base);
|
if ($tmp['tb'] >= 1) {
|
||||||
if ($tmp['tb'] >= 1) {
|
$quota = array(
|
||||||
$quota = array(
|
'type' => 'tb',
|
||||||
'type' => 'tb',
|
'select_tb' => ' selected',
|
||||||
'select_tb' => ' selected',
|
'data' => $tmp['tb'],
|
||||||
'data' => $tmp['tb'],
|
);
|
||||||
);
|
}
|
||||||
}
|
else if (($tmp['gb'] >= 1) and ($tmp['gb'] < $base)) {
|
||||||
else if (($tmp['gb'] >= 1) and ($tmp['gb'] < $base)) {
|
$quota = array(
|
||||||
$quota = array(
|
'type' => 'gb',
|
||||||
'type' => 'gb',
|
'select_gb' => ' selected',
|
||||||
'select_gb' => ' selected',
|
'data' => $tmp['gb'],
|
||||||
'data' => $tmp['gb'],
|
);
|
||||||
);
|
}
|
||||||
}
|
else if (($tmp['mb'] >= 1) and ($tmp['mb'] < $base)) {
|
||||||
else if (($tmp['mb'] >= 1) and ($tmp['mb'] < $base)) {
|
$quota = array(
|
||||||
$quota = array(
|
'type' => 'mb',
|
||||||
'type' => 'mb',
|
'select_mb' => ' selected',
|
||||||
'select_mb' => ' selected',
|
'data' => $tmp['mb'],
|
||||||
'data' => $tmp['mb'],
|
);
|
||||||
);
|
}
|
||||||
}
|
}//end if
|
||||||
}//end if
|
|
||||||
|
if ($bill_data['bill_type'] == 'cdr') {
|
||||||
if ($bill_data['bill_type'] == 'cdr') {
|
$data = $bill_data['bill_cdr'];
|
||||||
$data = $bill_data['bill_cdr'];
|
$tmp['kbps'] = ($data / $base);
|
||||||
$tmp['kbps'] = ($data / $base);
|
$tmp['mbps'] = ($data / $base / $base);
|
||||||
$tmp['mbps'] = ($data / $base / $base);
|
$tmp['gbps'] = ($data / $base / $base / $base);
|
||||||
$tmp['gbps'] = ($data / $base / $base / $base);
|
if ($tmp['gbps'] >= 1) {
|
||||||
if ($tmp['gbps'] >= 1) {
|
$cdr = array(
|
||||||
$cdr = array(
|
'type' => 'gbps',
|
||||||
'type' => 'gbps',
|
'select_gbps' => ' selected',
|
||||||
'select_gbps' => ' selected',
|
'data' => $tmp['gbps'],
|
||||||
'data' => $tmp['gbps'],
|
);
|
||||||
);
|
}
|
||||||
}
|
else if (($tmp['mbps'] >= 1) and ($tmp['mbps'] < $base)) {
|
||||||
else if (($tmp['mbps'] >= 1) and ($tmp['mbps'] < $base)) {
|
$cdr = array(
|
||||||
$cdr = array(
|
'type' => 'mbps',
|
||||||
'type' => 'mbps',
|
'select_mbps' => ' selected',
|
||||||
'select_mbps' => ' selected',
|
'data' => $tmp['mbps'],
|
||||||
'data' => $tmp['mbps'],
|
);
|
||||||
);
|
}
|
||||||
}
|
else if (($tmp['kbps'] >= 1) and ($tmp['kbps'] < $base)) {
|
||||||
else if (($tmp['kbps'] >= 1) and ($tmp['kbps'] < $base)) {
|
$cdr = array(
|
||||||
$cdr = array(
|
'type' => 'kbps',
|
||||||
'type' => 'kbps',
|
'select_kbps' => ' selected',
|
||||||
'select_kbps' => ' selected',
|
'data' => $tmp['kbps'],
|
||||||
'data' => $tmp['kbps'],
|
);
|
||||||
);
|
}
|
||||||
}
|
}//end if
|
||||||
}//end if
|
|
||||||
|
?>
|
||||||
?>
|
|
||||||
|
|
||||||
<form id="edit" name="edit" method="post" action="" class="form-horizontal" role="form">
|
<form id="edit" name="edit" method="post" action="" class="form-horizontal" role="form">
|
||||||
<input type=hidden name="action" value="update_bill">
|
<input type=hidden name="action" value="update_bill">
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function billType() {
|
function billType() {
|
||||||
$('#cdrDiv').toggle();
|
$('#cdrDiv').toggle();
|
||||||
$('#quotaDiv').toggle();
|
$('#quotaDiv').toggle();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<h3>Bill Properties</h3>
|
<h3>Bill Properties</h3>
|
||||||
|
<hr>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-2 control-label" for="bill_name"><strong>Description</strong></label>
|
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
|
<label class="control-label" for="bill_name">
|
||||||
|
<h5><strong>Description</strong></h5>
|
||||||
|
</label>
|
||||||
<input class="form-control input-sm" name="bill_name" value="<?php echo $bill_data['bill_name']; ?>" />
|
<input class="form-control input-sm" name="bill_name" value="<?php echo $bill_data['bill_name']; ?>" />
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6">
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-2 control-label" for="bill_type"><strong>Billing Type</strong></label>
|
<div class="col-sm-4">
|
||||||
<div class="col-sm-10">
|
<label class="control-label" for="bill_type">
|
||||||
|
<h5><strong>Billing Type</strong></h5>
|
||||||
|
</label>
|
||||||
|
<br>
|
||||||
<div class="radio">
|
<div class="radio">
|
||||||
<label>
|
<label>
|
||||||
<input type="radio" name="bill_type" value="cdr" onchange="javascript: billType();"
|
<input type="radio" name="bill_type" value="cdr" onchange="javascript: billType();"
|
||||||
<?php
|
<?php
|
||||||
if ($bill_data['bill_type'] == 'cdr') {
|
if ($bill_data['bill_type'] == 'cdr') {
|
||||||
echo 'checked ';
|
echo 'checked ';
|
||||||
};
|
};
|
||||||
?>
|
?>
|
||||||
/> CDR 95th
|
/> CDR 95th
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="radio">
|
<div class="radio">
|
||||||
<label>
|
<label>
|
||||||
<input type="radio" name="bill_type" value="quota" onchange="javascript: billType();"
|
<input type="radio" name="bill_type" value="quota" onchange="javascript: billType();"
|
||||||
<?php
|
<?php
|
||||||
if ($bill_data['bill_type'] == 'quota') {
|
if ($bill_data['bill_type'] == 'quota') {
|
||||||
echo 'checked ';
|
echo 'checked ';
|
||||||
};
|
};
|
||||||
?>
|
?>
|
||||||
/> Quota
|
/> Quota
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="cdrDiv"
|
<div id="cdrDiv"
|
||||||
<?php
|
<?php
|
||||||
if ($bill_data['bill_type'] == 'quota') {
|
if ($bill_data['bill_type'] == 'quota') {
|
||||||
echo ' style="display: none"';
|
echo ' style="display: none"';
|
||||||
};
|
};
|
||||||
?>
|
?>
|
||||||
>
|
>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-sm-2">
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-2">
|
<div class="col-sm-2">
|
||||||
<input class="form-control input-sm" type="text" name="bill_cdr" value="<?php echo $cdr['data']; ?>">
|
<input class="form-control input-sm" type="text" name="bill_cdr" value="<?php echo $cdr['data']; ?>">
|
||||||
</div>
|
</div>
|
||||||
@@ -133,15 +133,13 @@ if ($bill_data['bill_type'] == 'quota') {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="quotaDiv"
|
<div id="quotaDiv"
|
||||||
<?php
|
<?php
|
||||||
if ($bill_data['bill_type'] == 'cdr') {
|
if ($bill_data['bill_type'] == 'cdr') {
|
||||||
echo ' style="display: none"';
|
echo ' style="display: none"';
|
||||||
};
|
};
|
||||||
?>
|
?>
|
||||||
>
|
>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-sm-2">
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-2">
|
<div class="col-sm-2">
|
||||||
<input class="form-control input-sm" type="text" name="bill_quota" value="<?php echo $quota['data']; ?>">
|
<input class="form-control input-sm" type="text" name="bill_quota" value="<?php echo $quota['data']; ?>">
|
||||||
</div>
|
</div>
|
||||||
@@ -157,132 +155,145 @@ if ($bill_data['bill_type'] == 'cdr') {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-2 control-label" for="bill_day"><strong>Billing Day</strong></label>
|
|
||||||
<div class="col-sm-2">
|
<div class="col-sm-2">
|
||||||
|
<label class="control-label" for="bill_day">
|
||||||
|
<h5><strong>Billing Day</strong></h5>
|
||||||
|
</label>
|
||||||
<select name="bill_day" class="form-control input">
|
<select name="bill_day" class="form-control input">
|
||||||
<?php
|
<?php
|
||||||
for ($x = 1; $x < 32; $x++) {
|
for ($x = 1; $x < 32; $x++) {
|
||||||
$select = (($bill_data['bill_day'] == $x) ? ' selected' : '');
|
$select = (($bill_data['bill_day'] == $x) ? ' selected' : '');
|
||||||
echo ' <option value="'.$x.'"'.$select.'>'.$x."</option>\n";
|
echo ' <option value="'.$x.'"'.$select.'>'.$x."</option>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<br>
|
||||||
<h3>Optional Information</h3>
|
<h3>Optional Information</h3>
|
||||||
|
<hr>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-2 control-label" for="bill_custid"><strong>Customer Reference</strong></label>
|
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
|
<label class="control-label" for="bill_custid">
|
||||||
|
<h5><strong>Customer Reference</strong></h5>
|
||||||
|
</label>
|
||||||
<input class="form-control input-sm" type="text" name="bill_custid" value="<?php echo $bill_data['bill_custid']; ?>" />
|
<input class="form-control input-sm" type="text" name="bill_custid" value="<?php echo $bill_data['bill_custid']; ?>" />
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-2 control-label" for="bill_ref"><strong>Billing Reference</strong></label>
|
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
|
<label class="control-label" for="bill_ref">
|
||||||
|
<h5><strong>Billing Reference</strong></h5>
|
||||||
|
</label>
|
||||||
<input class="form-control input-sm" type="text" name="bill_ref" value="<?php echo $bill_data['bill_ref']; ?>" />
|
<input class="form-control input-sm" type="text" name="bill_ref" value="<?php echo $bill_data['bill_ref']; ?>" />
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-2 control-label" for="bill_notes"><strong>Notes</strong></label>
|
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
|
<label class="control-label" for="bill_notes">
|
||||||
|
<h5><strong>Notes</strong></h5>
|
||||||
|
</label>
|
||||||
<textarea rows="3" class="form-control input-sm" name="bill_notes" value="<?php echo $bill_data['bill_notes']; ?>"></textarea>
|
<textarea rows="3" class="form-control input-sm" name="bill_notes" value="<?php echo $bill_data['bill_notes']; ?>"></textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn btn-success" name="Submit" value="Save" /><i class="icon-ok icon-white"></i> <strong>Save Properties</strong></button>
|
<button type="submit" class="btn btn-success" name="Submit" value="Save" /><i class="fa fa-check"></i> <strong>Save Properties</strong></button>
|
||||||
</form>
|
</form>
|
||||||
|
<br>
|
||||||
<h3>Billed Ports</h3>
|
<h3>Billed Ports</h3>
|
||||||
<div class="form-group">
|
<hr>
|
||||||
<?php
|
<div class="form-group">
|
||||||
$ports = dbFetchRows(
|
<?php
|
||||||
'SELECT * FROM `bill_ports` AS B, `ports` AS P, `devices` AS D
|
//This needs a proper cleanup
|
||||||
WHERE B.bill_id = ? AND P.port_id = B.port_id
|
$ports = dbFetchRows(
|
||||||
AND D.device_id = P.device_id ORDER BY D.device_id',
|
'SELECT * FROM `bill_ports` AS B, `ports` AS P, `devices` AS D
|
||||||
array($bill_data['bill_id'])
|
WHERE B.bill_id = ? AND P.port_id = B.port_id
|
||||||
);
|
AND D.device_id = P.device_id ORDER BY D.device_id',
|
||||||
|
array($bill_data['bill_id'])
|
||||||
if (is_array($ports)) {
|
);
|
||||||
foreach ($ports as $port) {
|
|
||||||
$emptyCheck = true;
|
if (is_array($ports)) {
|
||||||
$devicebtn = str_replace('list-device', 'btn', generate_device_link($port));
|
foreach ($ports as $port) {
|
||||||
$devicebtn = str_replace("overlib('", "overlib('<div style=\'border: 5px solid #e5e5e5; background: #fff; padding: 10px;\'>", $devicebtn);
|
$emptyCheck = true;
|
||||||
$devicebtn = str_replace("<div>',;", "</div></div>',", $devicebtn);
|
$devicebtn = str_replace('list-device', 'btn', generate_device_link($port));
|
||||||
$portbtn = str_replace('interface-upup', 'btn', generate_port_link($port));
|
$devicebtn = str_replace("overlib('", "overlib('<div style=\'border: 5px solid #e5e5e5; background: #fff; padding: 10px;\'>", $devicebtn);
|
||||||
$portbtn = str_replace('interface-updown', 'btn btn-warning', $portbtn);
|
$devicebtn = str_replace("<div>',;", "</div></div>',", $devicebtn);
|
||||||
$portbtn = str_replace('interface-downdown', 'btn btn-warning', $portbtn);
|
$portbtn = str_replace('interface-upup', 'btn', generate_port_link($port));
|
||||||
$portbtn = str_replace('interface-admindown', 'btn btn-warning disabled', $portbtn);
|
$portbtn = str_replace('interface-updown', 'btn btn-warning', $portbtn);
|
||||||
$portbtn = str_replace("overlib('", "overlib('<div style=\'border: 5px solid #e5e5e5; background: #fff; padding: 10px;\'>", $portbtn);
|
$portbtn = str_replace('interface-downdown', 'btn btn-warning', $portbtn);
|
||||||
$portbtn = str_replace("<div>',;", "</div></div>',", $portbtn);
|
$portbtn = str_replace('interface-admindown', 'btn btn-warning disabled', $portbtn);
|
||||||
$portalias = (empty($port['ifAlias']) ? '' : ' - '.$port['ifAlias'].'');
|
$portbtn = str_replace("overlib('", "overlib('<div style=\'border: 5px solid #e5e5e5; background: #fff; padding: 10px;\'>", $portbtn);
|
||||||
$devicebtn = str_replace('">'.$port['hostname'], '" style="color: #000;"><i class="glyphicon glyphicon-asterisk"></i> '.$port['hostname'], $devicebtn);
|
$portbtn = str_replace("<div>',;", "</div></div>',", $portbtn);
|
||||||
$portbtn = str_replace('">'.strtolower($port['ifName']), '" style="color: #000;"><i class="glyphicon glyphicon-random"></i> '.$port['ifName'].''.$portalias, $portbtn);
|
$portalias = (empty($port['ifAlias']) ? '' : ' - '.$port['ifAlias'].'');
|
||||||
echo ' <form action="" class="form-inline" method="post" name="delete'.$port['port_id']."\" style=\"display: none;\">\n";
|
$devicebtn = str_replace('">'.$port['hostname'], '" style="color: #000;"><i class="fa fa-asterisk"></i> '.$port['hostname'], $devicebtn);
|
||||||
echo " <input type=\"hidden\" name=\"action\" value=\"delete_bill_port\" />\n";
|
$portbtn = str_replace('">'.strtolower($port['ifName']), '" style="color: #000;"><i class="fa fa-random"></i> '.$port['ifName'].''.$portalias, $portbtn);
|
||||||
echo ' <input type="hidden" name="port_id" value="'.$port['port_id']."\" />\n";
|
echo ' <form action="" class="form-inline" method="post" name="delete'.$port['port_id']."\" style=\"display: none;\">\n";
|
||||||
echo " </form>\n";
|
echo " <input type=\"hidden\" name=\"action\" value=\"delete_bill_port\" />\n";
|
||||||
echo " <div class=\"btn-toolbar\">\n";
|
echo ' <input type="hidden" name="port_id" value="'.$port['port_id']."\" />\n";
|
||||||
echo " <div class=\"btn-group\" style=\"width: 600px;\">\n";
|
echo " </form>\n";
|
||||||
// echo(" <a class=\"btn btn-danger\" href=\"javascript:;\" onclick=\"document.delete".$port['port_id'].".submit();\" style=\"color: #fff;\"><i class=\"icon-trash icon-white\"></i></a>\n");
|
echo " <div class=\"btn-toolbar\">\n";
|
||||||
echo ' '.$devicebtn."\n";
|
echo " <div class=\"btn-group\" style=\"width: 600px;\">\n";
|
||||||
echo ' '.$portbtn."\n";
|
echo ' '.$devicebtn."\n";
|
||||||
echo " </div>\n";
|
echo ' '.$portbtn."\n";
|
||||||
echo " <div class=\"btn-group\">\n";
|
echo " </div>\n";
|
||||||
echo ' <a class="btn btn-danger btn-mini" href="javascript:;" onclick="document.delete'.$port['port_id'].".submit();\" style=\"color: #fff;\"><i class=\"icon-minus-sign icon-white\"></i> <strong>Remove Interface</strong></a>\n";
|
echo " <div class=\"btn-group\">\n";
|
||||||
echo " </div>\n";
|
echo ' <a class="btn btn-danger btn-mini" href="javascript:;" onclick="document.forms[\'delete'.$port['port_id']."'].submit();\" style=\"color: #fff;\"><i class=\"fa fa-minus\"></i> <strong>Remove Interface</strong></a>\n";
|
||||||
echo " </div>\n";
|
echo " </div>\n";
|
||||||
}//end foreach
|
echo " </div>\n";
|
||||||
|
}
|
||||||
if (!$emptyCheck) {
|
|
||||||
echo " <div class=\"alert alert-info\">\n";
|
if (!$emptyCheck) {
|
||||||
echo " <i class=\"icon-info-sign\"></i> <strong>There are no ports assigned to this bill</strong>\n";
|
echo " <div class=\"alert alert-info\">\n";
|
||||||
echo " </div>\n";
|
echo " <i class=\"fa fa-info\"></i> <strong>There are no ports assigned to this bill</strong>\n";
|
||||||
|
echo " </div>\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}//end if
|
?>
|
||||||
?>
|
</div>
|
||||||
</div>
|
</fieldset>
|
||||||
</fieldset>
|
|
||||||
<form action="" method="post" class="form-horizontal" role="form">
|
<form action="" method="post" class="form-horizontal" role="form">
|
||||||
<input type="hidden" name="action" value="add_bill_port" />
|
<input type="hidden" name="action" value="add_bill_port" />
|
||||||
<input type="hidden" name="bill_id" value="<?php echo $bill_id; ?>" />
|
<input type="hidden" name="bill_id" value="<?php echo $bill_id; ?>" />
|
||||||
|
<br>
|
||||||
<h3>Add Port</h3>
|
<h3>Add Port</h3>
|
||||||
|
<hr>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-2 control-label" for="device"><strong>Device</strong></label>
|
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
|
<label class="control-label" for="device">
|
||||||
|
<h5><strong>Device</strong></h5>
|
||||||
|
</label>
|
||||||
<select class="form-control input-sm" id="device" name="device" onchange="getInterfaceList(this)">
|
<select class="form-control input-sm" id="device" name="device" onchange="getInterfaceList(this)">
|
||||||
<option value=''>Select a device</option>
|
<option value=''>Select a device</option>
|
||||||
<?php
|
<?php
|
||||||
$devices = dbFetchRows('SELECT * FROM `devices` ORDER BY hostname');
|
$devices = dbFetchRows('SELECT * FROM `devices` ORDER BY hostname');
|
||||||
foreach ($devices as $device) {
|
foreach ($devices as $device) {
|
||||||
unset($done);
|
unset($done);
|
||||||
foreach ($access_list as $ac) {
|
foreach ($access_list as $ac) {
|
||||||
if ($ac == $device['device_id']) {
|
if ($ac == $device['device_id']) {
|
||||||
$done = 1;
|
$done = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$done) {
|
if (!$done) {
|
||||||
echo " <option value='".$device['device_id']."'>".$device['hostname']."</option>\n";
|
echo " <option value='".$device['device_id']."'>".$device['hostname']."</option>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6">
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-2 control-label" for="port_id"><strong>Interface</strong></label>
|
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
|
<label class="control-label" for="port_id">
|
||||||
|
<h5><strong>Port</strong></h5>
|
||||||
|
</label>
|
||||||
<select class="form-control input-sm" id="port_id" name="port_id"></select>
|
<select class="form-control input-sm" id="port_id" name="port_id"></select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6">
|
|
||||||
<div>
|
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn btn-primary" name="Submit" value=" Add " /><i class="icon-plus-sign icon-white"></i> <strong>Add Interface</strong></button>
|
<button type="submit" class="btn btn-primary" name="Submit" value=" Add " /><i class="fa fa-plus"></i> <strong>Add Port</strong></button>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -37,6 +37,6 @@
|
|||||||
Are you sure you want to reset all <strong>MySQL</strong> and/or <strong>RRD</strong> data for all interface on this bill?
|
Are you sure you want to reset all <strong>MySQL</strong> and/or <strong>RRD</strong> data for all interface on this bill?
|
||||||
</div>
|
</div>
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
<button id="resetBtn" type="submit" class="btn btn-danger" disabled="disabled"><i class="icon-refresh icon-white"></i> <strong>Reset Bill</strong></button>
|
<button id="resetBtn" type="submit" class="btn btn-danger" disabled="disabled"><i class="fa fa-refresh"></i> <strong>Reset Bill</strong></button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
@@ -76,7 +76,7 @@ if ($_POST['addbill'] == 'yes') {
|
|||||||
$message .= $message_break.'Port '.mres($_POST['port']).' added!';
|
$message .= $message_break.'Port '.mres($_POST['port']).' added!';
|
||||||
$message_break .= '<br />';
|
$message_break .= '<br />';
|
||||||
}
|
}
|
||||||
}//end if
|
}
|
||||||
|
|
||||||
$pagetitle[] = 'Billing';
|
$pagetitle[] = 'Billing';
|
||||||
|
|
||||||
@@ -130,10 +130,10 @@ else if ($vars['view'] == 'add') {
|
|||||||
$devicebtn = str_replace('list-device', 'btn', generate_device_link($port));
|
$devicebtn = str_replace('list-device', 'btn', generate_device_link($port));
|
||||||
$portbtn = str_replace('interface-upup', 'btn', generate_port_link($port));
|
$portbtn = str_replace('interface-upup', 'btn', generate_port_link($port));
|
||||||
$portalias = (empty($port['ifAlias']) ? '' : ' - '.$port['ifAlias'].'');
|
$portalias = (empty($port['ifAlias']) ? '' : ' - '.$port['ifAlias'].'');
|
||||||
$devicebtn = str_replace('">'.$port['hostname'], '" style="color: #000;"><i class="icon-asterisk"></i> '.$port['hostname'], $devicebtn);
|
$devicebtn = str_replace('">'.$port['hostname'], '" style="color: #000;"><i class="fa fa-asterisk"></i> '.$port['hostname'], $devicebtn);
|
||||||
$devicebtn = str_replace("overlib('", "overlib('<div style=\'border: 5px solid #e5e5e5; background: #fff; padding: 10px;\'>", $devicebtn);
|
$devicebtn = str_replace("overlib('", "overlib('<div style=\'border: 5px solid #e5e5e5; background: #fff; padding: 10px;\'>", $devicebtn);
|
||||||
$devicebtn = str_replace("<div>',;", "</div></div>',", $devicebtn);
|
$devicebtn = str_replace("<div>',;", "</div></div>',", $devicebtn);
|
||||||
$portbtn = str_replace('">'.strtolower($port['ifName']), '" style="color: #000;"><i class="icon-random"></i> '.$port['ifName'].''.$portalias, $portbtn);
|
$portbtn = str_replace('">'.strtolower($port['ifName']), '" style="color: #000;"><i class="fa fa-random"></i> '.$port['ifName'].''.$portalias, $portbtn);
|
||||||
$portbtn = str_replace("overlib('", "overlib('<div style=\'border: 5px solid #e5e5e5; background: #fff; padding: 10px;\'>", $portbtn);
|
$portbtn = str_replace("overlib('", "overlib('<div style=\'border: 5px solid #e5e5e5; background: #fff; padding: 10px;\'>", $portbtn);
|
||||||
$portbtn = str_replace("<div>',;", "</div></div>',", $portbtn);
|
$portbtn = str_replace("<div>',;", "</div></div>',", $portbtn);
|
||||||
echo " <fieldset>\n";
|
echo " <fieldset>\n";
|
||||||
@@ -148,7 +148,7 @@ else if ($vars['view'] == 'add') {
|
|||||||
echo " </div>\n";
|
echo " </div>\n";
|
||||||
echo " </div>\n";
|
echo " </div>\n";
|
||||||
echo " </fieldset>\n";
|
echo " </fieldset>\n";
|
||||||
}//end if
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@@ -240,7 +240,7 @@ else if ($vars['view'] == 'add') {
|
|||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn btn-default"><i class="icon-ok-sign icon-white"></i> <strong>Add Bill</strong></button>
|
<button type="submit" class="btn btn-success"><i class="fa fa-check"></i> <strong>Add Bill</strong></button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
@@ -266,7 +266,6 @@ else {
|
|||||||
$day_data = getDates($bill['bill_day']);
|
$day_data = getDates($bill['bill_day']);
|
||||||
$datefrom = $day_data['0'];
|
$datefrom = $day_data['0'];
|
||||||
$dateto = $day_data['1'];
|
$dateto = $day_data['1'];
|
||||||
// $rate_data = getRates($bill['bill_id'],$datefrom,$dateto);
|
|
||||||
$rate_data = $bill;
|
$rate_data = $bill;
|
||||||
$rate_95th = $rate_data['rate_95th'];
|
$rate_95th = $rate_data['rate_95th'];
|
||||||
$dir_95th = $rate_data['dir_95th'];
|
$dir_95th = $rate_data['dir_95th'];
|
||||||
@@ -316,10 +315,8 @@ else {
|
|||||||
";
|
";
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
} //end if
|
}
|
||||||
}//end foreach
|
}
|
||||||
|
|
||||||
echo '</table>';
|
echo '</table>';
|
||||||
}//end if
|
}
|
||||||
|
|
||||||
// echo("</td></tr></table>");
|
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ else if ($vars['purge']) {
|
|||||||
echo '<div class=infobox>Deleted '.generate_device_link($interface).' - '.generate_port_link($interface).'</div>';
|
echo '<div class=infobox>Deleted '.generate_device_link($interface).' - '.generate_port_link($interface).'</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<table cellpadding=5 cellspacing=0 border=0 width=100%>';
|
echo '<table class="table table-hover table-condensed">';
|
||||||
echo "<tr><td></td><td></td><td></td><td><a href='deleted-ports/purge=all/'><img src='images/16/cross.png' align=absmiddle></img> Purge All</a></td></tr>";
|
echo "<tr><td>Device</td><td>Port</td><td></td><td><a href='deleted-ports/purge=all/'><i class='fa fa-times'></i> Purge All</a></td></tr>";
|
||||||
|
|
||||||
foreach (dbFetchRows("SELECT * FROM `ports` AS P, `devices` as D WHERE P.`deleted` = '1' AND D.device_id = P.device_id",array(),true) as $interface) {
|
foreach (dbFetchRows("SELECT * FROM `ports` AS P, `devices` as D WHERE P.`deleted` = '1' AND D.device_id = P.device_id",array(),true) as $interface) {
|
||||||
$interface = ifLabel($interface, $interface);
|
$interface = ifLabel($interface, $interface);
|
||||||
@@ -29,7 +29,7 @@ foreach (dbFetchRows("SELECT * FROM `ports` AS P, `devices` as D WHERE P.`delete
|
|||||||
echo '<td width=250>'.generate_device_link($interface).'</td>';
|
echo '<td width=250>'.generate_device_link($interface).'</td>';
|
||||||
echo '<td width=250>'.generate_port_link($interface).'</td>';
|
echo '<td width=250>'.generate_port_link($interface).'</td>';
|
||||||
echo '<td></td>';
|
echo '<td></td>';
|
||||||
echo "<td width=100><a href='deleted-ports/purge=".$interface['port_id']."/'><img src='images/16/cross.png' align=absmiddle></img> Purge</a></td>";
|
echo "<td width=100><a href='deleted-ports/purge=".$interface['port_id']."/'><i class='fa fa-times'></i> Purge</a></td>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,11 @@ if (device_permitted($vars['device']) || $check_device == $vars['device']) {
|
|||||||
</a>
|
</a>
|
||||||
</li>';
|
</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) {
|
if ($health) {
|
||||||
echo '<li class="'.$select['health'].'">
|
echo '<li class="'.$select['health'].'">
|
||||||
@@ -367,6 +371,14 @@ if (device_permitted($vars['device']) || $check_device == $vars['device']) {
|
|||||||
</a>
|
</a>
|
||||||
</li>';
|
</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>
|
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>
|
<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
|
enable_graphs($device, $graph_enable);
|
||||||
$graph_enable['poller']['poller_perf'] = 'device_poller_perf';
|
|
||||||
if (can_ping_device($attribs) === true) {
|
|
||||||
$graph_enable['poller']['ping_perf'] = 'device_ping_perf';
|
|
||||||
}
|
|
||||||
|
|
||||||
$sep = '';
|
$sep = '';
|
||||||
foreach ($graph_enable as $section => $nothing) {
|
foreach ($graph_enable as $section => $nothing) {
|
||||||
@@ -56,7 +52,6 @@ print_optionbar_end();
|
|||||||
|
|
||||||
$graph_enable = $graph_enable[$vars['group']];
|
$graph_enable = $graph_enable[$vars['group']];
|
||||||
|
|
||||||
// foreach ($config['graph_types']['device'] as $graph => $entry)
|
|
||||||
foreach ($graph_enable as $graph => $entry) {
|
foreach ($graph_enable as $graph => $entry) {
|
||||||
$graph_array = array();
|
$graph_array = array();
|
||||||
if ($graph_enable[$graph]) {
|
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']));
|
$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']));
|
$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']));
|
$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']));
|
$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']));
|
$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']));
|
$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';
|
$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
|
// 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)) {
|
if (!is_integer($i / 2)) {
|
||||||
$row_colour = $list_colour_a;
|
$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']);
|
$text_descr = rewrite_entity_descr($mempool['mempool_descr']);
|
||||||
|
|
||||||
$mempool_url = 'graphs/id='.$mempool['mempool_id'].'/type=mempool_usage/';
|
if ($graph_type == 'device_mempool') {
|
||||||
$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';
|
$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 = "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();"';
|
$mempool_popup .= "', RIGHT".$config['overlib_defaults'].');" onmouseout="return nd();"';
|
||||||
|
|
||||||
$total = formatStorage($mempool['mempool_total']);
|
$total = formatStorage($mempool['mempool_total']);
|
||||||
$used = formatStorage($mempool['mempool_used']);
|
$used = formatStorage($mempool['mempool_used']);
|
||||||
$free = formatStorage($mempool['mempool_free']);
|
$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);
|
$background = get_percentage_colours($percent);
|
||||||
$right_background = $background['right'];
|
$right_background = $background['right'];
|
||||||
$left_background = $background['left'];
|
$left_background = $background['left'];
|
||||||
|
|
||||||
$graph_array['id'] = $mempool['mempool_id'];
|
$graph_array[$id] = $val;
|
||||||
$graph_array['type'] = $graph_type;
|
$graph_array['type'] = $graph_type;
|
||||||
|
|
||||||
echo "<div class='panel panel-default'>
|
echo "<div class='panel panel-default'>
|
||||||
<div class='panel-heading'>
|
<div class='panel-heading'>";
|
||||||
<h3 class='panel-title'>$text_descr <div class='pull-right'>$used/$total - $perc% used</div></h3>
|
if ($mempool['percentage'] === true) {
|
||||||
</div>";
|
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'>";
|
echo "<div class='panel-body'>";
|
||||||
include 'includes/print-graphrow.inc.php';
|
include 'includes/print-graphrow.inc.php';
|
||||||
echo "</div></div>";
|
echo "</div></div>";
|
||||||
|
|||||||
@@ -3,21 +3,36 @@
|
|||||||
$graph_type = 'processor_usage';
|
$graph_type = 'processor_usage';
|
||||||
|
|
||||||
$i = '1';
|
$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 = "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();"';
|
$proc_popup .= "', RIGHT".$config['overlib_defaults'].');" onmouseout="return nd();"';
|
||||||
$percent = round($proc['processor_usage']);
|
$percent = round($proc['processor_usage']);
|
||||||
|
|
||||||
$graph_array['id'] = $proc['processor_id'];
|
$graph_array[$id] = $val;
|
||||||
$graph_array['type'] = $graph_type;
|
$graph_array['type'] = $graph_type;
|
||||||
|
|
||||||
echo "<div class='panel panel-default'>
|
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'>";
|
echo "<div class='panel-body'>";
|
||||||
include 'includes/print-graphrow.inc.php';
|
include 'includes/print-graphrow.inc.php';
|
||||||
echo "</div></div>";
|
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>
|
</div>
|
||||||
<table class="table table-hover table-condensed table-striped">';
|
<table class="table table-hover table-condensed table-striped">';
|
||||||
|
|
||||||
$graph_array['height'] = '100';
|
if($_SESSION['screen_width']) {
|
||||||
$graph_array['width'] = '485';
|
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['to'] = $config['time']['now'];
|
||||||
$graph_array['device'] = $device['device_id'];
|
$graph_array['device'] = $device['device_id'];
|
||||||
$graph_array['type'] = 'device_bits';
|
$graph_array['type'] = 'device_bits';
|
||||||
@@ -19,6 +30,9 @@ if ($ports['total']) {
|
|||||||
$graph_array['legend'] = 'no';
|
$graph_array['legend'] = 'no';
|
||||||
$graph = generate_lazy_graph_tag($graph_array);
|
$graph = generate_lazy_graph_tag($graph_array);
|
||||||
|
|
||||||
|
#Generate tooltip
|
||||||
|
$graph_array['width'] = 210;
|
||||||
|
$graph_array['height'] = 100;
|
||||||
$link_array = $graph_array;
|
$link_array = $graph_array;
|
||||||
$link_array['page'] = 'graphs';
|
$link_array['page'] = 'graphs';
|
||||||
unset($link_array['height'], $link_array['width']);
|
unset($link_array['height'], $link_array['width']);
|
||||||
|
|||||||
@@ -64,9 +64,20 @@ if (count($processors)) {
|
|||||||
if ($config['cpu_details_overview'] === false)
|
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
|
//Generate average cpu graph
|
||||||
$graph_array['height'] = '100';
|
|
||||||
$graph_array['width'] = '485';
|
|
||||||
$graph_array['device'] = $device['device_id'];
|
$graph_array['device'] = $device['device_id'];
|
||||||
$graph_array['type'] = 'device_processor';
|
$graph_array['type'] = 'device_processor';
|
||||||
$graph = generate_lazy_graph_tag($graph_array);
|
$graph = generate_lazy_graph_tag($graph_array);
|
||||||
@@ -78,7 +89,8 @@ if (count($processors)) {
|
|||||||
$link = generate_url($link_array);
|
$link = generate_url($link_array);
|
||||||
|
|
||||||
//Generate tooltip
|
//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');
|
$overlib_content = generate_overlib_content($graph_array, $device['hostname'].' - CPU usage');
|
||||||
|
|
||||||
echo '<tr>
|
echo '<tr>
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ $menu_options['realtime'] = 'Real time';
|
|||||||
// FIXME CONDITIONAL
|
// FIXME CONDITIONAL
|
||||||
$menu_options['arp'] = 'ARP Table';
|
$menu_options['arp'] = 'ARP Table';
|
||||||
$menu_options['events'] = 'Eventlog';
|
$menu_options['events'] = 'Eventlog';
|
||||||
|
$menu_options['notes'] = 'Notes';
|
||||||
|
|
||||||
if (dbFetchCell("SELECT COUNT(*) FROM `ports_adsl` WHERE `port_id` = '".$port['port_id']."'")) {
|
if (dbFetchCell("SELECT COUNT(*) FROM `ports_adsl` WHERE `port_id` = '".$port['port_id']."'")) {
|
||||||
$menu_options['adsl'] = 'ADSL';
|
$menu_options['adsl'] = 'ADSL';
|
||||||
|
|||||||
@@ -1,48 +1,29 @@
|
|||||||
<?php
|
<?php
|
||||||
|
$no_refresh = true;
|
||||||
|
?>
|
||||||
|
<table id="port-arp" class="table table-condensed table-hover table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th data-column-id="mac_address">MAC address</th>
|
||||||
|
<th data-column-id="ipv4_address">IPv4 address</th>
|
||||||
|
<th data-column-id="remote_device" data-sortable="false">Remote device</th>
|
||||||
|
<th data-column-id="remote_interface" data-sortable="false">Remote interface</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
</table>
|
||||||
|
|
||||||
echo '<table border="0" cellspacing="0" cellpadding="5" width="100%">';
|
<script>
|
||||||
$i = '1';
|
|
||||||
|
|
||||||
foreach (dbFetchRows('SELECT * FROM ipv4_mac WHERE port_id = ?', array($port['port_id'])) as $arp) {
|
var grid = $("#port-arp").bootgrid({
|
||||||
if (!is_integer($i / 2)) {
|
ajax: true,
|
||||||
$bg_colour = $list_colour_a;
|
post: function ()
|
||||||
}
|
{
|
||||||
else {
|
return {
|
||||||
$bg_colour = $list_colour_b;
|
id: "arp-search",
|
||||||
}
|
port_id: "<?php echo $port['port_id']; ?>"
|
||||||
|
};
|
||||||
|
},
|
||||||
|
url: "ajax_table.php"
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
$arp_host = dbFetchRow('SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE A.ipv4_address = ? AND I.port_id = A.port_id AND D.device_id = I.device_id', array($arp['ipv4_address']));
|
|
||||||
|
|
||||||
if ($arp_host) {
|
|
||||||
$arp_name = generate_device_link($arp_host);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
unset($arp_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($arp_host) {
|
|
||||||
$arp_if = generate_port_link($arp_host);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
unset($arp_if);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($arp_host['device_id'] == $device['device_id']) {
|
|
||||||
$arp_name = 'Localhost';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($arp_host['port_id'] == $arp['port_id']) {
|
|
||||||
$arp_if = 'Local Port';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '
|
|
||||||
<tr bgcolor="'.$bg_colour.'">
|
|
||||||
<td width="160">'.formatmac($arp['mac_address']).'</td>
|
|
||||||
<td width="140">'.$arp['ipv4_address'].'</td>
|
|
||||||
<td width="200">'.$arp_name.'</td>
|
|
||||||
<td>'.$arp_if.'</td>
|
|
||||||
</tr>';
|
|
||||||
$i++;
|
|
||||||
}//end foreach
|
|
||||||
|
|
||||||
echo '</table>';
|
|
||||||
|
|||||||
@@ -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>
|
||||||
@@ -1,51 +1,30 @@
|
|||||||
<?php
|
<?php
|
||||||
|
$no_refresh = true;
|
||||||
|
?>
|
||||||
|
<table id="ports-arp" class="table table-condensed table-hover table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th data-column-id="interface">Port</th>
|
||||||
|
<th data-column-id="mac_address">MAC address</th>
|
||||||
|
<th data-column-id="ipv4_address">IPv4 address</th>
|
||||||
|
<th data-column-id="remote_device" data-sortable="false">Remote device</th>
|
||||||
|
<th data-column-id="remote_interface" data-sortable="false">Remote interface</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
</table>
|
||||||
|
|
||||||
echo '<table class="table table-condensed">';
|
<script>
|
||||||
echo '<tr><th>Port</th><th>MAC address</th><th>IPv4 address</th><th>Remote device</th><th>Remote port</th></tr>';
|
|
||||||
|
|
||||||
$i = '1';
|
var grid = $("#ports-arp").bootgrid({
|
||||||
|
ajax: true,
|
||||||
|
post: function ()
|
||||||
|
{
|
||||||
|
return {
|
||||||
|
id: "arp-search",
|
||||||
|
device_id: "<?php echo $device['device_id']; ?>"
|
||||||
|
};
|
||||||
|
},
|
||||||
|
url: "ajax_table.php"
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
foreach (dbFetchRows('SELECT * FROM ipv4_mac AS M, ports AS I WHERE I.port_id = M.port_id AND I.device_id = ?', array($device['device_id'])) as $arp) {
|
|
||||||
if (!is_integer($i / 2)) {
|
|
||||||
$bg_colour = $list_colour_a;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$bg_colour = $list_colour_b;
|
|
||||||
}
|
|
||||||
|
|
||||||
$arp_host = dbFetchRow('SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE A.ipv4_address = ? AND I.port_id = A.port_id AND D.device_id = I.device_id', array($arp['ipv4_address']));
|
|
||||||
|
|
||||||
if ($arp_host) {
|
|
||||||
$arp_name = generate_device_link($arp_host);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
unset($arp_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($arp_host) {
|
|
||||||
$arp_if = generate_port_link($arp_host);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
unset($arp_if);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($arp_host['device_id'] == $device['device_id']) {
|
|
||||||
$arp_name = 'Localhost';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($arp_host['port_id'] == $arp['port_id']) {
|
|
||||||
$arp_if = 'Local Port';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "
|
|
||||||
<tr bgcolor=$bg_colour>
|
|
||||||
<td width=200><b>".generate_port_link(array_merge($arp, $device)).'</b></td>
|
|
||||||
<td width=160>'.formatmac($arp['mac_address']).'</td>
|
|
||||||
<td width=160>'.$arp['ipv4_address']."</td>
|
|
||||||
<td width=280>$arp_name</td>
|
|
||||||
<td>$arp_if</td>
|
|
||||||
</tr>";
|
|
||||||
$i++;
|
|
||||||
}//end foreach
|
|
||||||
|
|
||||||
echo '</table>';
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user