mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
merging
This commit is contained in:
42
addhost.php
42
addhost.php
@@ -19,7 +19,7 @@ require 'config.php';
|
||||
require 'includes/definitions.inc.php';
|
||||
require 'includes/functions.php';
|
||||
|
||||
$options = getopt('g:f::');
|
||||
$options = getopt('g:p:f::');
|
||||
|
||||
if (isset($options['g']) && $options['g'] >= 0) {
|
||||
$cmd = array_shift($argv);
|
||||
@@ -39,6 +39,22 @@ if (isset($options['f']) && $options['f'] == 0) {
|
||||
$force_add = 1;
|
||||
}
|
||||
|
||||
$port_assoc_mode = $config['default_port_association_mode'];
|
||||
$valid_assoc_modes = get_port_assoc_modes ();
|
||||
if (isset ($options['p'])) {
|
||||
$port_assoc_mode = $options['p'];
|
||||
if (! in_array ($port_assoc_mode, $valid_assoc_modes)) {
|
||||
echo "Invalid port association mode '" . $port_assoc_mode . "'\n";
|
||||
echo 'Valid modes: ' . join (', ', $valid_assoc_modes) . "\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
$cmd = array_shift($argv);
|
||||
array_shift($argv);
|
||||
array_shift($argv);
|
||||
array_unshift($argv, $cmd);
|
||||
}
|
||||
|
||||
if (!empty($argv[1])) {
|
||||
$host = strtolower($argv[1]);
|
||||
$community = $argv[2];
|
||||
@@ -82,7 +98,7 @@ if (!empty($argv[1])) {
|
||||
array_push($config['snmp']['v3'], $v3);
|
||||
}
|
||||
|
||||
$device_id = addHost($host, $snmpver, $port, $transport, 0, $poller_group, $force_add);
|
||||
$device_id = addHost($host, $snmpver, $port, $transport, 0, $poller_group, $force_add, $port_assoc_mode);
|
||||
}
|
||||
else if ($seclevel === 'anp' or $seclevel === 'authNoPriv') {
|
||||
$v3['authlevel'] = 'authNoPriv';
|
||||
@@ -108,7 +124,7 @@ if (!empty($argv[1])) {
|
||||
}
|
||||
|
||||
array_push($config['snmp']['v3'], $v3);
|
||||
$device_id = addHost($host, $snmpver, $port, $transport, 0, $poller_group, $force_add);
|
||||
$device_id = addHost($host, $snmpver, $port, $transport, 0, $poller_group, $force_add, $port_assoc_mode);
|
||||
}
|
||||
else if ($seclevel === 'ap' or $seclevel === 'authPriv') {
|
||||
$v3['authlevel'] = 'authPriv';
|
||||
@@ -138,7 +154,7 @@ if (!empty($argv[1])) {
|
||||
}//end while
|
||||
|
||||
array_push($config['snmp']['v3'], $v3);
|
||||
$device_id = addHost($host, $snmpver, $port, $transport, 0, $poller_group, $force_add);
|
||||
$device_id = addHost($host, $snmpver, $port, $transport, 0, $poller_group, $force_add, $port_assoc_mode);
|
||||
}
|
||||
else {
|
||||
// Error or do nothing ?
|
||||
@@ -164,7 +180,7 @@ if (!empty($argv[1])) {
|
||||
$config['snmp']['community'] = array($community);
|
||||
}
|
||||
|
||||
$device_id = addHost($host, $snmpver, $port, $transport, 0, $poller_group, $force_add);
|
||||
$device_id = addHost($host, $snmpver, $port, $transport, 0, $poller_group, $force_add, $port_assoc_mode);
|
||||
}//end if
|
||||
|
||||
if ($snmpver) {
|
||||
@@ -180,7 +196,7 @@ if (!empty($argv[1])) {
|
||||
|
||||
while (!$device_id && count($snmpversions)) {
|
||||
$snmpver = array_shift($snmpversions);
|
||||
$device_id = addHost($host, $snmpver, $port, $transport, 0, $poller_group, $force_add);
|
||||
$device_id = addHost($host, $snmpver, $port, $transport, 0, $poller_group, $force_add, $port_assoc_mode);
|
||||
}
|
||||
|
||||
if ($device_id) {
|
||||
@@ -193,14 +209,18 @@ if (!empty($argv[1])) {
|
||||
print $console_color->convert(
|
||||
"\n".$config['project_name_version'].' Add Host Tool
|
||||
|
||||
Usage (SNMPv1/2c): ./addhost.php [-g <poller group>] [-f] <%Whostname%n> [community] [v1|v2c] [port] ['.implode('|', $config['snmp']['transports']).']
|
||||
Usage (SNMPv3) : Config Defaults : ./addhost.php [-g <poller group>] [-f]<%Whostname%n> any v3 [user] [port] ['.implode('|', $config['snmp']['transports']).']
|
||||
No Auth, No Priv : ./addhost.php [-g <poller group>] [-f]<%Whostname%n> nanp v3 [user] [port] ['.implode('|', $config['snmp']['transports']).']
|
||||
Auth, No Priv : ./addhost.php [-g <poller group>] [-f]<%Whostname%n> anp v3 <user> <password> [md5|sha] [port] ['.implode('|', $config['snmp']['transports']).']
|
||||
Auth, Priv : ./addhost.php [-g <poller group>] [-f]<%Whostname%n> ap v3 <user> <password> <enckey> [md5|sha] [aes|dsa] [port] ['.implode('|', $config['snmp']['transports']).']
|
||||
Usage (SNMPv1/2c): ./addhost.php [-g <poller group>] [-f] [-p <port assoc mode>] <%Whostname%n> [community] [v1|v2c] [port] ['.implode('|', $config['snmp']['transports']).']
|
||||
Usage (SNMPv3) : Config Defaults : ./addhost.php [-g <poller group>] [-f] [-p <port assoc mode>] <%Whostname%n> any v3 [user] [port] ['.implode('|', $config['snmp']['transports']).']
|
||||
No Auth, No Priv : ./addhost.php [-g <poller group>] [-f] [-p <port assoc mode>] <%Whostname%n> nanp v3 [user] [port] ['.implode('|', $config['snmp']['transports']).']
|
||||
Auth, No Priv : ./addhost.php [-g <poller group>] [-f] [-p <port assoc mode>] <%Whostname%n> anp v3 <user> <password> [md5|sha] [port] ['.implode('|', $config['snmp']['transports']).']
|
||||
Auth, Priv : ./addhost.php [-g <poller group>] [-f] [-p <port assoc mode>] <%Whostname%n> ap v3 <user> <password> <enckey> [md5|sha] [aes|dsa] [port] ['.implode('|', $config['snmp']['transports']).']
|
||||
|
||||
-g <poller group> allows you to add a device to be pinned to a specific poller when using distributed polling. X can be any number associated with a poller group
|
||||
-f forces the device to be added by skipping the icmp and snmp check against the host.
|
||||
-p <port assoc mode> allow you to set a port association mode for this device. By default ports are associated by \'ifIndex\'.
|
||||
For Linux/Unix based devices \'ifName\' or \'ifDescr\' might be useful for a stable iface mapping.
|
||||
The default for this installation is \'' . $config['default_port_association_mode'] . '\'
|
||||
Valid port assoc modes are: ' . join (', ', $valid_assoc_modes) . '
|
||||
|
||||
%rRemember to run discovery for the host afterwards.%n
|
||||
'
|
||||
|
@@ -49,3 +49,6 @@ $config['poller-wrapper']['alerter'] = FALSE;
|
||||
|
||||
# Uncomment to submit callback stats via proxy
|
||||
#$config['callback_proxy'] = "hostname:port";
|
||||
|
||||
# Set default port association mode for new devices (default: ifIndex)
|
||||
#$config['default_port_association_mode'] = 'ifIndex';
|
||||
|
@@ -112,7 +112,7 @@ Route: /api/v0/devices/:hostname
|
||||
|
||||
Input:
|
||||
|
||||
-
|
||||
-
|
||||
|
||||
Example:
|
||||
```curl
|
||||
@@ -146,7 +146,7 @@ Route: /api/v0/devices/:hostname
|
||||
|
||||
Input:
|
||||
|
||||
-
|
||||
-
|
||||
|
||||
Example:
|
||||
```curl
|
||||
@@ -179,7 +179,7 @@ Route: /api/v0/devices/:hostname/graphs
|
||||
|
||||
Input:
|
||||
|
||||
-
|
||||
-
|
||||
|
||||
Example:
|
||||
```curl
|
||||
@@ -511,8 +511,8 @@ Route: /api/v0/oxidized
|
||||
|
||||
Input (JSON):
|
||||
|
||||
-
|
||||
|
||||
-
|
||||
|
||||
Examples:
|
||||
```curl
|
||||
curl -H 'X-Auth-Token: YOURAPITOKENHERE' https://librenms.org/api/v0/oxidized
|
||||
@@ -548,7 +548,7 @@ Input (JSON):
|
||||
|
||||
Examples:
|
||||
```curl
|
||||
curl -X PATCH -d '{"field": "notes", "data": "This server should be kept online"}' -H 'X-Auth-Token: YOURAPITOKENHERE' https://librenms.org/api/v0/devices/localhost
|
||||
curl -X PATCH -d '{"field": "notes", "data": "This server should be kept online"}' -H 'X-Auth-Token: YOURAPITOKENHERE' https://librenms.org/api/v0/devices/localhost
|
||||
```
|
||||
|
||||
Output:
|
||||
@@ -751,7 +751,7 @@ Route: /api/v0/devices/:hostname/vlans
|
||||
|
||||
Input:
|
||||
|
||||
-
|
||||
-
|
||||
|
||||
Example:
|
||||
```curl
|
||||
@@ -787,7 +787,7 @@ Route: /api/v0/alerts/:id
|
||||
|
||||
Input:
|
||||
|
||||
-
|
||||
-
|
||||
|
||||
Example:
|
||||
```curl
|
||||
@@ -824,7 +824,7 @@ Route: /api/v0/alerts/:id
|
||||
|
||||
Input:
|
||||
|
||||
-
|
||||
-
|
||||
|
||||
Example:
|
||||
```curl
|
||||
@@ -913,7 +913,7 @@ Route: /api/v0/rules/:id
|
||||
|
||||
Input:
|
||||
|
||||
-
|
||||
-
|
||||
|
||||
Example:
|
||||
```curl
|
||||
@@ -950,7 +950,7 @@ Route: /api/v0/rules/:id
|
||||
|
||||
Input:
|
||||
|
||||
-
|
||||
-
|
||||
|
||||
Example:
|
||||
```curl
|
||||
@@ -972,11 +972,11 @@ List the alert rules.
|
||||
|
||||
Route: /api/v0/rules
|
||||
|
||||
-
|
||||
-
|
||||
|
||||
Input:
|
||||
|
||||
-
|
||||
-
|
||||
|
||||
Example:
|
||||
```curl
|
||||
@@ -1008,7 +1008,7 @@ Add a new alert rule.
|
||||
|
||||
Route: /api/v0/rules
|
||||
|
||||
-
|
||||
-
|
||||
|
||||
Input (JSON):
|
||||
|
||||
@@ -1017,7 +1017,7 @@ Input (JSON):
|
||||
- severity: The severity level the alert will be raised against, Ok, Warning, Critical.
|
||||
- disabled: Whether the rule will be disabled or not, 0 = enabled, 1 = disabled
|
||||
- count: This is how many polling runs before an alert will trigger and the frequency.
|
||||
- delay: Delay is when to start alerting and how frequently. The value is stored in seconds but you can specify minutes, hours or days by doing 5 m, 5 h, 5 d for each one.
|
||||
- delay: Delay is when to start alerting and how frequently. The value is stored in seconds but you can specify minutes, hours or days by doing 5 m, 5 h, 5 d for each one.
|
||||
- mute: If mute is enabled then an alert will never be sent but will show up in the Web UI (true or false).
|
||||
- invert: This would invert the rules check.
|
||||
- name: This is the name of the rule and is mandatory.
|
||||
@@ -1043,7 +1043,7 @@ Edit an existing alert rule
|
||||
|
||||
Route: /api/v0/rules
|
||||
|
||||
-
|
||||
-
|
||||
|
||||
Input (JSON):
|
||||
|
||||
@@ -1053,7 +1053,7 @@ Input (JSON):
|
||||
- severity: The severity level the alert will be raised against, Ok, Warning, Critical.
|
||||
- disabled: Whether the rule will be disabled or not, 0 = enabled, 1 = disabled
|
||||
- count: This is how many polling runs before an alert will trigger and the frequency.
|
||||
- delay: Delay is when to start alerting and how frequently. The value is stored in seconds but you can specify minutes, hours or days by doing 5 m, 5 h, 5 d for each one.
|
||||
- delay: Delay is when to start alerting and how frequently. The value is stored in seconds but you can specify minutes, hours or days by doing 5 m, 5 h, 5 d for each one.
|
||||
- mute: If mute is enabled then an alert will never be sent but will show up in the Web UI (true or false).
|
||||
- invert: This would invert the rules check.
|
||||
- name: This is the name of the rule and is mandatory.
|
||||
|
@@ -14,7 +14,7 @@ This is the main file which all links within LibreNMS are parsed through. It loa
|
||||
### html/css
|
||||
All used css files are located here. Apart from legacy files, anything in here is now a symlink.
|
||||
### html/forms
|
||||
This folder contains all of the files that are dynamically included from an ajax call to html/ajax_form.php.
|
||||
This folder contains all of the files that are dynamically included from an ajax call to html/ajax_form.php.
|
||||
### html/includes
|
||||
This is where the majority of the website core files are located. These tend to be files that contain functions or often used code segments that can be included where needed rather than duplicating code.
|
||||
### html/includes/api_functions.inc.php
|
||||
@@ -41,7 +41,7 @@ All the discovery and polling code. The format is usually quite similar between
|
||||
This is for all of the libraries used by LibreNMS. If you are including a 3rd party module, you would add the files in here either via git subtree if it's hosted on GitHub or just by copying the folder. Please ensure you maintain any copyright notices. You will then need to either reference the files in this folder directly from where you need them or alternatively as is the case with css and js libraries then symlink the needed files.
|
||||
|
||||
### logs/
|
||||
Usually contains your web servers logs but can also contrain poller logs and other items,
|
||||
Usually contains your web servers logs but can also contain poller logs and other items,
|
||||
|
||||
### mibs/
|
||||
Here is where all of the mibs are located, traditionally this has meant having all mibs in one directory but for certain vendors this has changed and these are now located in sub folders.
|
||||
|
@@ -1,6 +1,6 @@
|
||||
# Adding new config options to WebUI
|
||||
|
||||
Adding support for users to update a new config option via the WebUI is now a lot easier for general options. This
|
||||
Adding support for users to update a new config option via the WebUI is now a lot easier for general options. This
|
||||
document shows you how to add a new config option and even section to the WebUI.
|
||||
|
||||
#### Update DB
|
||||
@@ -15,7 +15,7 @@ This will determine the default config option for `$config['alert']['tolerance_w
|
||||
|
||||
#### Update WebUI
|
||||
|
||||
If the sub-section you want to add the new config option already exists then update the relevant file within
|
||||
If the sub-section you want to add the new config option already exists then update the relevant file within
|
||||
`html/pages/settings/` otherwise you will need to create the new sub-section page. Here's an example of this:
|
||||
|
||||
[Commit example](https://github.com/librenms/librenms/commit/c5998f9ee27acdac0c0f7d3092fc830c51ff684c)
|
||||
|
@@ -1,26 +1,26 @@
|
||||
# Style guidelines
|
||||
|
||||
This document is here to help style standards for contributions towards LibreNMS. These aren't strict rules but it is in
|
||||
This document is here to help style standards for contributions towards LibreNMS. These aren't strict rules but it is in
|
||||
the users interest that a consistent well thought out Web UI is available.
|
||||
|
||||
### Responsiveness
|
||||
|
||||
The Web UI is designed to be mobile friendly and for the most part is and works well. It's worth spending sometime to
|
||||
read through the [Boostrap website](http://getbootstrap.com/css/#grid) to learn more about how to keep things responsive.
|
||||
The Web UI is designed to be mobile friendly and for the most part is and works well. It's worth spending sometime to
|
||||
read through the [Bootstrap website](http://getbootstrap.com/css/#grid) to learn more about how to keep things responsive.
|
||||
|
||||
### Navigation bar
|
||||
|
||||
- Always pick the best location for new links to go, think about where users would expect the link to be located and name
|
||||
- Always pick the best location for new links to go, think about where users would expect the link to be located and name
|
||||
it so that it's obvious what it does.
|
||||
|
||||
- Ensure sub sections within the Navigation are separated correctly using `<li role="presentation" class="divider"></li>`.
|
||||
|
||||
- Only use [Font Awesome icons](http://fontawesome.io/icons/) within the Navigation. It speeds up page load times quite
|
||||
- Only use [Font Awesome icons](http://fontawesome.io/icons/) within the Navigation. It speeds up page load times quite
|
||||
considerably.
|
||||
|
||||
### Buttons
|
||||
|
||||
Try to keep buttons colored to reflect the action they will take. Buttons are set using Bootstrap classes. The size of
|
||||
Try to keep buttons colored to reflect the action they will take. Buttons are set using Bootstrap classes. The size of
|
||||
the buttons will depend on the area of the website being used but btn-sm is probably the most common.
|
||||
|
||||
- Delete / Remove buttons: btn btn-danger
|
||||
@@ -31,20 +31,20 @@ the buttons will depend on the area of the website being used but btn-sm is prob
|
||||
|
||||
### Tables
|
||||
|
||||
Unless the table being used will only ever display a handful of items - yeah that's what we all said, then you need to
|
||||
write your table using [JQuery Bootgrid](http://www.jquery-bootgrid.com/). This shouldn't take that much more code to
|
||||
do this but provides so much flexibility along with stopping the need for retrieving all the data from SQL in the first
|
||||
Unless the table being used will only ever display a handful of items - yeah that's what we all said, then you need to
|
||||
write your table using [JQuery Bootgrid](http://www.jquery-bootgrid.com/). This shouldn't take that much more code to
|
||||
do this but provides so much flexibility along with stopping the need for retrieving all the data from SQL in the first
|
||||
place.
|
||||
|
||||
As an example pull request, see [PR 706](https://github.com/librenms/librenms/pull/706/files) to get an idea of what
|
||||
As an example pull request, see [PR 706](https://github.com/librenms/librenms/pull/706/files) to get an idea of what
|
||||
it's like to convert an existing pure html table to Bootgrid.
|
||||
|
||||
### Datetime format
|
||||
|
||||
When displaying datetimes, please ensure you use the format YYYY-MM-DD mm:hh:ss where possible, you shouldn't change the
|
||||
When displaying datetimes, please ensure you use the format YYYY-MM-DD mm:hh:ss where possible, you shouldn't change the
|
||||
order of this as it will be confusing to users. Cutting it short to just display YYYY-MM-DD mm:hh is fine :).
|
||||
|
||||
To keep things consistent we have the following variables which should be used rather than to format dates yourself.
|
||||
To keep things consistent we have the following variables which should be used rather than to format dates yourself.
|
||||
This has the added benefit that users can customise the format:
|
||||
|
||||
```php
|
||||
|
@@ -8,7 +8,7 @@ Some assumptions:
|
||||
- LibreNMS is to be installed in /opt/librenms
|
||||
- You have git installed.
|
||||
- You have a [GitHub Account](https://github.com/).
|
||||
- You are using ssh to connect to GitHub (If not, replace git@github.com:/yourusername/librenms.git with
|
||||
- You are using ssh to connect to GitHub (If not, replace git@github.com:/yourusername/librenms.git with
|
||||
https://github.com/yourusername/librenms.git.
|
||||
|
||||
** Replace yourusername with your GitHub username. **
|
||||
@@ -16,7 +16,7 @@ https://github.com/yourusername/librenms.git.
|
||||
#### Fork LibreNMS repo
|
||||
You do this directly within [GitHub](https://github.com/librenms/librenms/fork), click the 'Fork' button near the top right.
|
||||
|
||||
If you are associated with multiple organisations within GitHub then you might need to select which account you want to
|
||||
If you are associated with multiple organisations within GitHub then you might need to select which account you want to
|
||||
push the fork to.
|
||||
|
||||
#### Prepare your git environment
|
||||
@@ -29,7 +29,7 @@ git config --global user.email johndoe@example.com
|
||||
```
|
||||
|
||||
#### Clone the repo
|
||||
Ok so now that you have forked the repo, you now need to clone it to your local install where you can then make the
|
||||
Ok so now that you have forked the repo, you now need to clone it to your local install where you can then make the
|
||||
changes you need and submit them back.
|
||||
|
||||
```bash
|
||||
@@ -50,10 +50,10 @@ Now you have two configured remotes:
|
||||
- upstream: This is the main LibreNMS repository and you can only pull changes.
|
||||
|
||||
#### Workflow guide
|
||||
As you become more familiar you may find a better workflow that fits your needs, until then this should be a safe
|
||||
As you become more familiar you may find a better workflow that fits your needs, until then this should be a safe
|
||||
workflow for you to follow.
|
||||
|
||||
Before you start work on a new branch / feature. Make sure you are upto date.
|
||||
Before you start work on a new branch / feature. Make sure you are up to date.
|
||||
```bash
|
||||
cd /opt/librenms
|
||||
git checkout master
|
||||
@@ -61,19 +61,19 @@ git pull upstream master
|
||||
git push origin master
|
||||
```
|
||||
|
||||
Now, create a new branch to do you work on. It's important that you do this as you are then able to work on more than
|
||||
one feature at a time and submit them as pull requests individually. If you did all your work in the master branch then
|
||||
Now, create a new branch to do you work on. It's important that you do this as you are then able to work on more than
|
||||
one feature at a time and submit them as pull requests individually. If you did all your work in the master branch then
|
||||
it gets a bit messy!
|
||||
|
||||
Ideally you want to create your new branch name based of the issue number. So firstly create an issue on
|
||||
[GitHub](https://github.com/librenms/librenms/issues) so that others are aware of the work going on. If the issue number
|
||||
Ideally you want to create your new branch name based of the issue number. So firstly create an issue on
|
||||
[GitHub](https://github.com/librenms/librenms/issues) so that others are aware of the work going on. If the issue number
|
||||
you created is 123 then use issue-123 as the branch name.
|
||||
|
||||
```bash
|
||||
git checkout -b issue-123
|
||||
```
|
||||
|
||||
Now, code away. Make the changes you need, test, change and test again :) When you are ready to submit the updates as a
|
||||
Now, code away. Make the changes you need, test, change and test again :) When you are ready to submit the updates as a
|
||||
pull request then commit away.
|
||||
|
||||
```bash
|
||||
@@ -89,20 +89,20 @@ git push origin issue-123
|
||||
|
||||
If after do this you get some merge conflicts then you need to resolve these before carrying on.
|
||||
|
||||
Now you will be ready to submit a pull request from within GitHub. To do this, go to your GitHub page for the LibreNMS
|
||||
repo. Now select the branch you have just been working on (issue-123) from the drop down to the left and then click
|
||||
Now you will be ready to submit a pull request from within GitHub. To do this, go to your GitHub page for the LibreNMS
|
||||
repo. Now select the branch you have just been working on (issue-123) from the drop down to the left and then click
|
||||
'Pull Request'. Fill in the details to describe the work you have done and click 'Create pull request'.
|
||||
|
||||
Thanks for your first pull request :) Now, that might have been a simple update, if things get a bit more complicated
|
||||
then you will need to break down your pull request into separate commits (still a single pull request). This is usually
|
||||
Thanks for your first pull request :) Now, that might have been a simple update, if things get a bit more complicated
|
||||
then you will need to break down your pull request into separate commits (still a single pull request). This is usually
|
||||
done when:
|
||||
|
||||
- You want to add / update MIBS. Do this in a separate commit including the link to where you got them from.
|
||||
- You are adding say 3 related features in one go, try and break them down into 3 separate commits.
|
||||
- Icons for new OS support need to be added as a separate commit including a link to where you got the logo from.
|
||||
|
||||
Ok, that should get you started on the contributing path. If you have any other questions then stop by our IRC Channel
|
||||
on Freenode ##librenms.
|
||||
Ok, that should get you started on the contributing path. If you have any other questions then stop by our IRC Channel
|
||||
on Freenode ##librenms.
|
||||
|
||||
[1]: http://gitready.com
|
||||
[2]: http://git-scm.com/book
|
@@ -65,7 +65,7 @@ options {
|
||||
```
|
||||
Restart your bind9/named after changing the configuration.
|
||||
|
||||
Verify that everything works by executing `rndc stats && cat /etc/bind/named.stats`.
|
||||
Verify that everything works by executing `rndc stats && cat /etc/bind/named.stats`.
|
||||
In case you get a `Permission Denied` error, make sure you chown'ed correctly.
|
||||
|
||||
Note: if you change the path you will need to change the path in `scripts/agent-local/bind`.
|
||||
@@ -75,26 +75,26 @@ Note: if you change the path you will need to change the path in `scripts/agent-
|
||||
__Installation__:
|
||||
|
||||
1. Get tinystats sources from http://www.morettoni.net/tinystats.en.html
|
||||
2. Compile like as advised.
|
||||
_Note_: In case you get `Makefile:9: *** missing separator. Stop.`, compile manually using:
|
||||
* With IPv6: `gcc -Wall -O2 -fstack-protector -DWITH_IPV6 -o tinystats tinystats.c`
|
||||
* Without IPv6: `gcc -Wall -O2 -fstack-protector -o tinystats tinystats.c`
|
||||
2. Compile like as advised.
|
||||
_Note_: In case you get `Makefile:9: *** missing separator. Stop.`, compile manually using:
|
||||
* With IPv6: `gcc -Wall -O2 -fstack-protector -DWITH_IPV6 -o tinystats tinystats.c`
|
||||
* Without IPv6: `gcc -Wall -O2 -fstack-protector -o tinystats tinystats.c`
|
||||
3. Install into preferred path, like `/usr/bin/`.
|
||||
|
||||
__Configuration__:
|
||||
|
||||
_Note_: In this part we assume that you use DJB's [Daemontools](http://cr.yp.to/daemontools.html) to start/stop tinydns.
|
||||
_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 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:
|
||||
```
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
exec setuidgid dnslog tinystats ./main/tinystats/ multilog t n3 s250000 ./main/
|
||||
```
|
||||
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`
|
||||
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 doesn't rehook the logging and I'm forced to restart it entirely.
|
||||
|
||||
### MySQL
|
||||
|
@@ -38,7 +38,7 @@ Table of Content:
|
||||
|
||||
# <a name="about">About</a>
|
||||
|
||||
LibreNMS includes a highly customizable alerting system.
|
||||
LibreNMS includes a highly customizable alerting system.
|
||||
The system requires a set of user-defined rules to evaluate the situation of each device, port, service or any other entity.
|
||||
|
||||
> You can configure all options for alerting and transports via the WebUI, config options in this document are crossed out but left for reference.
|
||||
@@ -47,15 +47,15 @@ This document only covers the usage of it. See the [DEVELOPMENT.md](https://gith
|
||||
|
||||
# <a name="rules">Rules</a>
|
||||
|
||||
Rules are defined using a logical language.
|
||||
The GUI provides a simple way of creating basic as well as complex Rules in a self-describing manner.
|
||||
Rules are defined using a logical language.
|
||||
The GUI provides a simple way of creating basic as well as complex Rules in a self-describing manner.
|
||||
More complex rules can be written manually.
|
||||
|
||||
## <a name="rules-syntax">Syntax</a>
|
||||
|
||||
Rules must consist of at least 3 elements: An __Entity__, a __Condition__ and a __Value__.
|
||||
Rules can contain braces and __Glues__.
|
||||
__Entities__ are provided as `%`-Noted pair of Table and Field. For Example: `%ports.ifOperStatus`.
|
||||
Rules must consist of at least 3 elements: An __Entity__, a __Condition__ and a __Value__.
|
||||
Rules can contain braces and __Glues__.
|
||||
__Entities__ are provided as `%`-Noted pair of Table and Field. For Example: `%ports.ifOperStatus`.
|
||||
__Conditions__ can be any of:
|
||||
|
||||
- Equals `=`
|
||||
@@ -67,10 +67,10 @@ __Conditions__ can be any of:
|
||||
- Smaller `<`
|
||||
- Smaller or Equal `<=`
|
||||
|
||||
__Values__ can be Entities or any single-quoted data.
|
||||
__Values__ can be Entities or any single-quoted data.
|
||||
__Glues__ can be either `&&` for `AND` or `||` for `OR`.
|
||||
|
||||
__Note__: The difference between `Equals` and `Matches` (and its negation) is that `Equals` does a strict comparison and `Matches` allows the usage of RegExp.
|
||||
__Note__: The difference between `Equals` and `Matches` (and its negation) is that `Equals` does a strict comparison and `Matches` allows the usage of RegExp.
|
||||
Arithmetics are allowed as well.
|
||||
|
||||
## <a name="rules-examples">Examples</a>
|
||||
@@ -90,17 +90,17 @@ Alert when:
|
||||
|
||||
# <a name="templates">Templates</a>
|
||||
|
||||
Templates can be assigned to a single or a group of rules.
|
||||
They can contain any kind of text.
|
||||
The template-parser understands `if` and `foreach` controls and replaces certain placeholders with information gathered about the alert.
|
||||
Templates can be assigned to a single or a group of rules.
|
||||
They can contain any kind of text.
|
||||
The template-parser understands `if` and `foreach` controls and replaces certain placeholders with information gathered about the alert.
|
||||
|
||||
## <a name="templates-syntax">Syntax</a>
|
||||
|
||||
Controls:
|
||||
|
||||
- if-else (Else can be omitted):
|
||||
- if-else (Else can be omitted):
|
||||
`{if %placeholder == 'value'}Some Text{else}Other Text{/if}`
|
||||
- foreach-loop:
|
||||
- foreach-loop:
|
||||
`{foreach %placeholder}Key: %key<br/>Value: %value{/foreach}`
|
||||
|
||||
Placeholders:
|
||||
@@ -123,7 +123,7 @@ Templates can be matched against several rules.
|
||||
|
||||
## <a name="templates-examples">Examples</a>
|
||||
|
||||
Default Template:
|
||||
Default Template:
|
||||
```text
|
||||
%title\r\n
|
||||
Severity: %severity\r\n
|
||||
@@ -138,13 +138,13 @@ Alert sent to: {foreach %contacts}%value <%key> {/foreach}
|
||||
|
||||
# <a name="transports">Transports</a>
|
||||
|
||||
Transports are located within `$config['install_dir']/includes/alerts/transports.*.php` and defined as well as configured via ~~`$config['alert']['transports']['Example'] = 'Some Options'`~~.
|
||||
Transports are located within `$config['install_dir']/includes/alerts/transports.*.php` and defined as well as configured via ~~`$config['alert']['transports']['Example'] = 'Some Options'`~~.
|
||||
|
||||
Contacts will be gathered automatically and passed to the configured transports.
|
||||
Contacts will be gathered automatically and passed to the configured transports.
|
||||
By default the Contacts will be only gathered when the alert triggers and will ignore future changes in contacts for the incident. If you want contacts to be re-gathered before each dispatch, please set ~~`$config['alert']['fixed-contacts'] = false;`~~ in your config.php.
|
||||
|
||||
The contacts will always include the `SysContact` defined in the Device's SNMP configuration and also every LibreNMS-User that has at least `read`-permissions on the entity that is to be alerted.
|
||||
At the moment LibreNMS only supports Port or Device permissions.
|
||||
The contacts will always include the `SysContact` defined in the Device's SNMP configuration and also every LibreNMS-User that has at least `read`-permissions on the entity that is to be alerted.
|
||||
At the moment LibreNMS only supports Port or Device permissions.
|
||||
You can exclude the `SysContact` by setting:
|
||||
~~
|
||||
```php
|
||||
@@ -170,7 +170,7 @@ $config['alert']['transports']['mail'] = true;
|
||||
```
|
||||
~~
|
||||
|
||||
The E-Mail transports uses the same email-configuration like the rest of LibreNMS.
|
||||
The E-Mail transports uses the same email-configuration like the rest of LibreNMS.
|
||||
As a small reminder, here is it's configuration directives including defaults:
|
||||
~~
|
||||
```php
|
||||
@@ -195,13 +195,13 @@ $config['alert']['default_mail'] = ''; //Default ema
|
||||
|
||||
> You can configure these options within the WebUI now, please avoid setting these options within config.php
|
||||
|
||||
API transports definitions are a bit more complex than the E-Mail configuration.
|
||||
The basis for configuration is ~~`$config['alert']['transports']['api'][METHOD]`~~ where `METHOD` can be `get`,`post` or `put`.
|
||||
This basis has to contain an array with URLs of each API to call.
|
||||
The URL can have the same placeholders as defined in the [Template-Syntax](#templates-syntax).
|
||||
If the `METHOD` is `get`, all placeholders will be URL-Encoded.
|
||||
The API transport uses cURL to call the APIs, therefore you might need to install `php5-curl` or similar in order to make it work.
|
||||
__Note__: it is highly recommended to define own [Templates](#templates) when you want to use the API transport. The default template might exceed URL-length for GET requests and therefore cause all sorts of errors.
|
||||
API transports definitions are a bit more complex than the E-Mail configuration.
|
||||
The basis for configuration is ~~`$config['alert']['transports']['api'][METHOD]`~~ where `METHOD` can be `get`,`post` or `put`.
|
||||
This basis has to contain an array with URLs of each API to call.
|
||||
The URL can have the same placeholders as defined in the [Template-Syntax](#templates-syntax).
|
||||
If the `METHOD` is `get`, all placeholders will be URL-Encoded.
|
||||
The API transport uses cURL to call the APIs, therefore you might need to install `php5-curl` or similar in order to make it work.
|
||||
__Note__: it is highly recommended to define own [Templates](#templates) when you want to use the API transport. The default template might exceed URL-length for GET requests and therefore cause all sorts of errors.
|
||||
|
||||
Example:
|
||||
~~
|
||||
@@ -214,7 +214,7 @@ $config['alert']['transports']['api']['get'][] = "https://api.thirdparti.es/issu
|
||||
|
||||
> You can configure these options within the WebUI now, please avoid setting these options within config.php
|
||||
|
||||
The nagios transport will feed a FIFO at the defined location with the same format that nagios would.
|
||||
The nagios transport will feed a FIFO at the defined location with the same format that nagios would.
|
||||
This allows you to use other Alerting-Systems to work with LibreNMS, for example [Flapjack](http://flapjack.io).
|
||||
~~
|
||||
```php
|
||||
@@ -226,7 +226,7 @@ $config['alert']['transports']['nagios'] = "/path/to/my.fifo"; //Flapjack expect
|
||||
|
||||
> You can configure these options within the WebUI now, please avoid setting these options within config.php
|
||||
|
||||
The IRC transports only works together with the LibreNMS IRC-Bot.
|
||||
The IRC transports only works together with the LibreNMS IRC-Bot.
|
||||
Configuration of the LibreNMS IRC-Bot is described [here](https://github.com/librenms/librenms/blob/master/doc/Extensions/IRC-Bot.md).
|
||||
~~
|
||||
```php
|
||||
@@ -349,7 +349,7 @@ $config['alert']['transports']['pushover'][] = array(
|
||||
|
||||
## <a name="transports-boxcar">Boxcar</a>
|
||||
|
||||
Enabling Boxcar support is super easy.
|
||||
Enabling Boxcar support is super easy.
|
||||
Copy your access token from the Boxcar app or from the Boxcar.io website and setup the transport in your config.php like:
|
||||
|
||||
~~
|
||||
@@ -384,7 +384,7 @@ $config['alert']['transports']['pushbullet'] = 'MYFANCYACCESSTOKEN';
|
||||
|
||||
## <a name="transports-clickatell">Clickatell</a>
|
||||
|
||||
Clickatell provides a REST-API requiring an Authorization-Token and at least one Cellphone number.
|
||||
Clickatell provides a REST-API requiring an Authorization-Token and at least one Cellphone number.
|
||||
Please consult Clickatell's documentation regarding number formatting.
|
||||
Here an example using 3 numbers, any amount of numbers is supported:
|
||||
|
||||
@@ -399,8 +399,8 @@ $config['alert']['transports']['clickatell']['to'][] = '+1234567892';
|
||||
|
||||
## <a name="transports-playsms">PlaySMS</a>
|
||||
|
||||
PlaySMS is an OpenSource SMS-Gateway that can be used via their HTTP-API using a Username and WebService-Token.
|
||||
Please consult PlaySMS's documentation regarding number formating.
|
||||
PlaySMS is an open source SMS-Gateway that can be used via their HTTP-API using a Username and WebService-Token.
|
||||
Please consult PlaySMS's documentation regarding number formatting.
|
||||
Here an example using 3 numbers, any amount of numbers is supported:
|
||||
|
||||
~~
|
||||
@@ -529,7 +529,7 @@ And in the Rule:
|
||||
This Example-macro is a Boolean-macro, it applies a form of filter to the set of results defined by the rule.
|
||||
All macros that are not unary should return Boolean.
|
||||
|
||||
You can only apply _Equal_ or _Not-Equal_ Operations on Bollean-macros where `True` is represented by `"1"` and `False` by `"0"`.
|
||||
You can only apply _Equal_ or _Not-Equal_ Operations on Boolean-macros where `True` is represented by `"1"` and `False` by `"0"`.
|
||||
|
||||
|
||||
## <a name="macros-device">Device</a> (Boolean)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
# Authentication modules
|
||||
|
||||
LibreNMS supports multiple authentication modules along with [Two Factor Auth](http://docs.librenms.org/Extensions/Two-Factor-Auth/).
|
||||
LibreNMS supports multiple authentication modules along with [Two Factor Auth](http://docs.librenms.org/Extensions/Two-Factor-Auth/).
|
||||
Here we will provide configuration details for these modules.
|
||||
|
||||
#### Available authentication modules
|
||||
@@ -50,9 +50,9 @@ $config['db_name'] = "DBNAME";
|
||||
|
||||
Config option: `http-auth`
|
||||
|
||||
LibreNMS will expect the user to have authenticated via your webservice already. At this stage it will need to assign a
|
||||
LibreNMS will expect the user to have authenticated via your webservice already. At this stage it will need to assign a
|
||||
userlevel for that user which is done in one of two ways:
|
||||
|
||||
|
||||
- A user exists in MySQL still where the usernames match up.
|
||||
|
||||
- A global guest user (which still needs to be added into MySQL:
|
||||
@@ -67,7 +67,7 @@ Config option: `ldap`
|
||||
|
||||
This one is a little more complicated :)
|
||||
|
||||
First of all, install ___php-ldap___ forCentOS/RHEL or ___php5-ldap___ for Ubuntu/Debian.
|
||||
First of all, install ___php-ldap___ for CentOS/RHEL or ___php5-ldap___ for Ubuntu/Debian.
|
||||
|
||||
```php
|
||||
$config['auth_ldap_version'] = 3; # v2 or v3
|
||||
@@ -132,11 +132,12 @@ If you have issues with secure LDAP try setting `$config['auth_ad_check_certific
|
||||
|
||||
##### Require actual membership of the configured groups
|
||||
|
||||
If you set ```$config['auth_ad_require_groupmembership']``` to 1, the authenticated user has to be a member of the specific group. Otherwise all users can authenticate, but are limited to user level 0 and only have access to shared dashboards.
|
||||
If you set ```$config['auth_ad_require_groupmembership']``` to 1, the authenticated user has to be a member of the specific group. Otherwise all users can authenticate, but are limited to user level 0 and only have access to shared dashboards.
|
||||
|
||||
> 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['active_directory]['users_purge'] otherwise old users won't be removed.
|
||||
|
||||
|
||||
##### Sample configuration
|
||||
|
||||
```
|
||||
@@ -144,12 +145,14 @@ $config['auth_ad_url'] = "ldaps://your-domain.controll.er";
|
||||
$config['auth_ad_check_certificates'] = 1; // or 0
|
||||
$config['auth_ad_domain'] = "your-domain.com";
|
||||
$config['auth_ad_base_dn'] = "dc=your-domain,dc=com";
|
||||
$config['auth_ad_groups']['admin']['level'] = 10;
|
||||
$config['auth_ad_groups']['pfy']['level'] = 7;
|
||||
$config['auth_ad_groups']['<ad-admingroup>']['level'] = 10;
|
||||
$config['auth_ad_groups']['<ad-usergroup>']['level'] = 7;
|
||||
$config['auth_ad_require_groupmembership'] = 0;
|
||||
$config['active_directory']['users_purge'] = 14;//Purge users who haven't logged in for 14 days.
|
||||
```
|
||||
|
||||
Replace `<ad-admingroup>` with your Active Directory admin-user group and `<ad-usergroup>` with your standard user group.
|
||||
|
||||
#### 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.
|
||||
@@ -163,5 +166,5 @@ $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.
|
||||
$config['radius']['default_level'] = 1;//Set the default user level when automatically creating a user.
|
||||
```
|
||||
|
@@ -118,7 +118,7 @@ $ARRAY = $COMPONENT->getComponents($DEVICE_ID,$OPTIONS);
|
||||
[status] => 0
|
||||
[ignore] => 1
|
||||
[disabled] => 1
|
||||
[error] =>
|
||||
[error] =>
|
||||
),
|
||||
[Y2] => Array
|
||||
(
|
||||
@@ -129,7 +129,7 @@ $ARRAY = $COMPONENT->getComponents($DEVICE_ID,$OPTIONS);
|
||||
[status] => 0
|
||||
[ignore] => 1
|
||||
[disabled] => 0
|
||||
[error] =>
|
||||
[error] =>
|
||||
),
|
||||
)
|
||||
)
|
||||
@@ -155,7 +155,7 @@ Where:
|
||||
|
||||
|
||||
There are 2 filtering shortcuts:
|
||||
|
||||
|
||||
$DEVICE_ID is a synonym for:
|
||||
|
||||
```php
|
||||
@@ -201,11 +201,11 @@ This will return a new, empty array with a component ID and Type set, all other
|
||||
[1] => Array
|
||||
(
|
||||
[type] => TESTING
|
||||
[label] =>
|
||||
[label] =>
|
||||
[status] => 1
|
||||
[ignore] => 0
|
||||
[disabled] => 0
|
||||
[error] =>
|
||||
[error] =>
|
||||
)
|
||||
)
|
||||
|
||||
|
@@ -4,10 +4,10 @@ LibreNMS supports grouping your devices together in much the same way as you can
|
||||
|
||||
### Pattern
|
||||
|
||||
Patterns work in the same was as Entities within the alerting system, the format of the pattern is based on the MySQL structure your data is in such
|
||||
Patterns work in the same was as Entities within the alerting system, the format of the pattern is based on the MySQL structure your data is in such
|
||||
as __tablename.columnname__. If you are ensure of what the entity is you want then have a browse around inside MySQL using `show tables` and `desc <tablename>`.
|
||||
|
||||
As a working example and a common question, let's assume you want to group devices by hostname. If you hostname format is dcX.[devicetype].example.com. You would use the pattern
|
||||
As a working example and a common question, let's assume you want to group devices by hostname. If you hostname format is dcX.[devicetype].example.com. You would use the pattern
|
||||
devices.hostname. Select the condition which in this case would Like and then enter `dc1\..*\.example.com`. This would then match dc1.sw01.example.com, dc1.rtr01.example.com but not
|
||||
dc2.sw01.example.com.
|
||||
|
||||
@@ -23,8 +23,8 @@ Please see our [Alerting docs](http://docs.librenms.org/Extensions/Alerting/#syn
|
||||
|
||||
### Connection
|
||||
|
||||
If you only want to group based on one pattern then select And. If however you want to build a group based on multiple patterns then you can build a SQL like
|
||||
If you only want to group based on one pattern then select And. If however you want to build a group based on multiple patterns then you can build a SQL like
|
||||
query using And / Or. As an example, we want to base our group on the devices hostname AND it's type. Use the pattern as before, devices.hostname, select the condition which in this case would Like and then enter dc1.@.example.com then click And. Now enter devices.type in the pattern, select Equals and enter firewall. This would then match dc1.fw01.example.com but not dc1.sw01.example.com as that is a network type.
|
||||
|
||||
You can now select this group from the Devices -> All Devices link in the navigation at the top. You can also use the group to map alert rules to by creating an alert mapping
|
||||
You can now select this group from the Devices -> All Devices link in the navigation at the top. You can also use the group to map alert rules to by creating an alert mapping
|
||||
Overview -> Alerts -> Rule Mapping.
|
||||
|
@@ -3,19 +3,19 @@ LibreNMS has the ability to distribute polling of devices to other machines.
|
||||
|
||||
These machines can be in a different physical location and therefore minimize network latencies for colocations.
|
||||
|
||||
Devices can also be groupped together into a `poller_group` to pin these devices to a single or a group of designated pollers.
|
||||
Devices can also be grouped together into a `poller_group` to pin these devices to a single or a group of designated pollers.
|
||||
|
||||
~~All pollers need to share their RRD-folder, for example via NFS or a combination of NFS and rrdcached.~~
|
||||
|
||||
> This is no longer a strict requirement with the use of rrdtool 1.5 and above. If you are NOT running 1.5 then you will still
|
||||
> This is no longer a strict requirement with the use of rrdtool 1.5 and above. If you are NOT running 1.5 then you will still
|
||||
need to share the RRD-folder.
|
||||
|
||||
It is also required that all pollers can access the central memcached to communicate with eachother.
|
||||
It is also required that all pollers can access the central memcached to communicate with each other.
|
||||
|
||||
In order to enable distributed polling, set `$config['distributed_poller'] = true` and your memcached details into `$config['distributed_poller_memcached_host']` and `$config['distributed_poller_memcached_port']`.
|
||||
By default, all hosts are shared and have the `poller_group = 0`. To pin a device to a poller, set it to a value greater than 0 and set the same value in the poller's config with `$config['distributed_poller_group']`.
|
||||
In order to enable distributed polling, set `$config['distributed_poller'] = true` and your memcached details into `$config['distributed_poller_memcached_host']` and `$config['distributed_poller_memcached_port']`.
|
||||
By default, all hosts are shared and have the `poller_group = 0`. To pin a device to a poller, set it to a value greater than 0 and set the same value in the poller's config with `$config['distributed_poller_group']`.
|
||||
Usually the poller's name is equal to the machine's hostname, if you want to change it set `$config['distributed_poller_name']`.
|
||||
One can also specify a comma seperated string of poller groups in $config['distributed_poller_group']. The poller will then poll devices from any of the groups listed. If new devices get added from the poller they will be assigned to the first poller group in the list unless the group is specified when adding the device.
|
||||
One can also specify a comma separated string of poller groups in $config['distributed_poller_group']. The poller will then poll devices from any of the groups listed. If new devices get added from the poller they will be assigned to the first poller group in the list unless the group is specified when adding the device.
|
||||
|
||||
## Configuration
|
||||
```php
|
||||
@@ -28,8 +28,7 @@ $config['distributed_poller_memcached_port'] = '11211';
|
||||
```
|
||||
|
||||
## Example Setup
|
||||
Below is an example setup based on a real deployment which at the time of writing covers over 2,500 devices and 50,000 ports. The setup is running within an Openstack environment with some commodity ha
|
||||
rdware for remote pollers. Here's a diagram of how you can scale LibreNMS out:
|
||||
Below is an example setup based on a real deployment which at the time of writing covers over 2,500 devices and 50,000 ports. The setup is running within an OpenStack environment with some commodity hardware for remote pollers. Here's a diagram of how you can scale LibreNMS out:
|
||||
|
||||

|
||||
|
||||
@@ -53,9 +52,9 @@ The pollers, web and API layers should all be able to access the database server
|
||||
####RRD Storage
|
||||
Central storage should be provided so all RRD files can be read from and written to in one location. As suggested above, it's recommended that RRD Cached is configured and used.
|
||||
|
||||
For this example, we are running RRDCached to allow all pollers and web/api servers to read/write to the rrd iles ~~with the rrd directory also exported by NFS for simple access and maintenance.~~
|
||||
For this example, we are running RRDCached to allow all pollers and web/api servers to read/write to the rrd files ~~with the rrd directory also exported by NFS for simple access and maintenance.~~
|
||||
|
||||
Sharing rrd files via something like NFS is no longer required if you run rrdtool 1.5 or greater. If you don't - please share your rrd folder as before. If you run rrdtool
|
||||
Sharing rrd files via something like NFS is no longer required if you run rrdtool 1.5 or greater. If you don't - please share your rrd folder as before. If you run rrdtool
|
||||
1.5 or greater then add this config to your pollers:
|
||||
|
||||
```php
|
||||
@@ -81,7 +80,7 @@ Another benefit to this is that you can provide N+x pollers, i.e if you know tha
|
||||
It is extremely advisable to either run a central recursive dns server such as pdns-recursor and have all of your pollers use this or install a recursive dns server on each poller - the volume of DNS requests on large installs can be significant.
|
||||
|
||||
####Discovery
|
||||
It's not necessary to run discovery services on all pollers. In fact, you should only run one discovery process per poller group. Designate a single poller to run discovery (or a seperate server if required).
|
||||
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 separate server if required).
|
||||
|
||||
####Config sample
|
||||
Memcache:
|
||||
|
@@ -31,7 +31,7 @@ $config['leaflet']['default_zoom'] = 8;
|
||||
|
||||
|
||||
### Jquery-Mapael config
|
||||
Further custom options are available to load different maps of the world, set default coordinates of where the map will zoom and the zoom level by default. An example of
|
||||
Further custom options are available to load different maps of the world, set default coordinates of where the map will zoom and the zoom level by default. An example of
|
||||
this is:
|
||||
|
||||
```php
|
||||
|
@@ -1,10 +1,10 @@
|
||||
# Graylog integration
|
||||
|
||||
We have simple integration for Graylog, you will be able to view any logs from within LibreNMS that have been parsed by the syslog input from within
|
||||
Graylog itself. This includes logs from devices which aren't in LibreNMS still, you can also see logs for a specific device under the logs section
|
||||
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 specific device under the logs section
|
||||
for the device.
|
||||
|
||||
Graylog itself isn't included within LibreNMS, you will need to install this separately either on the same infrastructure as LibreNMS or as a totally
|
||||
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
|
||||
standalone appliance.
|
||||
|
||||
Config is simple, here's an example:
|
||||
|
@@ -41,7 +41,7 @@ Function( (Type) $Variable [= Default] [,...] ) | Returns | Description
|
||||
|
||||
### <a name="glob.attr">Attributes</a>
|
||||
Attribute | Type | Description
|
||||
--- | --- | ---
|
||||
--- | --- | ---
|
||||
`$params` | `String` | Contains all arguments that are passed to the `.command`.
|
||||
`$this->chan` | `Array` | Channels that are configured.
|
||||
`$this->commands` | `Array` | Contains accessible `commands`.
|
||||
@@ -51,7 +51,7 @@ Attribute | Type | Description
|
||||
`$this->external` | `Array` | Contains loaded extra `commands`.
|
||||
`$this->nick` | `String` | Bot's `nick` on the IRC.
|
||||
`$this->pass` | `String` | IRC-Server's passphrase.
|
||||
`$this->port` | `Int` | IRC-Sever's port-number.
|
||||
`$this->port` | `Int` | IRC-Server's port-number.
|
||||
`$this->server` | `String` | IRC-Server's hostname.
|
||||
`$this->ssl` | `Boolean` | SSL-Flag.
|
||||
`$this->tick` | `Int` | Interval to check buffers in microseconds.
|
||||
|
@@ -48,7 +48,7 @@ Command | Description
|
||||
`.port <hostname> <ifname>` | Prints Port-related information from `ifname` on given `hostname`.
|
||||
`.quit` | Disconnect from IRC and exit.
|
||||
`.reload` | Reload configuration.
|
||||
`.status <type>` | Prints status informations for given `type`. Type can be `devices`, `services`, `ports`. Shorthands are: `dev`,`srv`,`prt`
|
||||
`.status <type>` | Prints status information for given `type`. Type can be `devices`, `services`, `ports`. Shorthands are: `dev`,`srv`,`prt`
|
||||
`.version` | Prints `$this->config['project_name_version']`.
|
||||
|
||||
( __/!\__ All commands are case-_insensitive_ but their arguments are case-_sensitive_)
|
||||
|
@@ -1,15 +1,15 @@
|
||||
# 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
|
||||
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
|
||||
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
|
||||
@@ -31,5 +31,5 @@ $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
|
||||
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.
|
||||
|
@@ -11,7 +11,7 @@ $config['memcached']['port'] = 11211;
|
||||
```
|
||||
|
||||
By default values are kept for 4 Minutes inside the memcached, you can adjust this retention time by modifying the `$config['memcached']['ttl']` value to any desired amount of seconds.
|
||||
It's strongly discouraged to set this above `300` (5 Minutes) to avoid interferences with the polling, discovery and alerting processes.
|
||||
It's strongly discouraged to set this above `300` (5 Minutes) to avoid interference with the polling, discovery and alerting processes.
|
||||
|
||||
If you use the Distributed Poller, you can point this to the same memcached instance. However a local memcached will perform better in any case.
|
||||
|
||||
|
@@ -13,10 +13,10 @@ $config['network_map_items'] = array('mac','xdp');
|
||||
|
||||
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.
|
||||
|
||||
One can also specicify the parameters to be used for drawing and updating the network map.
|
||||
One can also specify the parameters to be used for drawing and updating the network map.
|
||||
Please see http://visjs.org/docs/network/ for details on the configuration parameters.
|
||||
```php
|
||||
$config['network_map_vis_options'] = '{
|
||||
|
@@ -4,7 +4,7 @@ You can integrate LibreNMS with [Oxidized](https://github.com/ytti/oxidized-web)
|
||||
|
||||
### Config viewing
|
||||
|
||||
This is a straight forward use of Oxidized, it relies on you having a working Oxidized setup which is already taking config snapshots for your devices.
|
||||
This is a straight forward use of Oxidized, it relies on you having a working Oxidized setup which is already taking config snapshots for your devices.
|
||||
When you have that, you only need the following config to enable the display of device configs within the device page itself:
|
||||
|
||||
```php
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
This documentation will hopefully give you a basis for how to write a plugin for LibreNMS.
|
||||
|
||||
A test plugin is available on GitHib: https://github.com/laf/Test
|
||||
A test plugin is available on GitHub: https://github.com/laf/Test
|
||||
|
||||
Plugins need to be installed into html/plugins
|
||||
|
||||
@@ -45,7 +45,7 @@ PluginName.inc.php - This file is the main included file when browsing to the pl
|
||||
|
||||
### System Hooks ###
|
||||
|
||||
System hooks are called as functions within your plugin class, so for example to create a menu entry within the PLugin dropdown you would do:
|
||||
System hooks are called as functions within your plugin class, so for example to create a menu entry within the Plugin dropdown you would do:
|
||||
|
||||
```
|
||||
public function menu() {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
# Configuring interface descriptions for parsing.
|
||||
|
||||
LibreNMS includes the ability to parse your interface descriptions for set information to diplay and segment in the WebUI.
|
||||
LibreNMS includes the ability to parse your interface descriptions for set information to display and segment in the WebUI.
|
||||
|
||||
The following information is used from interface descriptions:
|
||||
|
||||
@@ -9,7 +9,7 @@ The following information is used from interface descriptions:
|
||||
- Notes
|
||||
- Speed
|
||||
|
||||
When setting the description, you use the type followed directly with : and then the information on that port. Some examples based on
|
||||
When setting the description, you use the type followed directly with : and then the information on that port. Some examples based on
|
||||
configuring a Cisco 2960 interface
|
||||
|
||||
#### Customer port
|
||||
@@ -57,7 +57,7 @@ description Cust: Customer A (This customer is gold)
|
||||
[]
|
||||
|
||||
i.e:
|
||||
description Cust: Customer A [100Mbs]
|
||||
description Cust: Customer A [100Mbps]
|
||||
|
||||
You can use any of these additional options like:
|
||||
|
||||
@@ -66,10 +66,10 @@ description Cust: Customer A {ID4321} [1Gbps]
|
||||
|
||||
This information is then held within the ports table within the database, as an example:
|
||||
|
||||
description Core: Nas bond [1Gbps]
|
||||
description Core: NAS bond [1Gbps]
|
||||
```sh
|
||||
port_descr_type: core
|
||||
port_descr_descr: Nas bond
|
||||
port_descr_descr: NAS bond
|
||||
port_descr_circuit: NULL
|
||||
port_descr_speed: 1Gbps
|
||||
port_descr_notes: NULL
|
||||
|
@@ -1,5 +1,5 @@
|
||||
# Proxmox graphing
|
||||
It is possible to create graphs of the Proxmox **VMs** that run on your monitored machines. Currently, only trafficgraphs are created. One for each interface on each VM. Possibly, IO grahps will be added later on.
|
||||
It is possible to create graphs of the Proxmox **VMs** that run on your monitored machines. Currently, only traffic graphs are created. One for each interface on each VM. Possibly, IO graphs will be added later on.
|
||||
|
||||
The ultimate goal is to be able to create traffic bills for VMs, no matter on which physical machine that VM runs.
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
This document will explain how to setup RRDCached for LibreNMS.
|
||||
|
||||
> If you are using rrdtool / rrdcached version 1.5 or above then this now supports creating rrd files over rrdcached. To
|
||||
> If you are using rrdtool / rrdcached version 1.5 or above then this now supports creating rrd files over rrdcached. To
|
||||
enable this set the following config:
|
||||
|
||||
```php
|
||||
@@ -21,7 +21,7 @@ vi /etc/yum.repos.d/rpmforge.repo
|
||||
|
||||
```ssh
|
||||
yum update rrdtool
|
||||
vi /etc/yum.repos.d/rpmforge.repo
|
||||
vi /etc/yum.repos.d/rpmforge.repo
|
||||
```
|
||||
- Disable the [rpmforge] and [rpmforge-extras] repos again
|
||||
|
||||
@@ -45,7 +45,7 @@ service rrdcached start
|
||||
$config['rrdcached'] = "unix:/var/run/rrdcached/rrdcached.sock";
|
||||
```
|
||||
### RRDCached installation CentOS 7
|
||||
This example is based on a fresh LibreNMS install, on a minimimal CentOS 7.x installation.
|
||||
This example is based on a fresh LibreNMS install, on a minimal CentOS 7.x installation.
|
||||
We'll use the epel-release and setup a RRDCached as a service.
|
||||
It is recommended that you monitor your LibreNMS server with LibreNMS so you can view the disk I/O usage delta.
|
||||
See [Installation (RHEL CentOS)][1] for localhost monitoring.
|
||||
|
@@ -1,6 +1,6 @@
|
||||
# RRDTune?
|
||||
|
||||
When we create rrd files for ports, we currently do so with a max value of 12500000000 (100G). Because of this if a device sends us bad data back then it can appear as though
|
||||
When we create rrd files for ports, we currently do so with a max value of 12500000000 (100G). Because of this if a device sends us bad data back then it can appear as though
|
||||
a 100M port is doing 40G+ which is impossible. To counter this you can enable the rrdtool tune option which will fix the max value to the interfaces physical speed (minimum of 10M).
|
||||
|
||||
To enable this you can do so in three ways!
|
||||
@@ -9,7 +9,7 @@ To enable this you can do so in three ways!
|
||||
- For the actual device, Edit Device -> Misc
|
||||
- For each port, Edit Device -> Port Settings
|
||||
|
||||
Now when a port interface speed changes (this can happen because of a physical change or just because the device has mis-reported) the max value is set. If you don't want to wait until
|
||||
Now when a port interface speed changes (this can happen because of a physical change or just because the device has misreported) the max value is set. If you don't want to wait until
|
||||
a port speed changes then you can run the included script:
|
||||
|
||||
script/tune_port.php -h <hostname> -p <ifName>
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
Services within LibreNMS provides the ability to use Nagios plugins to perform additional monitoring outside of SNMP.
|
||||
|
||||
These services are tied into an existing device so you need at least one device that supports SNMP to be able to add it
|
||||
These services are tied into an existing device so you need at least one device that supports SNMP to be able to add it
|
||||
to LibreNMS - localhost is a good one.
|
||||
|
||||
## Setup
|
||||
@@ -29,7 +29,7 @@ Finally, you now need to add check-services.php to the current cron file (/etc/c
|
||||
|
||||
Now you can add services via the main Services link in the navbar, or via the Services link within the device page.
|
||||
|
||||
> **Please note that at present the service checks will only return the status and the response from the check
|
||||
> **Please note that at present the service checks will only return the status and the response from the check
|
||||
no graphs will be generated. **
|
||||
|
||||
## Supported checks
|
||||
|
@@ -1,6 +1,6 @@
|
||||
# Smokeping integration
|
||||
|
||||
We currently have two ways to use Smokeping with LibreNMS, the first is using the included script generator to generate the config for Smokeping. The
|
||||
We currently have two ways to use Smokeping with LibreNMS, the first is using the included script generator to generate the config for Smokeping. The
|
||||
second is to utilise an existing Smokeping setup.
|
||||
|
||||
### Included Smokeping script
|
||||
@@ -11,7 +11,7 @@ To use this, please add something similar to your smokeping config file:
|
||||
@include /opt/smokeping/etc/librenms.conf
|
||||
```
|
||||
|
||||
Then you need to generate the config file (maybe even add a cron to schedule this in and reload smokeping). We've assumed a few locations for smokeping, the config file you want
|
||||
Then you need to generate the config file (maybe even add a cron to schedule this in and reload smokeping). We've assumed a few locations for smokeping, the config file you want
|
||||
to call it and where LibreNMS is:
|
||||
|
||||
```bash
|
||||
|
@@ -1,6 +1,6 @@
|
||||
To run LibreNMS under a subdirectory on your Apache server, the directives for the LibreNMS directory are placed in the base server configuration, or in a virtual host
|
||||
container of your choosing. If using a virtual host, place the directives in the file where the virtual host is configured. If using the base server on RHEL distributions
|
||||
(CentOS, Scientific Linux, etc.) the directives can be placed in `/etc/httpd/conf.d/librenms.conf`. For Debian distributions (Ubuntu, etc.) place the directives in
|
||||
To run LibreNMS under a subdirectory on your Apache server, the directives for the LibreNMS directory are placed in the base server configuration, or in a virtual host
|
||||
container of your choosing. If using a virtual host, place the directives in the file where the virtual host is configured. If using the base server on RHEL distributions
|
||||
(CentOS, Scientific Linux, etc.) the directives can be placed in `/etc/httpd/conf.d/librenms.conf`. For Debian distributions (Ubuntu, etc.) place the directives in
|
||||
`/etc/apache2/sites-available/default`.
|
||||
|
||||
```apache
|
||||
@@ -14,7 +14,7 @@ Alias /librenms /opt/librenms/html
|
||||
</Directory>
|
||||
```
|
||||
|
||||
The `RewriteBase` directive in `html/.htaccess` must be rewritten to reference the subdirectory name. Assuming LibreNMS is running at http://example.com/librenms/,
|
||||
The `RewriteBase` directive in `html/.htaccess` must be rewritten to reference the subdirectory name. Assuming LibreNMS is running at http://example.com/librenms/,
|
||||
you will need to change `RewriteBase /` to `RewriteBase /librenms`.
|
||||
|
||||
Finally, ensure `$config["base_url"]` -- if configured -- is correct as well.
|
||||
|
@@ -33,7 +33,7 @@ options {
|
||||
stats_freq(0);
|
||||
bad_hostname("^gconfd$");
|
||||
};
|
||||
|
||||
|
||||
########################
|
||||
# Sources
|
||||
########################
|
||||
@@ -41,19 +41,19 @@ source s_sys {
|
||||
system();
|
||||
internal();
|
||||
};
|
||||
|
||||
|
||||
source s_net {
|
||||
tcp(port(514) flags(syslog-protocol));
|
||||
udp(port(514) flags(syslog-protocol));
|
||||
};
|
||||
|
||||
|
||||
########################
|
||||
# Destinations
|
||||
########################
|
||||
destination d_librenms {
|
||||
program("/opt/librenms/syslog.php" template ("$HOST||$FACILITY||$PRIORITY||$LEVEL||$TAG||$YEAR-$MONTH-$DAY $HOUR:$MIN:$SEC||$MSG||$PROGRAM\n") template-escape(yes));
|
||||
};
|
||||
|
||||
|
||||
########################
|
||||
# Log paths
|
||||
########################
|
||||
@@ -62,7 +62,7 @@ log {
|
||||
source(s_sys);
|
||||
destination(d_librenms);
|
||||
};
|
||||
|
||||
|
||||
###
|
||||
# Include all config files in /etc/syslog-ng/conf.d/
|
||||
###
|
||||
|
@@ -9,33 +9,33 @@ Table of Content:
|
||||
|
||||
# <a name="about">About</a>
|
||||
|
||||
Over the last couple of years, the primary attack vector for internet accounts has been static passwords.
|
||||
Therefore static passwords are no longer sufficient to protect unauthorized access to accounts.
|
||||
Two Factor Authentication adds a variable part in authentication procedures.
|
||||
Over the last couple of years, the primary attack vector for internet accounts has been static passwords.
|
||||
Therefore static passwords are no longer sufficient to protect unauthorized access to accounts.
|
||||
Two Factor Authentication adds a variable part in authentication procedures.
|
||||
A user is now required to supply a changing 6-digit passcode in addition to it's password to obtain access to the account.
|
||||
|
||||
LibreNMS has a RFC4226 conform implementation of both Time and Counter based One-Time-Passwords.
|
||||
LibreNMS has a RFC4226 conform implementation of both Time and Counter based One-Time-Passwords.
|
||||
It also allows the administrator to configure a throttle time to enforce after 3 failures exceeded. Unlike RFC4226 suggestions, this throttle time will not stack on the amount of failures.
|
||||
|
||||
# <a name="types">Types</a>
|
||||
|
||||
In general, these two types do not differ in algorithmic terms.
|
||||
The types only differ in the variable being used to derive the passcodes from.
|
||||
In general, these two types do not differ in algorithmic terms.
|
||||
The types only differ in the variable being used to derive the passcodes from.
|
||||
The underlying HMAC-SHA1 remains the same for both types, security advantages or disadvantages of each are discussed further down.
|
||||
|
||||
## <a name="totp">Timebased One-Time-Password (TOTP)</a>
|
||||
|
||||
Like the name suggests, this type uses the current Time or a subset of it to generate the passcodes.
|
||||
These passcodes solely rely on the secrecy of their Secretkey in order to provide passcodes.
|
||||
An attacker only needs to guess that Secretkey and the other variable part is any given time, presumably the time upon login.
|
||||
RFC4226 suggests a resynchronization attempt in case the passcode mismatches, providing the attacker a range of upto +/- 3 Minutes to create passcodes.
|
||||
Like the name suggests, this type uses the current Time or a subset of it to generate the passcodes.
|
||||
These passcodes solely rely on the secrecy of their Secretkey in order to provide passcodes.
|
||||
An attacker only needs to guess that Secretkey and the other variable part is any given time, presumably the time upon login.
|
||||
RFC4226 suggests a resynchronization attempt in case the passcode mismatches, providing the attacker a range of up to +/- 3 Minutes to create passcodes.
|
||||
|
||||
|
||||
## <a name="hotp">Counterbased One-Time-Password (TOTP)</a>
|
||||
|
||||
This type uses an internal counter that needs to be in sync with the server's counter to successfully authenticate the passcodes.
|
||||
The main advantage over timebased OTP is the attacker doesn't only need to know the Secretkey but also the server's Counter in order to create valid passcodes.
|
||||
RFC4226 suggests a resynchronization attempt in case the passcode mismatches, providing the attacker a range of upto +4 increments from the actual counter to create passcodes.
|
||||
This type uses an internal counter that needs to be in sync with the server's counter to successfully authenticate the passcodes.
|
||||
The main advantage over timebased OTP is the attacker doesn't only need to know the Secretkey but also the server's Counter in order to create valid passcodes.
|
||||
RFC4226 suggests a resynchronization attempt in case the passcode mismatches, providing the attacker a range of up to +4 increments from the actual counter to create passcodes.
|
||||
|
||||
# <a name="config">Configuration</a>
|
||||
|
||||
|
@@ -11,7 +11,7 @@ Varnish is caching software that sits logically between an HTTP client and an HT
|
||||
|
||||
### CentOS 7 Varnish Installation ###
|
||||
|
||||
In this example we will assume your Apache 2.4.X HTTP server is working and
|
||||
In this example we will assume your Apache 2.4.X HTTP server is working and
|
||||
configured to process HTTP requests on port 80. If not, please see
|
||||
[Using HTTPd Apache2](http://librenms.readthedocs.org/Installation/Installation-(RHEL-CentOS)/#using-httpd-apache2)
|
||||
|
||||
@@ -30,7 +30,7 @@ By default Varnish listens for HTTP requests on port 6081.
|
||||
- Temporarily add a firewalld rule for testing Varnish.
|
||||
|
||||
```bash
|
||||
firewall-cmd --zone=public --add-port=6081/tcp
|
||||
firewall-cmd --zone=public --add-port=6081/tcp
|
||||
```
|
||||
|
||||
#### Test Varnish ####
|
||||
@@ -127,16 +127,16 @@ Edit librenms.conf and modify the Apache Virtual Host listening port.
|
||||
|
||||
- Modify:`<VirtualHost *:80>` to: `<VirtualHost *:8080>`
|
||||
```bash
|
||||
vim /etc/httpd/conf.d/librenms.conf
|
||||
vim /etc/httpd/conf.d/librenms.conf
|
||||
```
|
||||
|
||||
Varnish can not share a port with Apache. Change the Apache listening port to 8080.
|
||||
|
||||
- Modify:`Listen 80` to:`Listen 8080`
|
||||
```bash
|
||||
```bash
|
||||
vim /etc/httpd/conf/httpd.conf
|
||||
```
|
||||
|
||||
|
||||
- Create the librenms.vcl
|
||||
```bash
|
||||
cd /etc/varnish
|
||||
@@ -205,11 +205,11 @@ sub vcl_backend_response {
|
||||
# 'sub vcl_backend_response' is the same function as 'sub vcl_fetch' in Varnish 3, however,
|
||||
# the syntax is slightly different
|
||||
# This function happens after we read the response headers from the backend (Apache).
|
||||
# First function 'if (bereq.url ~ "\' removes cookies from the Apache HTTP responses
|
||||
# First function 'if (bereq.url ~ "\' removes cookies from the Apache HTTP responses
|
||||
# that match the file extensions that are between the quotes, and cache the files for 24 hours.
|
||||
# This assumes you update LibreNMS once a day, otherwise restart Varnish to clear cache.
|
||||
# Second function 'if (bereq.url ~ "^/' removes the Pragma no-cache statements and sets the age
|
||||
# of how long the client brower will cache the matching urls.
|
||||
# of how long the client browser will cache the matching urls.
|
||||
# LibreNMS graphs are updated every 300 seconds, 'max-age=300' is set to match this behavior.
|
||||
# We could cache these URLs in Varnish but it would add to the complexity of the config.
|
||||
|
||||
|
@@ -43,7 +43,7 @@
|
||||
- Added support for Samsung SCX printers (PR2760)
|
||||
- Added additional support for HP MSM (PR2766, PR2768)
|
||||
- Added additional support for Cisco ASA and RouterOS (PR2784)
|
||||
- Added support for Lenovo EMC Nas (PR2795)
|
||||
- Added support for Lenovo EMC NAS (PR2795)
|
||||
- Added support for Infoblox (PR2801)
|
||||
- API:
|
||||
- Added support for Oxidized groups (PR2745)
|
||||
@@ -157,7 +157,7 @@
|
||||
- Added RIPE NCC API support for lookups (PR2455, PR2474)
|
||||
- Improved ports page for device with large number of neighbours (PR2460)
|
||||
- Merged all CPU graphs into one on overview page (PR2470)
|
||||
- Added support for sortting by traffic on device port page (PR2508)
|
||||
- Added support for sorting by traffic on device port page (PR2508)
|
||||
- Added support for dynamic graph sizes based on browser size (PR2510)
|
||||
- Made device location clickable in device header (PR2515)
|
||||
- Visual improvements to bills page (PR2519)
|
||||
@@ -174,7 +174,7 @@
|
||||
- Alerting:
|
||||
- Added ability to globally disable sending alerts (PR2385)
|
||||
- Added support for Clickatell, PlaySMS and VictorOps (PR24104, PR2443)
|
||||
- Documnetation:
|
||||
- Documentation:
|
||||
- Improved CentOS install docs (PR2462)
|
||||
- Improved Proxmox setup docs (PR2483)
|
||||
- Misc:
|
||||
@@ -227,7 +227,7 @@
|
||||
- Update Font Awesome (PR2167)
|
||||
- Allow user to influence when devices are grouped on world map (PR2170)
|
||||
- Centralised the date selector for graphs for re-use (PR2183)
|
||||
- Dont show dashboard settings if `/bare=yes/` (PR2364)
|
||||
- Don't show dashboard settings if `/bare=yes/` (PR2364)
|
||||
- API:
|
||||
- Added unmute alert function to API (PR2082)
|
||||
- Discovery / Polling:
|
||||
@@ -259,7 +259,7 @@
|
||||
- Fixed IRC bot reconnect if socket dies (PR2061)
|
||||
- Updated default crons (PR2177)
|
||||
- Reverts:
|
||||
- "Removed what appears to be unecessary STACK text" (PR2128)
|
||||
- "Removed what appears to be unnecessary STACK text" (PR2128)
|
||||
|
||||
### September 2015
|
||||
|
||||
@@ -270,7 +270,7 @@
|
||||
- Issue alert-trigger as test object (PR1850)
|
||||
- WebUI:
|
||||
- Fix permissions for World-map widget (PR1866)
|
||||
- Clean up Gloabl / World Map name mixup (PR1874)
|
||||
- Clean up Global / World Map name mixup (PR1874)
|
||||
- Removed required flag for community when adding new hosts (PR1961)
|
||||
- Stop duplicate devices showing in map (PR1963)
|
||||
- Fix adduser bug storing users real name (PR1990)
|
||||
@@ -381,7 +381,7 @@
|
||||
- Misc UI fixes (Titles, Headers, ...) (PR1797,PR1798,PR1800,PR1801,PR1802,PR1803,PR1804,PR1805)
|
||||
- Move packages to overview dropdown (PR1810)
|
||||
- API Updates:
|
||||
- Improvided billing support in API (PR1599)
|
||||
- Improved billing support in API (PR1599)
|
||||
- Extended support for list devices to support mac/ipv4 and ipv6 filtering (PR1744)
|
||||
- Added detection for:
|
||||
- Perle Media convertors (PR1607)
|
||||
@@ -586,7 +586,7 @@
|
||||
- Fix SQL query for restricted users in /devices/ (PR990)
|
||||
- Fix for post-formatting time-macros (PR1006)
|
||||
- Honour disabling alerts for hosts (PR1051)
|
||||
- Make OSPF and ARP discovery independant xDP (PR1053)
|
||||
- Make OSPF and ARP discovery independent xDP (PR1053)
|
||||
- Fixed ospf_nbrs lookup to use device_id (PR1088)
|
||||
- Removed trailing / from some urls (PR1089 / PR1100)
|
||||
- Fix to device search for Device type and location (PR1101)
|
||||
@@ -623,7 +623,7 @@
|
||||
- Enable alerting on tables with relative / indirect glues (PR932)
|
||||
- Added bills support in rulesuggest and alert system (PR934)
|
||||
- Added detection for Sentry Smart CDU (PR938)
|
||||
- Added basic detection for Netgear devices (PR942)
|
||||
- Added basic detection for Netgear devices (PR942)
|
||||
- addhost.php now uses distributed_poller_group config if set (PR944)
|
||||
- Added port rewrite function (PR946)
|
||||
- Added basic detection for Ubiquiti Edgeswitch (PR947)
|
||||
@@ -674,7 +674,7 @@
|
||||
- Show ifName in ARP search if devices are set to use this (PR1133)
|
||||
- Added FibreHome CPU and Mempool support (PR1134)
|
||||
- Added config options for region and resolution on globe map (PR1137)
|
||||
- Addded RRDCached example docs (PR1148)
|
||||
- Added RRDCached example docs (PR1148)
|
||||
- Updated support for additional NetBotz models (PR1152)
|
||||
- Updated /iftype/ page to include speed/circuit/notes (PR1155)
|
||||
- Added detection for PowerConnect 55XX devices (PR1165)
|
||||
@@ -687,7 +687,7 @@
|
||||
- Added missing CPU id for Cisco SB (PR744)
|
||||
- Changed Processors table name to lower case in processors discovery (PR751)
|
||||
- Fixed alerts path issue (PR756, PR760)
|
||||
- Supress further port alerts when interface goes down (PR745)
|
||||
- Suppress further port alerts when interface goes down (PR745)
|
||||
- Fixed login so redirects via 303 when POST data sent (PR775)
|
||||
- Fixed missing link to errored or ignored ports (PR787)
|
||||
- Updated alert log query for performance improvements (PR783)
|
||||
@@ -901,7 +901,7 @@
|
||||
- Added names to all API routes (PR314)
|
||||
- Added route to call list of API endpoints (PR315)
|
||||
- Added options to $config to specify fping retry and timeout (PR323)
|
||||
- Added icmp / snnmp to device down alerts for debugging (PR324)
|
||||
- Added icmp / snmp to device down alerts for debugging (PR324)
|
||||
- Added function to page results for large result pages (PR333)
|
||||
|
||||
###Sep 2014
|
||||
@@ -921,7 +921,7 @@
|
||||
- Fixed layout issue for ports list (PR286)
|
||||
- Removed session regeneration (PR287)
|
||||
- Updated edit button on edit user screen (PR288)
|
||||
|
||||
|
||||
####Improvements
|
||||
- Added email field for add user form (PR278)
|
||||
- V0 of API release (PR282)
|
||||
@@ -950,7 +950,7 @@
|
||||
####Improvements
|
||||
- Updated index page (PR224)
|
||||
- Updated global search visually (PR223)
|
||||
- Added contributors aggrement (PR225)
|
||||
- Added contributors agreement (PR225)
|
||||
- Added ability to update health values (PR226)
|
||||
- Tidied up search box on devices list page (PR229)
|
||||
- Updated port search box and port table list (PR230)
|
||||
@@ -1043,7 +1043,7 @@
|
||||
###Nov 2013
|
||||
|
||||
####Bug fixes
|
||||
- Updates to fix arp discovery
|
||||
- Updates to fix arp discovery
|
||||
|
||||
####Improvements
|
||||
- Added poller-wrapper (f8debf4)
|
||||
|
@@ -5,7 +5,7 @@ required to sign over their rights to any other party.
|
||||
Contributor Agreement
|
||||
---------------------
|
||||
|
||||
By contributing code to LibreNMS (whether by a github pull request, or by
|
||||
By contributing code to LibreNMS (whether by a GitHub pull request, or by
|
||||
any other means), you assert that:
|
||||
|
||||
- You have the rights to include the code, either as its original author,
|
||||
@@ -29,9 +29,9 @@ any other means), you assert that:
|
||||
systems.
|
||||
|
||||
|
||||
To agree with these assertions, please submit a Github pull request against
|
||||
To agree with these assertions, please submit a GitHub pull request against
|
||||
[AUTHORS.md][5], adding or altering a **single line** *containing your name,
|
||||
email address, and Github user id* in the file (so that it can be matched to
|
||||
email address, and GitHub user id* in the file (so that it can be matched to
|
||||
your commits), and stating in the *commit log* (not the pull request text):
|
||||
```
|
||||
I agree to the conditions of the Contributor Agreement
|
||||
@@ -170,7 +170,7 @@ project.
|
||||
Proposed workflow for submitting pull requests
|
||||
----------------------------------------------
|
||||
|
||||
Please see the new [Using Git](http://docs.librenms.org/Developing/Using-Git/) document which gives you step-by-step
|
||||
Please see the new [Using Git](http://docs.librenms.org/Developing/Using-Git/) document which gives you step-by-step
|
||||
instructions on using git to submit a pull request.
|
||||
|
||||
[1]: http://www.gnu.org/licenses/license-list.html
|
||||
|
@@ -28,11 +28,11 @@ LibreNMS ships with the following software components:
|
||||
|
||||
- Code for UBNT Devices
|
||||
Mark Gibbons <mgibbons@oemcomp.com>
|
||||
Initial code base submited via PR721
|
||||
Initial code base submitted via PR721
|
||||
|
||||
- Jquery LazyLoad
|
||||
http://www.appelsiini.net/projects/lazyload
|
||||
Mika Tuupola <tuupola@appelsiini.net> (@tuupola on github)
|
||||
Mika Tuupola <tuupola@appelsiini.net> (@tuupola on GitHub)
|
||||
MIT License
|
||||
|
||||
- influxdb-php
|
||||
|
@@ -153,8 +153,8 @@ Next, add the following to `/etc/httpd/conf.d/librenms.conf`
|
||||
</VirtualHost>
|
||||
```
|
||||
|
||||
__Notes:__
|
||||
If you are running Apache 2.2.18 or higher then change `AllowEncodedSlashes` to `NoDecode` and append `Require all granted` underneath `Options FollowSymLinks MultiViews`.
|
||||
__Notes:__
|
||||
If you are running Apache 2.2.18 or higher then change `AllowEncodedSlashes` to `NoDecode` and append `Require all granted` underneath `Options FollowSymLinks MultiViews`.
|
||||
If the file `/etc/httpd/conf.d/welcome.conf` exists, you might want to remove that as well unless you're familiar with [Name-based Virtual Hosts](https://httpd.apache.org/docs/2.2/vhosts/name-based.html)
|
||||
|
||||
### Using Nginx and PHP-FPM ###
|
||||
@@ -327,8 +327,8 @@ Create the cronjob
|
||||
|
||||
### Daily Updates ###
|
||||
|
||||
LibreNMS performs daily updates by default. At 00:15 system time every day, a `git pull --no-edit --quiet` is performed. You can override this default by edit
|
||||
ing your `config.php` file. Remove the comment (the `#` mark) on the line:
|
||||
LibreNMS performs daily updates by default. At 00:15 system time every day, a `git pull --no-edit --quiet` is performed. You can override this default by editing
|
||||
your `config.php` file. Remove the comment (the `#` mark) on the line:
|
||||
|
||||
#$config['update'] = 0;
|
||||
|
||||
|
@@ -7,7 +7,7 @@ If you would like to alter any of these then please add your config option to `c
|
||||
```php
|
||||
$config['install_dir'] = "/opt/librenms";
|
||||
```
|
||||
Set the installation directory (defaults to /opt/librenms), if you clone the github branch to another location ensure you alter this.
|
||||
Set the installation directory (defaults to /opt/librenms), if you clone the GitHub branch to another location ensure you alter this.
|
||||
|
||||
```php
|
||||
$config['temp_dir'] = "/tmp";
|
||||
@@ -60,7 +60,7 @@ $config['fping_options']['millisec'] = 200;
|
||||
* `millisec` (`fping` parameter `-p`): Time in milliseconds that fping waits between successive packets to an individual target.
|
||||
|
||||
You can disable the fping / icmp check that is done for a device to be determined to be up on a global or per device basis.
|
||||
**We don't advice disabling the fping / icmp check unless you know the impact, at worst if you have a large number of devices down
|
||||
**We don't advice disabling the fping / icmp check unless you know the impact, at worst if you have a large number of devices down
|
||||
then it's possible that the poller would no longer complete in 5 minutes due to waiting for snmp to timeout.**
|
||||
|
||||
Globally disable fping / icmp check:
|
||||
@@ -107,7 +107,7 @@ $config['rrdcached'] = "unix:/var/run/rrdcached.sock"; // or a tcp connection
|
||||
$config['rrdcached_dir'] = FALSE;
|
||||
```
|
||||
To enable rrdcached you need to set at least the `rrdcached` option. If `rrdcached` is a tcp socket then you need to configure `rrdcached_dir` as well.
|
||||
This should be set based on your base directory for running rrdcached. For instance if -b for rrdcached is set to /var/lib/rrd but you are expecting
|
||||
This should be set based on your base directory for running rrdcached. For instance if -b for rrdcached is set to /var/lib/rrd but you are expecting
|
||||
LibreNMS to store them in /var/lib/rrd/librenms then you would need to set `rrdcached_dir` to librenms.
|
||||
|
||||
#### WebUI Settings
|
||||
@@ -141,7 +141,7 @@ $config['vertical_summary'] = 0; // Enable to use vertical summary on front page
|
||||
$config['top_ports'] = 1; // This enables the top X ports box
|
||||
$config['top_devices'] = 1; // This enables the top X devices box
|
||||
```
|
||||
A number of home pages are provided within the install and can be found in html/pages/front/. You can change the default by
|
||||
A number of home pages are provided within the install and can be found in html/pages/front/. You can change the default by
|
||||
setting `front_page`. The other options are used to alter the look of those pages that support it (default.php supports these options).
|
||||
|
||||
```php
|
||||
@@ -214,7 +214,7 @@ $config['gui']['network-map']['style'] = 'old';
|
||||
|
||||
#### Add host settings
|
||||
The following setting controls how hosts are added. If a host is added as an ip address it is checked to ensure the ip is not already present. If the ip is present the host is not added.
|
||||
If host is added by hostname this check is not performed. If the setting is true hostnames are resovled and the check is also performed. This helps prevents accidental duplicate hosts.
|
||||
If host is added by hostname this check is not performed. If the setting is true hostnames are resolved and the check is also performed. This helps prevents accidental duplicate hosts.
|
||||
```php
|
||||
$config['addhost_alwayscheckip'] = FALSE; #TRUE - check for duplicate ips even when adding host by name.
|
||||
#FALSE- only check when adding host by ip.
|
||||
@@ -289,7 +289,7 @@ $config['email_smtp_auth'] = FALSE;
|
||||
$config['email_smtp_username'] = NULL;
|
||||
$config['email_smtp_password'] = NULL;
|
||||
```
|
||||
What type of mail transport to use for delivering emails. Valid options for `email_backend` are mail, sendmail or smtp.
|
||||
What type of mail transport to use for delivering emails. Valid options for `email_backend` are mail, sendmail or smtp.
|
||||
The varying options after that are to support the different transports.
|
||||
|
||||
#### Alerting
|
||||
@@ -333,14 +333,14 @@ Enable / disable additional port statistics.
|
||||
$config['rancid_configs'][] = '/var/lib/rancid/network/configs/';
|
||||
$config['rancid_ignorecomments'] = 0;
|
||||
```
|
||||
Rancid configuration, `rancid_configs` is an array containing all of the locations of your rancid files.
|
||||
Rancid configuration, `rancid_configs` is an array containing all of the locations of your rancid files.
|
||||
Setting `rancid_ignorecomments` will disable showing lines that start with #
|
||||
|
||||
```php
|
||||
$config['oxidized']['enabled'] = FALSE;
|
||||
$config['oxidized']['url'] = 'http://127.0.0.1:8888';
|
||||
```
|
||||
To enable Oxidized support set enabled to `TRUE`. URL needs to be configured to point to the REST API for Oxidized. This
|
||||
To enable Oxidized support set enabled to `TRUE`. URL needs to be configured to point to the REST API for Oxidized. This
|
||||
is then used to retrieve the config for devices.
|
||||
|
||||
|
||||
@@ -390,7 +390,7 @@ The above is an example, this will rewrite basic snmp locations so you don't nee
|
||||
$config['bad_if'][] = "voip-null";
|
||||
$config['bad_iftype'][] = "voiceEncap";
|
||||
```
|
||||
Numerous defaults exist for this array already (see includes/defaults.inc.php for the full list). You can expand this list
|
||||
Numerous defaults exist for this array already (see includes/defaults.inc.php for the full list). You can expand this list
|
||||
by continuing the array.
|
||||
`bad_if` is matched against the ifDescr value.
|
||||
`bad_iftype` is matched against the ifType value.
|
||||
@@ -446,8 +446,8 @@ Please see [IRC Bot](http://docs.librenms.org/Extensions/IRC-Bot/) section of th
|
||||
```php
|
||||
$config['auth_mechanism'] = "mysql";
|
||||
```
|
||||
This is the authentication type to use for the WebUI. MySQL is the default and configured when following the installation
|
||||
instructions. ldap and http-auth are also valid options. For instructions on the different authentication modules please
|
||||
This is the authentication type to use for the WebUI. MySQL is the default and configured when following the installation
|
||||
instructions. ldap and http-auth are also valid options. For instructions on the different authentication modules please
|
||||
see [Authentication](http://docs.librenms.org/Extensions/Authentication/).
|
||||
|
||||
```php
|
||||
@@ -459,7 +459,7 @@ If the user selects to be remembered on the login page, how long in days do we r
|
||||
$config['allow_unauth_graphs'] = 0;
|
||||
$config['allow_unauth_graphs_cidr'] = array();
|
||||
```
|
||||
This option will enable unauthenticated access to the graphs from `allow_unauth_graphs_cidr` ranges that you allow. Use
|
||||
This option will enable unauthenticated access to the graphs from `allow_unauth_graphs_cidr` ranges that you allow. Use
|
||||
of this option is highly discouraged in favour of the [API](http://docs.librenms.org/API/API-Docs/) that is now available.
|
||||
|
||||
#### Cleanup options
|
||||
@@ -473,7 +473,7 @@ $config['authlog_purge'] = 30;
|
||||
$config['perf_times_purge'] = 30;
|
||||
$config['device_perf_purge'] = 30;
|
||||
```
|
||||
This option will ensure data within LibreNMS over 1 month old is automatically purged. You can alter these individually,
|
||||
This option will ensure data within LibreNMS over 1 month old is automatically purged. You can alter these individually,
|
||||
values are in days.
|
||||
|
||||
#### Syslog options
|
||||
@@ -504,7 +504,7 @@ to indicate how you connect to libvirt. You also need to:
|
||||
|
||||
To test your setup, run `virsh -c qemu+ssh://vmhost/system list` or
|
||||
`virsh -c xen+ssh://vmhost list` as your librenms polling user.
|
||||
|
||||
|
||||
#### BGP Support
|
||||
|
||||
```php
|
||||
|
@@ -9,30 +9,30 @@ This document will explain how to use discovery.php to debug issues or manually
|
||||
-h even Poll even numbered devices (same as -i 2 -n 1)
|
||||
-h all Poll all devices
|
||||
-h new Poll all devices that have not had a discovery run before
|
||||
|
||||
|
||||
-i <instances> -n <number> Poll as instance <number> of <instances>
|
||||
Instances start at 0. 0-3 for -n 4
|
||||
|
||||
|
||||
|
||||
|
||||
Debugging and testing options:
|
||||
-d Enable debugging output
|
||||
-m Specify single module to be run
|
||||
```
|
||||
|
||||
`-h` Use this to specify a device via either id or hostname (including wildcard using *). You can also specify odd and
|
||||
even. all will run discovery against all devices whilst
|
||||
`-h` Use this to specify a device via either id or hostname (including wildcard using *). You can also specify odd and
|
||||
even. all will run discovery against all devices whilst
|
||||
new will poll only those devices that have recently been added or have been selected for rediscovery.
|
||||
|
||||
`-i` This can be used to stagger the discovery process.
|
||||
|
||||
`-d` Enables debugging output (verbose output) so that you can see what is happening during a discovery run. This includes
|
||||
`-d` Enables debugging output (verbose output) so that you can see what is happening during a discovery run. This includes
|
||||
things like rrd updates, SQL queries and response from snmp.
|
||||
|
||||
`-m` This enables you to specify the module you want to run for discovery.
|
||||
|
||||
#### Discovery config
|
||||
|
||||
These are the default discovery config items. You can globally disable a module by setting it to 0. If you just want to
|
||||
These are the default discovery config items. You can globally disable a module by setting it to 0. If you just want to
|
||||
disable it for one device then you can do this within the WebUI -> Settings -> Modules.
|
||||
|
||||
```php
|
||||
@@ -135,7 +135,7 @@ Here are some examples of running discovery from within your install directory.
|
||||
|
||||
#### Debugging
|
||||
|
||||
To provide debugging output you will need to run the discovery process with the `-d` flag. You can do this either against
|
||||
To provide debugging output you will need to run the discovery process with the `-d` flag. You can do this either against
|
||||
all modules, single or multiple modules:
|
||||
|
||||
All Modules
|
||||
@@ -153,7 +153,7 @@ Multiple Modules
|
||||
./discovery.php -h localhost -m ports,entity-physical -d
|
||||
```
|
||||
|
||||
It is then advisable to sanitise the output before pasting it somewhere as the debug output will contain snmp details
|
||||
It is then advisable to sanitise the output before pasting it somewhere as the debug output will contain snmp details
|
||||
amongst other items including port descriptions.
|
||||
|
||||
The output will contain:
|
||||
@@ -181,5 +181,5 @@ Usage: ./snmp-scan.php -r <CIDR_Range> [-d] [-l] [-h]
|
||||
Example: 192.168.0.0/24
|
||||
-d Enable Debug
|
||||
-l Show Legend
|
||||
-h Print this text
|
||||
-h Print this text
|
||||
```
|
||||
|
@@ -71,8 +71,8 @@ If the page you are trying to load has a substantial amount of data in it then i
|
||||
|
||||
#### <a name="faq10"> Why do I not see any graphs?</a>
|
||||
|
||||
This is usually due to there being blank spaces outside of the `<?php ?>` php tags within config.php. Remove these and retry.
|
||||
It's also worth removing the final `?>` at the end of config.php as this is not required.
|
||||
This is usually due to there being blank spaces outside of the `<?php ?>` php tags within config.php. Remove these and retry.
|
||||
It's also worth removing the final `?>` at the end of config.php as this is not required.
|
||||
|
||||
#### <a name="faq7"> How do I debug pages not loading correctly?</a>
|
||||
|
||||
@@ -92,12 +92,12 @@ Please see the [Poller Support](http://docs.librenms.org/Support/Poller Support)
|
||||
|
||||
#### <a name="faq14"> Why do I get a lot apache or rrdtool zombies in my process list?</a>
|
||||
|
||||
If this is related to your web service for LibreNMS then this has been tracked down to an issue within php which the developers aren't fixing. We have implemented a work around which means you
|
||||
If this is related to your web service for LibreNMS then this has been tracked down to an issue within php which the developers aren't fixing. We have implemented a work around which means you
|
||||
shouldn't be seeing this. If you are, please report this in [issue 443](https://github.com/librenms/librenms/issues/443).
|
||||
|
||||
#### <a name="faq15"> Why do I see traffic spikes in my graphs?</a>
|
||||
|
||||
This occurs either when a counter resets or the device sends back bogus data making it look like a counter reset. We have enabled support for setting a maximum value for rrd files for ports.
|
||||
This occurs either when a counter resets or the device sends back bogus data making it look like a counter reset. We have enabled support for setting a maximum value for rrd files for ports.
|
||||
Before this all rrd files were set to 100G max values, now you can enable support to limit this to the actual port speed.
|
||||
|
||||
rrdtool tune will change the max value when the interface speed is detected as being changed (min value will be set for anything 10M or over) or when you run the included script (scripts/tune_port.php).
|
||||
@@ -136,7 +136,7 @@ Thanks for asking, sometimes it's not quite so obvious and everyone can contribu
|
||||
|
||||
#### <a name="faq13"> How can I test another users branch?</a>
|
||||
|
||||
LibreNMS can and is developed by anyone, this means someone may be working on a new feature or support for a device that you want.
|
||||
LibreNMS can and is developed by anyone, this means someone may be working on a new feature or support for a device that you want.
|
||||
It can be helpful for others to test these new features, using Git, this is made easy.
|
||||
|
||||
```bash
|
||||
@@ -151,7 +151,7 @@ git status
|
||||
If you see `nothing to commit, working directory clean` then let's go for it :)
|
||||
|
||||
Let's say that you want to test a users (f0o) new development branch (issue-1337) then you can do the following:
|
||||
|
||||
|
||||
```bash
|
||||
git remote add f0o https://github.com/librenms/librenms.git
|
||||
git remote update f0o
|
||||
|
@@ -16,7 +16,7 @@ If you think something is missing, feel free to ask us.
|
||||
* Traffic Billing (Quota, 95th Percentile)
|
||||
* Two Factor Authentication
|
||||
|
||||
### Vendors
|
||||
### Vendors
|
||||
Here's a brief list of supported vendors, some might be missing.
|
||||
If you are unsure of whether your device is supported or not, feel free to ask us.
|
||||
|
||||
@@ -74,7 +74,7 @@ If you are unsure of whether your device is supported or not, feel free to ask u
|
||||
* Mellanox
|
||||
* Meraki
|
||||
* MGE
|
||||
* Mikrotic
|
||||
* Mikrotik
|
||||
* MRVLD
|
||||
* Multimatic
|
||||
* NetApp
|
||||
|
@@ -1,10 +1,10 @@
|
||||
Install validation
|
||||
------------------
|
||||
|
||||
With a lot of configuration possibilities and at present the only way to do this being by manually editing config.php then it's not
|
||||
With a lot of configuration possibilities and at present the only way to do this being by manually editing config.php then it's not
|
||||
uncommon that mistakes get made. It's also impossible to validate user input in config.php when you're just using a text editor :)
|
||||
|
||||
So, to try and help with some of the general issues people come across we've put together a simple validation tool which at present will:
|
||||
So, to try and help with some of the general issues people come across we've put together a simple validation tool which at present will:
|
||||
|
||||
- Validate config.php from a php perspective including whitespace where it shouldn't be.
|
||||
- Connection to your MySQL server to verify credentials.
|
||||
|
@@ -20,21 +20,21 @@ Debugging and testing options:
|
||||
-m Specify module(s) to be run
|
||||
```
|
||||
|
||||
`-h` Use this to specify a device via either id or hostname (including wildcard using *). You can also specify odd and
|
||||
`-h` Use this to specify a device via either id or hostname (including wildcard using *). You can also specify odd and
|
||||
even. all will run poller against all devices.
|
||||
|
||||
`-i` This can be used to stagger the poller process.
|
||||
|
||||
`-r` This option will suppress the creation or update of RRD files.
|
||||
|
||||
`-d` Enables debugging output (verbose output) so that you can see what is happening during a poller run. This includes
|
||||
`-d` Enables debugging output (verbose output) so that you can see what is happening during a poller run. This includes
|
||||
things like rrd updates, SQL queries and response from snmp.
|
||||
|
||||
`-m` This enables you to specify the module you want to run for poller.
|
||||
|
||||
#### Poller config
|
||||
|
||||
These are the default poller config items. You can globally disable a module by setting it to 0. If you just want to
|
||||
These are the default poller config items. You can globally disable a module by setting it to 0. If you just want to
|
||||
disable it for one device then you can do this within the WebUI -> Settings -> Modules.
|
||||
|
||||
```php
|
||||
@@ -130,8 +130,8 @@ $config['poller_modules']['mib'] = 0;
|
||||
|
||||
`netscaler-vsvr`: Netscaler support.
|
||||
|
||||
`aruba-controller`: Arube wireless controller support.
|
||||
|
||||
`aruba-controller`: Aruba wireless controller support.
|
||||
|
||||
`entity-physical`: Module to pick up the devices hardware support.
|
||||
|
||||
`applications`: Device application support.
|
||||
@@ -151,7 +151,7 @@ Here are some examples of running poller from within your install directory.
|
||||
|
||||
#### Debugging
|
||||
|
||||
To provide debugging output you will need to run the poller process with the `-d` flag. You can do this either against
|
||||
To provide debugging output you will need to run the poller process with the `-d` flag. You can do this either against
|
||||
all modules, single or multiple modules:
|
||||
|
||||
All Modules
|
||||
@@ -169,7 +169,7 @@ Multiple Modules
|
||||
./poller.php -h localhost -m ports,entity-physical -d
|
||||
```
|
||||
|
||||
It is then advisable to sanitise the output before pasting it somewhere as the debug output will contain snmp details
|
||||
It is then advisable to sanitise the output before pasting it somewhere as the debug output will contain snmp details
|
||||
amongst other items including port descriptions.
|
||||
|
||||
The output will contain:
|
||||
|
@@ -69,7 +69,7 @@ $hardware = "Juniper " . trim(snmp_get($device, "productName.0", "-OQv", "PULSES
|
||||
$hostname = trim(snmp_get($device, "sysName.0", "-OQv", "SNMPv2-MIB"),'"');
|
||||
```
|
||||
|
||||
Quick explanation and examples :
|
||||
Quick explanation and examples :
|
||||
|
||||
```bash
|
||||
snmpwalk -v2c -c public -m SNMPv2-MIB -M mibs
|
||||
|
@@ -1847,7 +1847,7 @@ label {
|
||||
|
||||
.greenCluster {
|
||||
background-color: rgba(0,255,0);
|
||||
background-color: rgba(0,255,0,0.7);
|
||||
background-color: rgba(110, 204, 57, 0.6);
|
||||
text-align: center;
|
||||
width: 25px !important;
|
||||
height: 25px !important;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2015 Daniel Preussker, QuxLabs UG <preussker@quxlabs.com>
|
||||
/* Copyright (C) 2015-2016 Daniel Preussker, QuxLabs UG <preussker@quxlabs.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
|
||||
@@ -16,7 +16,7 @@
|
||||
/**
|
||||
* Generic Graph Widget
|
||||
* @author Daniel Preussker
|
||||
* @copyright 2015 Daniel Preussker, QuxLabs UG
|
||||
* @copyright 2015-2016 Daniel Preussker, QuxLabs UG
|
||||
* @license GPL
|
||||
* @package LibreNMS
|
||||
* @subpackage Widgets
|
||||
@@ -25,6 +25,14 @@
|
||||
if( defined('show_settings') || empty($widget_settings) ) {
|
||||
$common_output[] = '
|
||||
<form class="form" onsubmit="widget_settings(this); return false;">
|
||||
<div class="form-group">
|
||||
<div class="col-sm-2">
|
||||
<label for="title" class="control-label">Title: </label>
|
||||
</div>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" name="title" placeholder="Automatic Title" value="'.htmlspecialchars($widget_settings['title']).'">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-2">
|
||||
<label for="graph_type" class="control-label">Graph: </label>
|
||||
@@ -365,12 +373,13 @@ $(function() {
|
||||
</script>';
|
||||
}
|
||||
else {
|
||||
$widget_settings['title'] = "";
|
||||
$type = explode('_',$widget_settings['graph_type'],2);
|
||||
$type = array_shift($type);
|
||||
$widget_settings['graph_'.$type] = json_decode($widget_settings['graph_'.$type],true)?:$widget_settings['graph_'.$type];
|
||||
if ($type == 'device') {
|
||||
$widget_settings['title'] = $widget_settings['graph_device']['name']." / ".$widget_settings['graph_type'];
|
||||
if (empty($widget_settings['title'])) {
|
||||
$widget_settings['title'] = $widget_settings['graph_device']['name']." / ".$widget_settings['graph_type'];
|
||||
}
|
||||
$param = 'device='.$widget_settings['graph_device']['device_id'];
|
||||
}
|
||||
elseif ($type == 'application') {
|
||||
@@ -394,27 +403,31 @@ else {
|
||||
$type_where .= " $or `port_descr_type` = ?";
|
||||
$or = 'OR';
|
||||
$type_param[] = $type;
|
||||
$type_where .= ') ';
|
||||
$type_where .= ') ';
|
||||
foreach (dbFetchRows("SELECT port_id FROM `ports` WHERE $type_where ORDER BY ifAlias", $type_param) as $port) {
|
||||
$tmp[] = $port['port_id'];
|
||||
}
|
||||
$param = 'id='.implode(',',$tmp);
|
||||
$widget_settings['graph_type']= 'multiport_bits_separate';
|
||||
$widget_settings['title'] = 'Overall '.ucfirst($type).' Bits ('.$widget_settings['graph_range'].')';
|
||||
$param = 'id='.implode(',',$tmp);
|
||||
$widget_settings['graph_type'] = 'multiport_bits_separate';
|
||||
if (empty($widget_settings['title'])) {
|
||||
$widget_settings['title'] = 'Overall '.ucfirst($type).' Bits ('.$widget_settings['graph_range'].')';
|
||||
}
|
||||
}
|
||||
elseif ($type == 'custom') {
|
||||
foreach (dbFetchRows("SELECT port_id FROM `ports` WHERE `port_descr_type` = ? ORDER BY ifAlias", array($widget_settings['graph_custom'])) as $port) {
|
||||
$tmp[] = $port['port_id'];
|
||||
}
|
||||
$param = 'id='.implode(',',$tmp);
|
||||
$widget_settings['graph_type']= 'multiport_bits_separate';
|
||||
$widget_settings['title'] = 'Overall '.ucfirst(htmlspecialchars($widget_settings['graph_custom'])).' Bits ('.$widget_settings['graph_range'].')';
|
||||
$param = 'id='.implode(',',$tmp);
|
||||
$widget_settings['graph_type'] = 'multiport_bits_separate';
|
||||
if (empty($widget_settings['title'])) {
|
||||
$widget_settings['title'] = 'Overall '.ucfirst(htmlspecialchars($widget_settings['graph_custom'])).' Bits ('.$widget_settings['graph_range'].')';
|
||||
}
|
||||
}
|
||||
else {
|
||||
$param = 'id='.$widget_settings['graph_'.$type][$type.'_id'];
|
||||
$param = 'id='.$widget_settings['graph_'.$type][$type.'_id'];
|
||||
}
|
||||
if (empty($widget_settings['title'])) {
|
||||
$widget_settings['title'] = $widget_settings['graph_'.$type]['hostname']." / ".$widget_settings['graph_'.$type]['name']." / ".$widget_settings['graph_type'];
|
||||
$widget_settings['title'] = $widget_settings['graph_'.$type]['hostname']." / ".$widget_settings['graph_'.$type]['name']." / ".$widget_settings['graph_type'];
|
||||
}
|
||||
$common_output[] = '<img class="minigraph-image" width="'.$widget_dimensions['x'].'" height="'.$widget_dimensions['y'].'" src="graph.php?'.$param.'&from='.$config['time'][$widget_settings['graph_range']].'&to='.$config['time']['now'].'&width='.$widget_dimensions['x'].'&height='.$widget_dimensions['y'].'&type='.$widget_settings['graph_type'].'&legend='.($widget_settings['graph_legend'] == 1 ? 'yes' : 'no').'&absolute=1"/>';
|
||||
$common_output[] = '<img class="minigraph-image" width="'.$widget_dimensions['x'].'" height="'.$widget_dimensions['y'].'" src="graph.php?'.$param.'&from='.$config['time'][$widget_settings['graph_range']].'&to='.$config['time']['now'].'&width='.$widget_dimensions['x'].'&height='.$widget_dimensions['y'].'&type='.$widget_settings['graph_type'].'&legend='.($widget_settings['graph_legend'] == 1 ? 'yes' : 'no').'&absolute=1"/>';
|
||||
}
|
||||
|
39
html/includes/common/stp-ports.inc.php
Normal file
39
html/includes/common/stp-ports.inc.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
$common_output[] = '
|
||||
<div class="table-responsive">
|
||||
<table id="stp-ports" class="table table-condensed table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-column-id="port_id">Port</th>
|
||||
<th data-column-id="priority">Priority</th>
|
||||
<th data-column-id="state">State</th>
|
||||
<th data-column-id="enable">Enable</th>
|
||||
<th data-column-id="pathCost">Path cost</th>
|
||||
<th data-column-id="designatedRoot">Designated root</th>
|
||||
<th data-column-id="designatedCost">Designated cost</th>
|
||||
<th data-column-id="designatedBridge">Designated bridge</th>
|
||||
<th data-column-id="designatedPort">Designated port</th>
|
||||
<th data-column-id="forwardTransitions">Forward transitions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
var grid = $("#stp-ports").bootgrid( {
|
||||
ajax: true,
|
||||
templates: {search: ""},
|
||||
post: function ()
|
||||
{
|
||||
return {
|
||||
id: "stp-ports",
|
||||
device_id: ' . $device['device_id'] . ',
|
||||
};
|
||||
},
|
||||
url: "ajax_table.php"
|
||||
});
|
||||
|
||||
</script>
|
||||
';
|
@@ -4,8 +4,9 @@
|
||||
$i = 0;
|
||||
|
||||
foreach ($ports as $port) {
|
||||
if (is_file($config['rrd_dir'].'/'.$port['hostname'].'/port-'.safename($port['ifIndex'].'.rrd'))) {
|
||||
$rrd_list[$i]['filename'] = $config['rrd_dir'].'/'.$port['hostname'].'/port-'.safename($port['ifIndex'].'.rrd');
|
||||
$rrd_file = get_port_rrdfile_path ($port['hostname'], $port['port_id']);
|
||||
if (is_file($rrd_file)) {
|
||||
$rrd_list[$i]['filename'] = $rrd_file;
|
||||
$rrd_list[$i]['descr'] = $port['ifDescr'];
|
||||
$i++;
|
||||
}
|
||||
|
@@ -10,8 +10,8 @@ if (!is_array($config['customers_descr'])) {
|
||||
$descr_type = "'".implode("', '", $config['customers_descr'])."'";
|
||||
|
||||
foreach (dbFetchRows('SELECT * FROM `ports` AS I, `devices` AS D WHERE `port_descr_type` IN (?) AND `port_descr_descr` = ? AND D.device_id = I.device_id', array(array($descr_type), $vars['id'])) as $port) {
|
||||
if (is_file($config['rrd_dir'].'/'.$port['hostname'].'/port-'.safename($port['ifIndex'].'.rrd'))) {
|
||||
$rrd_filename = $config['rrd_dir'].'/'.$port['hostname'].'/port-'.safename($port['ifIndex'].'.rrd');
|
||||
$rrd_filename = get_port_rrdfile_path ($port['hostname'], $port['port_id']); // FIXME: Unification OK?
|
||||
if (is_file($rrd_filename)) {
|
||||
$rrd_list[$i]['filename'] = $rrd_filename;
|
||||
$rrd_list[$i]['descr'] = $port['hostname'].'-'.$port['ifDescr'];
|
||||
$rrd_list[$i]['descr_in'] = shorthost($port['hostname']);
|
||||
@@ -20,7 +20,6 @@ foreach (dbFetchRows('SELECT * FROM `ports` AS I, `devices` AS D WHERE `port_des
|
||||
}
|
||||
}
|
||||
|
||||
// echo($config['rrd_dir'] . "/" . $port['hostname'] . "/port-" . safename($port['ifIndex'] . ".rrd"));
|
||||
$units = 'bps';
|
||||
$total_units = 'B';
|
||||
$colours_in = 'greens';
|
||||
|
@@ -22,7 +22,7 @@ foreach (dbFetchRows('SELECT * FROM `ports` WHERE `device_id` = ?', array($devic
|
||||
}
|
||||
}
|
||||
|
||||
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/port-'.safename($port['ifIndex'].'.rrd');
|
||||
$rrd_filename = get_port_rrdfile_path ($device['hostname'], $port['port_id']);
|
||||
if ($ignore != 1 && is_file($rrd_filename)) {
|
||||
$port = ifLabel($port);
|
||||
// Fix Labels! ARGH. This needs to be in the bloody database!
|
||||
|
@@ -21,7 +21,7 @@ foreach (dbFetchRows('SELECT * FROM `ports` AS P, `devices` AS D WHERE D.device_
|
||||
}
|
||||
}
|
||||
|
||||
$rrd_filename = $config['rrd_dir'].'/'.$port['hostname'].'/port-'.safename($port['ifIndex'].'.rrd');
|
||||
$rrd_filename = get_port_rrdfile_path ($port['hostname'], $port['port_id']);
|
||||
if (!$ignore && $i < 1100 && is_file($rrd_filename)) {
|
||||
$rrd_filenames[] = $rrd_filename;
|
||||
$rrd_list[$i]['filename'] = $rrd_filename;
|
||||
|
@@ -24,8 +24,9 @@ foreach ($devices as $device) {
|
||||
}
|
||||
}
|
||||
|
||||
if (is_file($config['rrd_dir'].'/'.$device['hostname'].'/port-'.safename($int['ifIndex'].'.rrd')) && $ignore != 1) {
|
||||
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/port-'.safename($int['ifIndex'].'.rrd');
|
||||
$rrd_file = get_port_rrdfile_path ($device['hostname'], $int['port_id']);
|
||||
if (is_file($rrd_file) && $ignore != 1) {
|
||||
$rrd_filename = $rrd_file; // FIXME: Can this be unified without side-effects?
|
||||
$rrd_list[$i]['filename'] = $rrd_filename;
|
||||
$rrd_list[$i]['descr'] = $port['label'];
|
||||
$rrd_list[$i]['descr_in'] = $device['hostname'];
|
||||
|
@@ -8,9 +8,10 @@ foreach (explode(',', $vars['id']) as $ifid) {
|
||||
$ifid = str_replace('!', '', $ifid);
|
||||
}
|
||||
|
||||
$int = dbFetchRow('SELECT `ifIndex`, `hostname` FROM `ports` AS I, devices as D WHERE I.port_id = ? AND I.device_id = D.device_id', array($ifid));
|
||||
if (is_file($config['rrd_dir'].'/'.$int['hostname'].'/port-'.safename($int['ifIndex'].'.rrd'))) {
|
||||
$rrd_filenames[$i] = $config['rrd_dir'].'/'.$int['hostname'].'/port-'.safename($int['ifIndex'].'.rrd');
|
||||
$int = dbFetchRow('SELECT `hostname` FROM `ports` AS I, devices as D WHERE I.port_id = ? AND I.device_id = D.device_id', array($ifid));
|
||||
$rrd_file = get_port_rrdfile_path ($int['hostname'], $ifid);
|
||||
if (is_file($rrd_file)) {
|
||||
$rrd_filenames[$i] = $rrd_file;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
@@ -13,10 +13,11 @@ if ($height < '99') {
|
||||
$i = 1;
|
||||
|
||||
foreach (explode(',', $_GET['id']) as $ifid) {
|
||||
$int = dbFetchRow('SELECT `ifIndex`, `hostname` FROM `ports` AS I, devices as D WHERE I.port_id = ? AND I.device_id = D.device_id', array($ifid));
|
||||
if (is_file($config['rrd_dir'].'/'.$int['hostname'].'/port-'.$int['ifIndex'].'.rrd')) {
|
||||
$rrd_options .= ' DEF:inoctets'.$i.'='.$config['rrd_dir'].'/'.$int['hostname'].'/port-'.$int['ifIndex'].'.rrd:INOCTETS:AVERAGE';
|
||||
$rrd_options .= ' DEF:outoctets'.$i.'='.$config['rrd_dir'].'/'.$int['hostname'].'/port-'.$int['ifIndex'].'.rrd:OUTOCTETS:AVERAGE';
|
||||
$int = dbFetchRow('SELECT `hostname` FROM `ports` AS I, devices as D WHERE I.port_id = ? AND I.device_id = D.device_id', array($ifid));
|
||||
$rrd_file = get_port_rrdfile_path ($int['hostname'], $ifid);
|
||||
if (is_file($rrd_file)) {
|
||||
$rrd_options .= ' DEF:inoctets'.$i.'='.$rrd_file.':INOCTETS:AVERAGE';
|
||||
$rrd_options .= ' DEF:outoctets'.$i.'='.$rrd_file.':OUTOCTETS:AVERAGE';
|
||||
$in_thing .= $seperator.'inoctets'.$i.',UN,0,'.'inoctets'.$i.',IF';
|
||||
$out_thing .= $seperator.'outoctets'.$i.',UN,0,'.'outoctets'.$i.',IF';
|
||||
$pluses .= $plus;
|
||||
@@ -30,10 +31,11 @@ unset($seperator);
|
||||
unset($plus);
|
||||
|
||||
foreach (explode(',', $_GET['idb']) as $ifid) {
|
||||
$int = dbFetchRow('SELECT `ifIndex`, `hostname` FROM `ports` AS I, devices as D WHERE I.port_id = ? AND I.device_id = D.device_id', array($ifid));
|
||||
if (is_file($config['rrd_dir'].'/'.$int['hostname'].'/port-'.$int['ifIndex'].'.rrd')) {
|
||||
$rrd_options .= ' DEF:inoctetsb'.$i.'='.$config['rrd_dir'].'/'.$int['hostname'].'/port-'.$int['ifIndex'].'.rrd:INOCTETS:AVERAGE';
|
||||
$rrd_options .= ' DEF:outoctetsb'.$i.'='.$config['rrd_dir'].'/'.$int['hostname'].'/port-'.$int['ifIndex'].'.rrd:OUTOCTETS:AVERAGE';
|
||||
$int = dbFetchRow('SELECT `hostname` FROM `ports` AS I, devices as D WHERE I.port_id = ? AND I.device_id = D.device_id', array($ifid));
|
||||
$rrd_file = get_port_rrdfile_path ($int['hostname'], $ifid);
|
||||
if (is_file($rrd_file)) {
|
||||
$rrd_options .= ' DEF:inoctetsb'.$i.'='.$rrd_file.':INOCTETS:AVERAGE';
|
||||
$rrd_options .= ' DEF:outoctetsb'.$i.'='.$rrd_file.':OUTOCTETS:AVERAGE';
|
||||
$in_thingb .= $seperator.'inoctetsb'.$i.',UN,0,'.'inoctetsb'.$i.',IF';
|
||||
$out_thingb .= $seperator.'outoctetsb'.$i.',UN,0,'.'outoctetsb'.$i.',IF';
|
||||
$plusesb .= $plus;
|
||||
|
@@ -4,9 +4,10 @@ $i = 0;
|
||||
|
||||
foreach (explode(',', $vars['id']) as $ifid) {
|
||||
$port = dbFetchRow('SELECT * FROM `ports` AS I, devices as D WHERE I.port_id = ? AND I.device_id = D.device_id', array($ifid));
|
||||
if (is_file($config['rrd_dir'].'/'.$port['hostname'].'/port-'.safename($port['ifIndex'].'.rrd'))) {
|
||||
$rrd_file = get_port_rrdfile_path ($port['hostname'], $ifid);
|
||||
if (is_file($rrd_file)) {
|
||||
$port = ifLabel($port);
|
||||
$rrd_list[$i]['filename'] = $config['rrd_dir'].'/'.$port['hostname'].'/port-'.safename($port['ifIndex'].'.rrd');
|
||||
$rrd_list[$i]['filename'] = $rrd_file;
|
||||
$rrd_list[$i]['descr'] = $port['hostname'].' '.$port['ifDescr'];
|
||||
$rrd_list[$i]['descr_in'] = $port['hostname'];
|
||||
$rrd_list[$i]['descr_out'] = makeshortif($port['label']);
|
||||
|
@@ -14,8 +14,9 @@ if ($height < '99') {
|
||||
$i = 1;
|
||||
|
||||
foreach (explode(',', $_GET['id']) as $ifid) {
|
||||
$int = dbFetchRow('SELECT `ifIndex`, `hostname` FROM `ports` AS I, devices as D WHERE I.port_id = ? AND I.device_id = D.device_id', array($ifid));
|
||||
if (is_file($config['rrd_dir'].'/'.$int['hostname'].'/port-'.$int['ifIndex'].'.rrd')) {
|
||||
$int = dbFetchRow('SELECT `hostname` FROM `ports` AS I, devices as D WHERE I.port_id = ? AND I.device_id = D.device_id', array($ifid));
|
||||
$rrd_file = get_port_rrdfile_path ($int['hostname'], $ifid);
|
||||
if (is_file($rrd_file)) {
|
||||
if (strstr($inverse, 'a')) {
|
||||
$in = 'OUT';
|
||||
$out = 'IN';
|
||||
@@ -25,8 +26,8 @@ foreach (explode(',', $_GET['id']) as $ifid) {
|
||||
$out = 'OUT';
|
||||
}
|
||||
|
||||
$rrd_options .= ' DEF:inoctets'.$i.'='.$config['rrd_dir'].'/'.$int['hostname'].'/port-'.$int['ifIndex'].'.rrd:'.$in.'OCTETS:AVERAGE';
|
||||
$rrd_options .= ' DEF:outoctets'.$i.'='.$config['rrd_dir'].'/'.$int['hostname'].'/port-'.$int['ifIndex'].'.rrd:'.$out.'OCTETS:AVERAGE';
|
||||
$rrd_options .= ' DEF:inoctets'.$i.'='.$rrd_file.':'.$in.'OCTETS:AVERAGE';
|
||||
$rrd_options .= ' DEF:outoctets'.$i.'='.$rrd_file.':'.$out.'OCTETS:AVERAGE';
|
||||
$in_thing .= $seperator.'inoctets'.$i.',UN,0,'.'inoctets'.$i.',IF';
|
||||
$out_thing .= $seperator.'outoctets'.$i.',UN,0,'.'outoctets'.$i.',IF';
|
||||
$pluses .= $plus;
|
||||
@@ -40,8 +41,9 @@ unset($seperator);
|
||||
unset($plus);
|
||||
|
||||
foreach (explode(',', $_GET['idb']) as $ifid) {
|
||||
$int = dbFetchRow('SELECT `ifIndex`, `hostname` FROM `ports` AS I, devices as D WHERE I.port_id = ? AND I.device_id = D.device_id', array($ifid));
|
||||
if (is_file($config['rrd_dir'].'/'.$int['hostname'].'/port-'.$int['ifIndex'].'.rrd')) {
|
||||
$int = dbFetchRow('SELECT `hostname` FROM `ports` AS I, devices as D WHERE I.port_id = ? AND I.device_id = D.device_id', array($ifid));
|
||||
$rrd_file = get_port_rrdfile_path ($int['hostname'], $ifid);
|
||||
if (is_file($rrd_file)) {
|
||||
if (strstr($inverse, 'b')) {
|
||||
$in = 'OUT';
|
||||
$out = 'IN';
|
||||
@@ -51,8 +53,8 @@ foreach (explode(',', $_GET['idb']) as $ifid) {
|
||||
$out = 'OUT';
|
||||
}
|
||||
|
||||
$rrd_options .= ' DEF:inoctetsb'.$i.'='.$config['rrd_dir'].'/'.$int['hostname'].'/port-'.$int['ifIndex'].'.rrd:'.$in.'OCTETS:AVERAGE';
|
||||
$rrd_options .= ' DEF:outoctetsb'.$i.'='.$config['rrd_dir'].'/'.$int['hostname'].'/port-'.$int['ifIndex'].'.rrd:'.$out.'OCTETS:AVERAGE';
|
||||
$rrd_options .= ' DEF:inoctetsb'.$i.'='.$rrd_file.':'.$in.'OCTETS:AVERAGE';
|
||||
$rrd_options .= ' DEF:outoctetsb'.$i.'='.$rrd_file.':'.$out.'OCTETS:AVERAGE';
|
||||
$in_thingb .= $seperator.'inoctetsb'.$i.',UN,0,'.'inoctetsb'.$i.',IF';
|
||||
$out_thingb .= $seperator.'outoctetsb'.$i.',UN,0,'.'outoctetsb'.$i.',IF';
|
||||
$plusesb .= $plus;
|
||||
@@ -66,8 +68,9 @@ unset($seperator);
|
||||
unset($plus);
|
||||
|
||||
foreach (explode(',', $_GET['idc']) as $ifid) {
|
||||
$int = dbFetchRow('SELECT `ifIndex`, `hostname` FROM `ports` AS I, devices as D WHERE I.port_id = ? AND I.device_id = D.device_id', array($ifid));
|
||||
if (is_file($config['rrd_dir'].'/'.$int['hostname'].'/port-'.$int['ifIndex'].'.rrd')) {
|
||||
$int = dbFetchRow('SELECT `hostname` FROM `ports` AS I, devices as D WHERE I.port_id = ? AND I.device_id = D.device_id', array($ifid));
|
||||
$rrd_file = get_port_rrdfile_path ($int['hostname'], $ifid);
|
||||
if (is_file($rrd_file)) {
|
||||
if (strstr($inverse, 'c')) {
|
||||
$in = 'OUT';
|
||||
$out = 'IN';
|
||||
@@ -77,8 +80,8 @@ foreach (explode(',', $_GET['idc']) as $ifid) {
|
||||
$out = 'OUT';
|
||||
}
|
||||
|
||||
$rrd_options .= ' DEF:inoctetsc'.$i.'='.$config['rrd_dir'].'/'.$int['hostname'].'/port-'.$int['ifIndex'].'.rrd:'.$in.'OCTETS:AVERAGE';
|
||||
$rrd_options .= ' DEF:outoctetsc'.$i.'='.$config['rrd_dir'].'/'.$int['hostname'].'/port-'.$int['ifIndex'].'.rrd:'.$out.'OCTETS:AVERAGE';
|
||||
$rrd_options .= ' DEF:inoctetsc'.$i.'='.$rrd_file.':'.$in.'OCTETS:AVERAGE';
|
||||
$rrd_options .= ' DEF:outoctetsc'.$i.'='.$rrd_file.':'.$out.'OCTETS:AVERAGE';
|
||||
$in_thingc .= $seperator.'inoctetsc'.$i.',UN,0,'.'inoctetsc'.$i.',IF';
|
||||
$out_thingc .= $seperator.'outoctetsc'.$i.',UN,0,'.'outoctetsc'.$i.',IF';
|
||||
$plusesc .= $plus;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/port-'.safename($port['ifIndex'].'-adsl.rrd');
|
||||
$rrd_filename = get_port_rrdfile_path ($device['hostname'], $port['port_id'], 'adsl');
|
||||
|
||||
$rrd_list[0]['filename'] = $rrd_filename;
|
||||
$rrd_list[0]['descr'] = 'Downstream';
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/port-'.safename($port['ifIndex'].'-adsl.rrd');
|
||||
$rrd_filename = get_port_rrdfile_path ($device['hostname'], $port['port_id'], 'adsl');
|
||||
|
||||
$rrd_list[0]['filename'] = $rrd_filename;
|
||||
$rrd_list[0]['descr'] = 'Downstream';
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/port-'.safename($port['ifIndex'].'-adsl.rrd');
|
||||
$rrd_filename = get_port_rrdfile_path ($device['hostname'], $port['port_id'], 'adsl');
|
||||
|
||||
$rrd_list[0]['filename'] = $rrd_filename;
|
||||
$rrd_list[0]['descr'] = 'Downstream';
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/port-'.safename($port['ifIndex'].'-adsl.rrd');
|
||||
$rrd_filename = get_port_rrdfile_path ($device['hostname'], $port['port_id'], 'adsl');
|
||||
|
||||
$rrd_list[0]['filename'] = $rrd_filename;
|
||||
$rrd_list[0]['descr'] = 'Downstream';
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/port-'.safename($port['ifIndex'].'-adsl.rrd');
|
||||
$rrd_filename = get_port_rrdfile_path ($device['hostname'], $port['port_id'], 'adsl');
|
||||
|
||||
$rrd_list[0]['filename'] = $rrd_filename;
|
||||
$rrd_list[0]['descr'] = 'Downstream';
|
||||
|
@@ -13,5 +13,5 @@ if (is_numeric($vars['id']) && ($auth || port_permitted($vars['id']))) {
|
||||
|
||||
$auth = true;
|
||||
|
||||
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/port-'.safename($port['ifIndex'].'.rrd');
|
||||
$rrd_filename = get_port_rrdfile_path ($device['hostname'], $port['port_id']);
|
||||
}
|
||||
|
75
html/includes/graphs/port/cbqos_bufferdrops.inc.php
Normal file
75
html/includes/graphs/port/cbqos_bufferdrops.inc.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS module to display Cisco Class-Based QoS Details
|
||||
*
|
||||
* Copyright (c) 2015 Aaron Daniels <aaron@daniels.id.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.
|
||||
*/
|
||||
|
||||
require_once "../includes/component.php";
|
||||
$component = new component();
|
||||
$options['filter']['type'] = array('=','Cisco-CBQOS');
|
||||
$components = $component->getComponents($device['device_id'],$options);
|
||||
|
||||
// We only care about our device id.
|
||||
$components = $components[$device['device_id']];
|
||||
|
||||
// Determine a policy to show.
|
||||
if (!isset($vars['policy'])) {
|
||||
foreach ($components as $id => $array) {
|
||||
if ( ($array['qos-type'] == 1) && ($array['ifindex'] == $port['ifIndex']) && ($array['parent'] == 0) ) {
|
||||
// Found the first policy
|
||||
$vars['policy'] = $id;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
include "includes/graphs/common.inc.php";
|
||||
$rrd_options .= " -l 0 -E ";
|
||||
$rrd_options .= " COMMENT:'Class-Map Now Avg Max\\n'";
|
||||
$rrd_additions = "";
|
||||
|
||||
$count = 0;
|
||||
foreach ($components as $id => $array) {
|
||||
if ( ($array['qos-type'] == 2) && ($array['parent'] == $components[$vars['policy']]['sp-obj']) && ($array['sp-id'] == $components[$vars['policy']]['sp-id'])) {
|
||||
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename("port-".$array['ifindex']."-cbqos-".$array['sp-id']."-".$array['sp-obj'].".rrd");
|
||||
|
||||
if (file_exists($rrd_filename)) {
|
||||
// Stack the area on the second and subsequent DS's
|
||||
$stack = "";
|
||||
if ($count != 0) {
|
||||
$stack = ":STACK ";
|
||||
}
|
||||
|
||||
// Grab a color from the array.
|
||||
if ( isset($config['graph_colours']['mixed'][$count]) ) {
|
||||
$color = $config['graph_colours']['mixed'][$count];
|
||||
}
|
||||
else {
|
||||
$color = $config['graph_colours']['oranges'][$count-7];
|
||||
}
|
||||
|
||||
$rrd_additions .= " DEF:DS" . $count . "=" . $rrd_filename . ":bufferdrops:AVERAGE ";
|
||||
$rrd_additions .= " CDEF:MOD" . $count . "=DS" . $count . ",8,* ";
|
||||
$rrd_additions .= " AREA:MOD" . $count . "#" . $color . ":'" . str_pad(substr($components[$id]['label'],0,15),15) . "'" . $stack;
|
||||
$rrd_additions .= " GPRINT:MOD" . $count . ":LAST:%6.2lf%s ";
|
||||
$rrd_additions .= " GPRINT:MOD" . $count . ":AVERAGE:%6.2lf%s ";
|
||||
$rrd_additions .= " GPRINT:MOD" . $count . ":MAX:%6.2lf%s\\\l ";
|
||||
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($rrd_additions == "") {
|
||||
// We didn't add any data points.
|
||||
}
|
||||
else {
|
||||
$rrd_options .= $rrd_additions;
|
||||
}
|
75
html/includes/graphs/port/cbqos_qosdrops.inc.php
Normal file
75
html/includes/graphs/port/cbqos_qosdrops.inc.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS module to display Cisco Class-Based QoS Details
|
||||
*
|
||||
* Copyright (c) 2015 Aaron Daniels <aaron@daniels.id.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.
|
||||
*/
|
||||
|
||||
require_once "../includes/component.php";
|
||||
$component = new component();
|
||||
$options['filter']['type'] = array('=','Cisco-CBQOS');
|
||||
$components = $component->getComponents($device['device_id'],$options);
|
||||
|
||||
// We only care about our device id.
|
||||
$components = $components[$device['device_id']];
|
||||
|
||||
// Determine a policy to show.
|
||||
if (!isset($vars['policy'])) {
|
||||
foreach ($components as $id => $array) {
|
||||
if ( ($array['qos-type'] == 1) && ($array['ifindex'] == $port['ifIndex']) && ($array['parent'] == 0) ) {
|
||||
// Found the first policy
|
||||
$vars['policy'] = $id;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
include "includes/graphs/common.inc.php";
|
||||
$rrd_options .= " -l 0 -E ";
|
||||
$rrd_options .= " COMMENT:'Class-Map Now Avg Max\\n'";
|
||||
$rrd_additions = "";
|
||||
|
||||
$count = 0;
|
||||
foreach ($components as $id => $array) {
|
||||
if ( ($array['qos-type'] == 2) && ($array['parent'] == $components[$vars['policy']]['sp-obj']) && ($array['sp-id'] == $components[$vars['policy']]['sp-id'])) {
|
||||
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename("port-".$array['ifindex']."-cbqos-".$array['sp-id']."-".$array['sp-obj'].".rrd");
|
||||
|
||||
if (file_exists($rrd_filename)) {
|
||||
// Stack the area on the second and subsequent DS's
|
||||
$stack = "";
|
||||
if ($count != 0) {
|
||||
$stack = ":STACK ";
|
||||
}
|
||||
|
||||
// Grab a color from the array.
|
||||
if ( isset($config['graph_colours']['mixed'][$count]) ) {
|
||||
$color = $config['graph_colours']['mixed'][$count];
|
||||
}
|
||||
else {
|
||||
$color = $config['graph_colours']['oranges'][$count-7];
|
||||
}
|
||||
|
||||
$rrd_additions .= " DEF:DS" . $count . "=" . $rrd_filename . ":qosdrops:AVERAGE ";
|
||||
$rrd_additions .= " CDEF:MOD" . $count . "=DS" . $count . ",8,* ";
|
||||
$rrd_additions .= " AREA:MOD" . $count . "#" . $color . ":'" . str_pad(substr($components[$id]['label'],0,15),15) . "'" . $stack;
|
||||
$rrd_additions .= " GPRINT:MOD" . $count . ":LAST:%6.2lf%s ";
|
||||
$rrd_additions .= " GPRINT:MOD" . $count . ":AVERAGE:%6.2lf%s ";
|
||||
$rrd_additions .= " GPRINT:MOD" . $count . ":MAX:%6.2lf%s\\\l ";
|
||||
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($rrd_additions == "") {
|
||||
// We didn't add any data points.
|
||||
}
|
||||
else {
|
||||
$rrd_options .= $rrd_additions;
|
||||
}
|
75
html/includes/graphs/port/cbqos_traffic.inc.php
Normal file
75
html/includes/graphs/port/cbqos_traffic.inc.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS module to display Cisco Class-Based QoS Details
|
||||
*
|
||||
* Copyright (c) 2015 Aaron Daniels <aaron@daniels.id.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.
|
||||
*/
|
||||
|
||||
require_once "../includes/component.php";
|
||||
$component = new component();
|
||||
$options['filter']['type'] = array('=','Cisco-CBQOS');
|
||||
$components = $component->getComponents($device['device_id'],$options);
|
||||
|
||||
// We only care about our device id.
|
||||
$components = $components[$device['device_id']];
|
||||
|
||||
// Determine a policy to show.
|
||||
if (!isset($vars['policy'])) {
|
||||
foreach ($components as $id => $array) {
|
||||
if ( ($array['qos-type'] == 1) && ($array['ifindex'] == $port['ifIndex']) && ($array['parent'] == 0) ) {
|
||||
// Found the first policy
|
||||
$vars['policy'] = $id;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
include "includes/graphs/common.inc.php";
|
||||
$rrd_options .= " -l 0 -E ";
|
||||
$rrd_options .= " COMMENT:'Class-Map Now Avg Max\\n'";
|
||||
$rrd_additions = "";
|
||||
|
||||
$count = 0;
|
||||
foreach ($components as $id => $array) {
|
||||
if ( ($array['qos-type'] == 2) && ($array['parent'] == $components[$vars['policy']]['sp-obj']) && ($array['sp-id'] == $components[$vars['policy']]['sp-id'])) {
|
||||
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename("port-".$array['ifindex']."-cbqos-".$array['sp-id']."-".$array['sp-obj'].".rrd");
|
||||
|
||||
if (file_exists($rrd_filename)) {
|
||||
// Stack the area on the second and subsequent DS's
|
||||
$stack = "";
|
||||
if ($count != 0) {
|
||||
$stack = ":STACK ";
|
||||
}
|
||||
|
||||
// Grab a color from the array.
|
||||
if ( isset($config['graph_colours']['mixed'][$count]) ) {
|
||||
$color = $config['graph_colours']['mixed'][$count];
|
||||
}
|
||||
else {
|
||||
$color = $config['graph_colours']['oranges'][$count-7];
|
||||
}
|
||||
|
||||
$rrd_additions .= " DEF:DS" . $count . "=" . $rrd_filename . ":postbits:AVERAGE ";
|
||||
$rrd_additions .= " CDEF:MOD" . $count . "=DS" . $count . ",8,* ";
|
||||
$rrd_additions .= " AREA:MOD" . $count . "#" . $color . ":'" . str_pad(substr($components[$id]['label'],0,15),15) . "'" . $stack;
|
||||
$rrd_additions .= " GPRINT:MOD" . $count . ":LAST:%6.2lf%s ";
|
||||
$rrd_additions .= " GPRINT:MOD" . $count . ":AVERAGE:%6.2lf%s ";
|
||||
$rrd_additions .= " GPRINT:MOD" . $count . ":MAX:%6.2lf%s\\\l ";
|
||||
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($rrd_additions == "") {
|
||||
// We didn't add any data points.
|
||||
}
|
||||
else {
|
||||
$rrd_options .= $rrd_additions;
|
||||
}
|
@@ -18,7 +18,7 @@ $oids = array(
|
||||
);
|
||||
|
||||
$i = 0;
|
||||
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename('port-'.$port['ifIndex'].'-dot3.rrd');
|
||||
$rrd_filename = get_port_rrdfile_path ($device['hostname'], $port['port_id'], 'dot3');
|
||||
|
||||
if (is_file($rrd_filename)) {
|
||||
foreach ($oids as $oid) {
|
||||
|
@@ -1,15 +1,17 @@
|
||||
<?php
|
||||
|
||||
$rrd_file = get_port_rrdfile_path ($device['hostname'], $port['port_id']);
|
||||
|
||||
// FIXME uhh..
|
||||
if (1) {
|
||||
// $rrd_list[1]['filename'] = $config['rrd_dir'] . "/" . $device['hostname'] . "/port-" . safename($port['ifIndex'] . ".rrd");
|
||||
// $rrd_list[1]['filename'] = $rrd_file;
|
||||
// $rrd_list[1]['descr'] = $int['ifDescr'];
|
||||
// $rrd_list[1]['ds_in'] = "INNUCASTPKTS";
|
||||
// $rrd_list[1]['ds_out'] = "OUTNUCASTPKTS";
|
||||
// $rrd_list[1]['descr'] = "NonUnicast";
|
||||
// $rrd_list[1]['colour_area_in'] = "BB77BB";
|
||||
// $rrd_list[1]['colour_area_out'] = "FFDD88";
|
||||
$rrd_list[2]['filename'] = $config['rrd_dir'].'/'.$device['hostname'].'/port-'.safename($port['ifIndex'].'.rrd');
|
||||
$rrd_list[2]['filename'] = $rrd_file;
|
||||
$rrd_list[2]['descr'] = $int['ifDescr'];
|
||||
$rrd_list[2]['ds_in'] = 'INBROADCASTPKTS';
|
||||
$rrd_list[2]['ds_out'] = 'OUTBROADCASTPKTS';
|
||||
@@ -17,7 +19,7 @@ if (1) {
|
||||
$rrd_list[2]['colour_area_in'] = 'aa37BB';
|
||||
$rrd_list[2]['colour_area_out'] = 'ee9D88';
|
||||
|
||||
$rrd_list[4]['filename'] = $config['rrd_dir'].'/'.$device['hostname'].'/port-'.safename($port['ifIndex'].'.rrd');
|
||||
$rrd_list[4]['filename'] = $rrd_file;
|
||||
$rrd_list[4]['descr'] = $int['ifDescr'];
|
||||
$rrd_list[4]['ds_in'] = 'INMULTICASTPKTS';
|
||||
$rrd_list[4]['ds_out'] = 'OUTMULTICASTPKTS';
|
||||
@@ -36,8 +38,8 @@ if (1) {
|
||||
|
||||
include 'includes/graphs/generic_multi_seperated.inc.php';
|
||||
}
|
||||
else if (is_file($config['rrd_dir'].'/'.$device['hostname'].'/'.safename($port['ifIndex'].'.rrd'))) {
|
||||
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename($port['ifIndex'].'.rrd');
|
||||
else if (is_file($rrd_file)) {
|
||||
$rrd_filename = $rrd_file;
|
||||
|
||||
$ds_in = 'INNUCASTPKTS';
|
||||
$ds_out = 'OUTNUCASTPKTS';
|
||||
|
@@ -3,8 +3,9 @@
|
||||
// Generate a list of ports and then call the multi_bits grapher to generate from the list
|
||||
$i = 0;
|
||||
foreach (dbFetchRows('SELECT * FROM `ports` WHERE `device_id` = ? AND `pagpGroupIfIndex` = ?', array($port['device_id'], $port['ifIndex'])) as $int) {
|
||||
if (is_file($config['rrd_dir'].'/'.$hostname.'/port-'.safename($int['ifIndex'].'.rrd'))) {
|
||||
$rrd_list[$i]['filename'] = $config['rrd_dir'].'/'.$hostname.'/port-'.safename($int['ifIndex'].'.rrd');
|
||||
$rrd_file = get_port_rrdfile_path ($hostname, int['port_id']);
|
||||
if (is_file($rrd_file)) {
|
||||
$rrd_list[$i]['filename'] = $rrd_file;
|
||||
$rrd_list[$i]['descr'] = $int['ifDescr'];
|
||||
$i++;
|
||||
}
|
||||
|
@@ -53,7 +53,7 @@ if (isset($_POST['create-default'])) {
|
||||
);
|
||||
$default_rules[] = array(
|
||||
'device_id' => '-1',
|
||||
'rule' => '%macros.port_usage_perc >= "80"',
|
||||
'rule' => '%macros.port_usage_perc >= "80" && %macros.port_up = "1" && %macros.port = "1"',
|
||||
'severity' => 'critical',
|
||||
'extra' => '{"mute":false,"count":"-1","delay":"300"}',
|
||||
'disabled' => 0,
|
||||
@@ -61,7 +61,7 @@ if (isset($_POST['create-default'])) {
|
||||
);
|
||||
$default_rules[] = array(
|
||||
'device_id' => '-1',
|
||||
'rule' => '%sensors.sensor_current > %sensors.sensor_limit',
|
||||
'rule' => '%sensors.sensor_current > %sensors.sensor_limit && %sensors.sensor_alert = "1"',
|
||||
'severity' => 'critical',
|
||||
'extra' => '{"mute":false,"count":"-1","delay":"300"}',
|
||||
'disabled' => 0,
|
||||
@@ -69,7 +69,7 @@ if (isset($_POST['create-default'])) {
|
||||
);
|
||||
$default_rules[] = array(
|
||||
'device_id' => '-1',
|
||||
'rule' => '%sensors.sensor_current < %sensors.sensor_limit_low',
|
||||
'rule' => '%sensors.sensor_current < %sensors.sensor_limit_low && %sensors.sensor_alert = "1"',
|
||||
'severity' => 'critical',
|
||||
'extra' => '{"mute":false,"count":"-1","delay":"300"}',
|
||||
'disabled' => 0,
|
||||
|
@@ -338,10 +338,10 @@ echo '</td></tr>';
|
||||
|
||||
// If we're showing graphs, generate the graph and print the img tags
|
||||
if ($graph_type == 'etherlike') {
|
||||
$graph_file = $config['rrd_dir'].'/'.$device['hostname'].'/port-'.safename($port['ifIndex']).'-dot3.rrd';
|
||||
$graph_file = get_port_rrdfile_path ($device['hostname'], $if_id, 'dot3');
|
||||
}
|
||||
else {
|
||||
$graph_file = $config['rrd_dir'].'/'.$device['hostname'].'/port-'.safename($port['ifIndex']).'.rrd';
|
||||
$graph_file = get_port_rrdfile_path ($device['hostname'], $if_id);
|
||||
}
|
||||
|
||||
if ($graph_type && is_file($graph_file)) {
|
||||
|
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
echo '<table class="table table-condensed table-striped table-hover">';
|
||||
$stp_raw = dbFetchRow('SELECT * FROM `stp` WHERE `device_id` = ?', array($device['device_id']));
|
||||
$stp = array (
|
||||
'Root bridge' => ($stp_raw['rootBridge'] == 1) ? 'Yes' : 'No',
|
||||
@@ -22,8 +23,9 @@ $stp = array (
|
||||
foreach (array_keys($stp) as $key) {
|
||||
echo "
|
||||
<tr>
|
||||
<td width=280 class=list-large>$key</td>
|
||||
<td class=box-desc>$stp[$key]</td>
|
||||
<td>$key</td>
|
||||
<td>$stp[$key]</td>
|
||||
</tr>
|
||||
";
|
||||
}
|
||||
echo '</table>';
|
||||
|
57
html/includes/table/stp-ports.inc.php
Normal file
57
html/includes/table/stp-ports.inc.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
$device_id = mres($_POST['device_id']);
|
||||
|
||||
$param[] = $device_id;
|
||||
|
||||
$sql = " FROM `ports_stp` `ps` JOIN `ports` `p` ON `ps`.`port_id`=`p`.`port_id` WHERE `ps`.`device_id` = ?";
|
||||
|
||||
$count_sql = "SELECT COUNT(*) $sql";
|
||||
$total = dbFetchCell($count_sql, $param);
|
||||
if (empty($total)) {
|
||||
$total = 0;
|
||||
}
|
||||
|
||||
if (!isset($sort) || empty($sort)) {
|
||||
$sort = 'port_id DESC';
|
||||
}
|
||||
|
||||
$sql .= " ORDER BY ps.$sort";
|
||||
|
||||
if (isset($current)) {
|
||||
$limit_low = (($current * $rowCount) - ($rowCount));
|
||||
$limit_high = $rowCount;
|
||||
}
|
||||
|
||||
if ($rowCount != -1) {
|
||||
$sql .= " LIMIT $limit_low,$limit_high";
|
||||
}
|
||||
|
||||
$sql = "SELECT `ps`.*, `p`.* $sql";
|
||||
|
||||
foreach (dbFetchRows($sql, array($device_id)) as $stp_ports_db) {
|
||||
|
||||
$bridge_device = dbFetchRow("SELECT `devices`.*, `stp`.`device_id`, `stp`.`bridgeAddress` FROM `devices` JOIN `stp` ON `devices`.`device_id`=`stp`.`device_id` WHERE `stp`.`bridgeAddress` = ?", array($stp_ports_db['designatedBridge']));
|
||||
$root_device = dbFetchRow("SELECT `devices`.*, `stp`.`device_id`, `stp`.`bridgeAddress` FROM `devices` JOIN `stp` ON `devices`.`device_id`=`stp`.`device_id` WHERE `stp`.`bridgeAddress` = ?", array($stp_ports_db['designatedRoot']));
|
||||
|
||||
$response[] = array (
|
||||
'port_id' => generate_port_link($stp_ports_db, $stp_ports_db['ifName'])."<br>".$stp_ports_db['ifAlias'],
|
||||
'priority' => $stp_ports_db['priority'],
|
||||
'state' => $stp_ports_db['state'],
|
||||
'enable' => $stp_ports_db['enable'],
|
||||
'pathCost' => $stp_ports_db['pathCost'],
|
||||
'designatedRoot' => generate_device_link($root_device, $root_device['hostname'])."<br>".$stp_ports_db['designatedRoot'],
|
||||
'designatedCost' => $stp_ports_db['designatedCost'],
|
||||
'designatedBridge' => generate_device_link($bridge_device, $bridge_device['hostname'])."<br>".$stp_ports_db['designatedBridge'],
|
||||
'designatedPort' => $stp_ports_db['designatedPort'],
|
||||
'forwardTransitions' => $stp_ports_db['forwardTransitions']
|
||||
);
|
||||
}
|
||||
|
||||
$output = array(
|
||||
'current' => $current,
|
||||
'rowCount' => $rowCount,
|
||||
'rows' => $response,
|
||||
'total' => $total,
|
||||
);
|
||||
echo _json_encode($output);
|
@@ -65,7 +65,8 @@ if ($_POST['hostname']) {
|
||||
$force_add = 0;
|
||||
}
|
||||
|
||||
$result = addHost($hostname, $snmpver, $port, $transport, 0, $poller_group, $force_add);
|
||||
$port_assoc_mode = $_POST['port_assoc_mode'];
|
||||
$result = addHost($hostname, $snmpver, $port, $transport, 0, $poller_group, $force_add, $port_assoc_mode);
|
||||
if ($result) {
|
||||
print_message("Device added ($result)");
|
||||
}
|
||||
@@ -120,6 +121,24 @@ foreach ($config['snmp']['transports'] as $transport) {
|
||||
|
||||
echo '>'.$transport.'</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="port_association_mode" class="col-sm-3 control-label">Port Association Mode</label>
|
||||
<div class="col-sm-3">
|
||||
<select name="port_assoc_mode" id="port_assoc_mode" class="form-control input-sm">
|
||||
<?php
|
||||
|
||||
|
||||
foreach (get_port_assoc_modes() as $mode) {
|
||||
$selected = "";
|
||||
if ($mode == $config['default_port_association_mode'])
|
||||
$selected = "selected";
|
||||
|
||||
echo " <option value=\"$mode\" $selected>$mode</option>\n";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
@@ -17,6 +17,8 @@ foreach ($graphs as $key => $text) {
|
||||
|
||||
if ($key == "ceph_poolstats") {
|
||||
foreach (glob($rrddir."/app-ceph-".$app['app_id']."-pool-*") as $rrd_filename) {
|
||||
$graph_array['to'] = $config['time']['now'];
|
||||
$graph_array['id'] = $app['app_id'];
|
||||
if (preg_match("/.*-pool-(.+)\.rrd$/", $rrd_filename, $pools)) {
|
||||
$pool = $pools[1];
|
||||
echo '<h3>'.$pool.' Reads/Writes</h3>';
|
||||
@@ -39,6 +41,8 @@ foreach ($graphs as $key => $text) {
|
||||
}
|
||||
elseif ($key == "ceph_osdperf") {
|
||||
foreach (glob($rrddir."/app-ceph-".$app['app_id']."-osd-*") as $rrd_filename) {
|
||||
$graph_array['to'] = $config['time']['now'];
|
||||
$graph_array['id'] = $app['app_id'];
|
||||
if (preg_match("/.*-osd-(.+)\.rrd$/", $rrd_filename, $osds)) {
|
||||
$osd = $osds[1];
|
||||
echo '<h3>'.$osd.' Latency</h3>';
|
||||
@@ -57,6 +61,8 @@ foreach ($graphs as $key => $text) {
|
||||
$pool = $pools[1];
|
||||
if ($pool == "c") {
|
||||
echo '<h3>Cluster Usage</h3>';
|
||||
$graph_array['to'] = $config['time']['now'];
|
||||
$graph_array['id'] = $app['app_id'];
|
||||
$graph_array['type'] = 'application_ceph_pool_df';
|
||||
$graph_array['pool'] = $pool;
|
||||
|
||||
@@ -66,6 +72,8 @@ foreach ($graphs as $key => $text) {
|
||||
}
|
||||
else {
|
||||
echo '<h3>'.$pool.' Usage</h3>';
|
||||
$graph_array['to'] = $config['time']['now'];
|
||||
$graph_array['id'] = $app['app_id'];
|
||||
$graph_array['type'] = 'application_ceph_pool_df';
|
||||
$graph_array['pool'] = $pool;
|
||||
|
||||
@@ -74,6 +82,8 @@ foreach ($graphs as $key => $text) {
|
||||
echo '</td></tr>';
|
||||
|
||||
echo '<h3>'.$pool.' Objects</h3>';
|
||||
$graph_array['to'] = $config['time']['now'];
|
||||
$graph_array['id'] = $app['app_id'];
|
||||
$graph_array['type'] = 'application_ceph_pool_objects';
|
||||
$graph_array['pool'] = $pool;
|
||||
|
||||
|
@@ -9,6 +9,7 @@ if ($_POST['editing']) {
|
||||
$timeout = mres($_POST['timeout']);
|
||||
$retries = mres($_POST['retries']);
|
||||
$poller_group = mres($_POST['poller_group']);
|
||||
$port_assoc_mode = mres($_POST['port_assoc_mode']);
|
||||
$v3 = array(
|
||||
'authlevel' => mres($_POST['authlevel']),
|
||||
'authname' => mres($_POST['authname']),
|
||||
@@ -25,6 +26,7 @@ if ($_POST['editing']) {
|
||||
'port' => $port,
|
||||
'transport' => $transport,
|
||||
'poller_group' => $poller_group,
|
||||
'port_association_mode' => $port_assoc_mode,
|
||||
);
|
||||
|
||||
if ($_POST['timeout']) {
|
||||
@@ -43,7 +45,7 @@ if ($_POST['editing']) {
|
||||
|
||||
$update = array_merge($update, $v3);
|
||||
|
||||
$device_tmp = deviceArray($device['hostname'], $community, $snmpver, $port, $transport, $v3);
|
||||
$device_tmp = deviceArray($device['hostname'], $community, $snmpver, $port, $transport, $v3, $port_assoc_mode);
|
||||
if (isSNMPable($device_tmp)) {
|
||||
$rows_updated = dbUpdate($update, 'devices', '`device_id` = ?', array($device['device_id']));
|
||||
|
||||
@@ -116,6 +118,25 @@ echo " </select>
|
||||
<input id='retries' name='retries' class='form-control input-sm' value='".($device['timeout'] ? $device['retries'] : '')."' placeholder='retries' />
|
||||
</div>
|
||||
</div>
|
||||
<div class='form-group'>
|
||||
<label for='port_assoc_mode' class='col-sm-2 control-label'>Port Association Mode</label>
|
||||
<div class='col-sm-1'>
|
||||
<select name='port_assoc_mode' id='port_assoc_mode' class='form-control input-sm'>
|
||||
";
|
||||
|
||||
foreach (get_port_assoc_modes() as $pam) {
|
||||
$pam_id = get_port_assoc_mode_id ($pam);
|
||||
echo " <option value='$pam_id'";
|
||||
|
||||
if ($pam_id == $device['port_association_mode'])
|
||||
echo " selected='selected'";
|
||||
|
||||
echo ">$pam</option>\n";
|
||||
}
|
||||
|
||||
echo " </select>
|
||||
</div>
|
||||
</div>
|
||||
<div id='snmpv1_2'>
|
||||
<div class='form-group'>
|
||||
<label class='col-sm-3 control-label text-left'><h4><strong>SNMPv1/v2c Configuration</strong></h4></label>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
$sensors = dbFetchRows('SELECT * FROM `sensors` WHERE `sensor_class` = ? AND device_id = ? ORDER BY `poller_type`, `sensor_index`', array($sensor_class, $device['device_id']));
|
||||
$sensors = dbFetchRows('SELECT * FROM `sensors` WHERE `sensor_class` = ? AND device_id = ? ORDER BY `poller_type`, `sensor_oid`, `sensor_index`', array($sensor_class, $device['device_id']));
|
||||
|
||||
if (count($sensors)) {
|
||||
echo '<div class="container-fluid ">
|
||||
|
@@ -87,6 +87,12 @@ if (dbFetchCell("SELECT COUNT(*) FROM `ports_vlans` WHERE `port_id` = '".$port['
|
||||
$menu_options['vlans'] = 'VLANs';
|
||||
}
|
||||
|
||||
// Are there any CBQoS rrd's for this ifIndex?
|
||||
$cbqos = glob($config['rrd_dir'].'/'.$device['hostname'].'/port-'.$port['ifIndex'].'-cbqos-*.rrd');
|
||||
if (!empty($cbqos)) {
|
||||
$menu_options['cbqos'] = 'CBQoS';
|
||||
}
|
||||
|
||||
$sep = '';
|
||||
foreach ($menu_options as $option => $text) {
|
||||
echo $sep;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
if (file_exists($config['rrd_dir'].'/'.$device['hostname'].'/port-'.$port['ifIndex'].'-adsl.rrd')) {
|
||||
if (file_exists(get_port_rrdfile_path ($device['hostname'], $port['port_id'], 'adsl'))) {
|
||||
$iid = $id;
|
||||
echo '<div class=graphhead>ADSL Line Speed</div>';
|
||||
$graph_type = 'port_adsl_speed';
|
||||
|
130
html/pages/device/port/cbqos.inc.php
Normal file
130
html/pages/device/port/cbqos.inc.php
Normal file
@@ -0,0 +1,130 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS module to display Cisco Class-Based QoS Details
|
||||
*
|
||||
* Copyright (c) 2015 Aaron Daniels <aaron@daniels.id.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.
|
||||
*/
|
||||
|
||||
function find_child($components,$parent,$level) {
|
||||
global $vars;
|
||||
|
||||
foreach($components as $id => $array) {
|
||||
if ($array['qos-type'] == 3) {
|
||||
continue;
|
||||
}
|
||||
if (($array['parent'] == $components[$parent]['sp-obj']) && ($array['sp-id'] == $components[$parent]['sp-id'])) {
|
||||
echo "<ul>";
|
||||
echo "<li>";
|
||||
if ($array['qos-type'] == 1) {
|
||||
// Its a policy, we need to make it a link.
|
||||
echo('<a href="' . generate_url($vars, array('policy' => $id)) . '">' . $array['label'] . '</a>');
|
||||
}
|
||||
else {
|
||||
// No policy, no link
|
||||
echo $array['label'];
|
||||
}
|
||||
if (isset($array['match'])) {
|
||||
echo ' ('.$array['match'].')';
|
||||
}
|
||||
|
||||
find_child($components,$id,$level+1);
|
||||
|
||||
echo "</li>";
|
||||
echo "</ul>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$rrdarr = glob($config['rrd_dir'].'/'.$device['hostname'].'/port-'.$port['ifIndex'].'-cbqos-*.rrd');
|
||||
if (!empty($rrdarr)) {
|
||||
require_once "../includes/component.php";
|
||||
$component = new component();
|
||||
$options['filter']['type'] = array('=','Cisco-CBQOS');
|
||||
$components = $component->getComponents($device['device_id'],$options);
|
||||
|
||||
// We only care about our device id.
|
||||
$components = $components[$device['device_id']];
|
||||
|
||||
if (!isset($vars['policy'])) {
|
||||
// not set, find the first parent and use it.
|
||||
foreach ($components as $id => $array) {
|
||||
if ( ($array['qos-type'] == 1) && ($array['ifindex'] == $port['ifIndex']) && ($array['parent'] == 0) ) {
|
||||
// Found the first policy
|
||||
$vars['policy'] = $id;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
echo "\n\n";
|
||||
|
||||
// Display the ingress policy at the top of the page.
|
||||
echo "<div class='col-md-6'><ul class='mktree' id='ingress'>";
|
||||
echo '<div><strong><i class="fa fa-sign-in"></i> Ingress Policy:</strong></div>';
|
||||
$found = false;
|
||||
foreach ($components as $id => $array) {
|
||||
if ( ($array['qos-type'] == 1) && ($array['ifindex'] == $port['ifIndex']) && ($array['direction'] == 1) && ($array['parent'] == 0) ) {
|
||||
echo "<li class='liOpen'>";
|
||||
echo('<a href="' . generate_url($vars, array('policy' => $id)) . '">' . $array['label'] . '</a>');
|
||||
find_child($components,$id,1);
|
||||
echo "</li>";
|
||||
$found = true;
|
||||
}
|
||||
}
|
||||
if (!$found) {
|
||||
// No Ingress policies
|
||||
echo '<div><i>No Policies</i></div>';
|
||||
}
|
||||
echo '</ul></div>';
|
||||
|
||||
// Display the egress policy at the top of the page.
|
||||
echo "<div class='col-md-6'><ul class='mktree' id='egress'>";
|
||||
echo '<div><strong><i class="fa fa-sign-out"></i> Egress Policy:</strong></div>';
|
||||
$found = false;
|
||||
foreach ($components as $id => $array) {
|
||||
if ( ($array['qos-type'] == 1) && ($array['ifindex'] == $port['ifIndex']) && ($array['direction'] == 2) && ($array['parent'] == 0) ) {
|
||||
echo "<li class='liOpen'>";
|
||||
echo('<a href="' . generate_url($vars, array('policy' => $id)) . '">' . $array['label'] . '</a>');
|
||||
find_child($components,$id,1);
|
||||
echo "</li>";
|
||||
$found = true;
|
||||
}
|
||||
}
|
||||
if (!$found) {
|
||||
// No Egress policies
|
||||
echo '<div><i>No Policies</i></div>';
|
||||
}
|
||||
echo "</ul></div>\n\n";
|
||||
|
||||
// Let's make sure the policy we are trying to access actually exists.
|
||||
foreach ($components as $id => $array) {
|
||||
if ( ($array['qos-type'] == 1) && ($array['ifindex'] == $port['ifIndex']) && ($id == $vars['policy']) ) {
|
||||
// The policy exists.
|
||||
|
||||
echo "<div class='col-md-12'> </div>\n\n";
|
||||
|
||||
// Display each graph row.
|
||||
echo "<div class='col-md-12'>";
|
||||
echo "<div class='graphhead'>Traffic by CBQoS Class - ".$components[$vars['policy']]['label']."</div>";
|
||||
$graph_array['policy'] = $vars['policy'];
|
||||
$graph_type = 'port_cbqos_traffic';
|
||||
include 'includes/print-interface-graphs.inc.php';
|
||||
|
||||
echo "<div class='graphhead'>QoS Drops by CBQoS Class - ".$components[$vars['policy']]['label']."</div>";
|
||||
$graph_array['policy'] = $vars['policy'];
|
||||
$graph_type = 'port_cbqos_bufferdrops';
|
||||
include 'includes/print-interface-graphs.inc.php';
|
||||
|
||||
echo "<div class='graphhead'>Buffer Drops by CBQoS Class - ".$components[$vars['policy']]['label']."</div>";
|
||||
$graph_array['policy'] = $vars['policy'];
|
||||
$graph_type = 'port_cbqos_qosdrops';
|
||||
include 'includes/print-interface-graphs.inc.php';
|
||||
echo "</div>\n\n";
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
if (file_exists($config['rrd_dir'].'/'.$device['hostname'].'/port-'.$port['ifIndex'].'.rrd')) {
|
||||
if (file_exists(get_port_rrdfile_path ($device['hostname'], $port['port_id']))) {
|
||||
$iid = $id;
|
||||
echo '<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
@@ -41,7 +41,7 @@ if (file_exists($config['rrd_dir'].'/'.$device['hostname'].'/port-'.$port['ifInd
|
||||
include 'includes/print-interface-graphs.inc.php';
|
||||
echo '</div></div>';
|
||||
|
||||
if (is_file($config['rrd_dir'].'/'.$device['hostname'].'/port-'.$port['ifIndex'].'-dot3.rrd')) {
|
||||
if (is_file(get_port_rrdfile_path ($device['hostname'], $port['port_id'], 'dot3'))) {
|
||||
echo '<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Ethernet Errors</h3>
|
||||
|
@@ -15,7 +15,7 @@ if (!$vars['view']) {
|
||||
}
|
||||
|
||||
$menu_options['basic'] = 'Basic';
|
||||
// $menu_options['details'] = 'Details';
|
||||
$menu_options['ports'] = 'Ports';
|
||||
$sep = '';
|
||||
foreach ($menu_options as $option => $text) {
|
||||
echo $sep;
|
||||
@@ -35,16 +35,13 @@ unset($sep);
|
||||
|
||||
print_optionbar_end();
|
||||
|
||||
echo '<table border="0" cellspacing="0" cellpadding="5" width="100%">';
|
||||
|
||||
$i = '1';
|
||||
|
||||
foreach (dbFetchRows("SELECT * FROM `stp` WHERE `device_id` = ? ORDER BY 'stp_id'", array($device['device_id'])) as $stp) {
|
||||
if ($vars['view'] == 'basic') {
|
||||
include 'includes/print-stp.inc.php';
|
||||
}
|
||||
|
||||
$i++;
|
||||
if ($vars['view'] == 'ports') {
|
||||
include 'includes/common/stp-ports.inc.php';
|
||||
echo implode('',$common_output);
|
||||
}
|
||||
|
||||
echo '</table>';
|
||||
|
||||
$pagetitle[] = 'STP';
|
||||
|
@@ -94,7 +94,7 @@ if ($if_list) {
|
||||
|
||||
echo '<br />';
|
||||
|
||||
if (file_exists($config['rrd_dir'].'/'.$port['hostname'].'/port-'.$port['ifIndex'].'.rrd')) {
|
||||
if (file_exists(get_port_rrdfile_path ($port['hostname'], $port['port_id']))) {
|
||||
$graph_type = 'port_bits';
|
||||
|
||||
include 'includes/print-interface-graphs.inc.php';
|
||||
|
@@ -114,7 +114,7 @@ function delete_port($int_id) {
|
||||
dbDelete('links', "`remote_port_id` = ?", array($int_id));
|
||||
dbDelete('bill_ports', "`port_id` = ?", array($int_id));
|
||||
|
||||
unlink(trim($config['rrd_dir'])."/".trim($interface['hostname'])."/port-".$interface['ifIndex'].".rrd");
|
||||
unlink(get_port_rrdfile_path ($interface['hostname'], $interface['port_id']));
|
||||
}
|
||||
|
||||
function sgn($int) {
|
||||
@@ -143,6 +143,15 @@ function get_sensor_rrd($device, $sensor) {
|
||||
return($rrd_file);
|
||||
}
|
||||
|
||||
function get_port_rrdfile_path ($hostname, $port_id, $suffix = '') {
|
||||
global $config;
|
||||
|
||||
if (! empty ($suffix))
|
||||
$suffix = '-' . $suffix;
|
||||
|
||||
return trim ($config['rrd_dir']) . '/' . safename ($hostname) . '/' . 'port-id' . safename($port_id) . safename ($suffix) . '.rrd';
|
||||
}
|
||||
|
||||
function get_port_by_index_cache($device_id, $ifIndex) {
|
||||
global $port_index_cache;
|
||||
|
||||
@@ -1103,3 +1112,155 @@ function ip_to_sysname($device,$ip) {
|
||||
}
|
||||
return $ip;
|
||||
}//end ip_to_sysname
|
||||
|
||||
/**
|
||||
* Return valid port association modes
|
||||
* @param bool $no_cache No-Cache flag (optional, default false)
|
||||
* @return array
|
||||
*/
|
||||
function get_port_assoc_modes ($no_cache = false) {
|
||||
global $config;
|
||||
|
||||
if ($config['memcached']['enable'] && $no_cache === false) {
|
||||
$assoc_modes = $config['memcached']['resource']->get (hash ('sha512', "port_assoc_modes"));
|
||||
if (! empty ($assoc_modes))
|
||||
return $assoc_modes;
|
||||
}
|
||||
|
||||
$assoc_modes = Null;
|
||||
foreach (dbFetchRows ("SELECT `name` FROM `port_association_mode` ORDER BY pom_id") as $row)
|
||||
$assoc_modes[] = $row['name'];
|
||||
|
||||
if ($config['memcached']['enable'] && $no_cache === false)
|
||||
$config['memcached']['resource']->set (hash ('sha512', "port_assoc_modes"), $assoc_modes, $config['memcached']['ttl']);
|
||||
|
||||
return $assoc_modes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate port_association_mode
|
||||
* @param string $port_assoc_mode
|
||||
* @return bool
|
||||
*/
|
||||
function is_valid_port_assoc_mode ($port_assoc_mode) {
|
||||
return in_array ($port_assoc_mode, get_port_assoc_modes ());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get DB id of given port association mode name
|
||||
* @param string $port_assoc_mode
|
||||
* @param bool $no_cache No-Cache flag (optional, default false)
|
||||
*/
|
||||
function get_port_assoc_mode_id ($port_assoc_mode, $no_cache = false) {
|
||||
global $config;
|
||||
|
||||
if ($config['memcached']['enable'] && $no_cache === false) {
|
||||
$id = $config['memcached']['resource']->get (hash ('sha512', "port_assoc_mode_id|$port_assoc_mode"));
|
||||
if (! empty ($id))
|
||||
return $id;
|
||||
}
|
||||
|
||||
$id = Null;
|
||||
$row = dbFetchRow ("SELECT `pom_id` FROM `port_association_mode` WHERE name = ?", array ($port_assoc_mode));
|
||||
if ($row) {
|
||||
$id = $row['pom_id'];
|
||||
if ($config['memcached']['enable'] && $no_cache === false)
|
||||
$config['memcached']['resource']->set (hash ('sha512', "port_assoc_mode_id|$port_assoc_mode"), $id, $config['memcached']['ttl']);
|
||||
}
|
||||
|
||||
return $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name of given port association_mode ID
|
||||
* @param int $port_assoc_mode_id Port association mode ID
|
||||
* @param bool $no_cache No-Cache flag (optional, default false)
|
||||
* @return bool
|
||||
*/
|
||||
function get_port_assoc_mode_name ($port_assoc_mode_id, $no_cache = false) {
|
||||
global $config;
|
||||
|
||||
if ($config['memcached']['enable'] && $no_cache === false) {
|
||||
$name = $config['memcached']['resource']->get (hash ('sha512', "port_assoc_mode_name|$port_assoc_mode_id"));
|
||||
if (! empty ($name))
|
||||
return $name;
|
||||
}
|
||||
|
||||
$name = Null;
|
||||
$row = dbFetchRow ("SELECT `name` FROM `port_association_mode` WHERE pom_id = ?", array ($port_assoc_mode_id));
|
||||
if ($row) {
|
||||
$name = $row['name'];
|
||||
if ($config['memcached']['enable'] && $no_cache === false)
|
||||
$config['memcached']['resource']->set (hash ('sha512', "port_assoc_mode_name|$port_assoc_mode_id"), $name, $config['memcached']['ttl']);
|
||||
}
|
||||
|
||||
return $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Query all ports of the given device (by ID) and build port array and
|
||||
* port association maps for ifIndex, ifName, ifDescr. Query port stats
|
||||
* if told to do so, too.
|
||||
* @param int $device_id ID of device to query ports for
|
||||
* @param bool $with_statistics Query port statistics, too. (optional, default false)
|
||||
* @return array
|
||||
*/
|
||||
function get_ports_mapped ($device_id, $with_statistics = false) {
|
||||
$ports = array();
|
||||
$maps = array(
|
||||
'ifIndex' => array(),
|
||||
'ifName' => array(),
|
||||
'ifDescr' => array(),
|
||||
);
|
||||
|
||||
/* Query all information available for ports for this device ... */
|
||||
$query = 'SELECT * FROM `ports` WHERE `device_id` = ? ORDER BY port_id';
|
||||
if ($with_statistics) {
|
||||
/* ... including any related ports_statistics if requested */
|
||||
$query = 'SELECT *, `ports_statistics`.`port_id` AS `ports_statistics_port_id`, `ports`.`port_id` AS `port_id` FROM `ports` LEFT OUTER JOIN `ports_statistics` ON `ports`.`port_id` = `ports_statistics`.`port_id` WHERE `ports`.`device_id` = ? ORDER BY ports.port_id';
|
||||
}
|
||||
|
||||
// Query known ports in order of discovery to make sure the latest
|
||||
// discoverd/polled port is in the mapping tables.
|
||||
foreach (dbFetchRows ($query, array ($device_id)) as $port) {
|
||||
// Store port information by ports port_id from DB
|
||||
$ports[$port['port_id']] = $port;
|
||||
|
||||
// Build maps from ifIndex, ifName, ifDescr to port_id
|
||||
$maps['ifIndex'][$port['ifIndex']] = $port['port_id'];
|
||||
$maps['ifName'][$port['ifName']] = $port['port_id'];
|
||||
$maps['ifDescr'][$port['ifDescr']] = $port['port_id'];
|
||||
}
|
||||
|
||||
return array(
|
||||
'ports' => $ports,
|
||||
'maps' => $maps,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate port_id of given port using given devices port information and port association mode
|
||||
* @param array $ports_mapped Port information of device queried by get_ports_mapped()
|
||||
* @param array $port Port information as fetched from DB
|
||||
* @param string $port_association_mode Port association mode to use for mapping
|
||||
* @return int port_id (or Null)
|
||||
*/
|
||||
function get_port_id ($ports_mapped, $port, $port_association_mode) {
|
||||
// Get port_id according to port_association_mode used for this device
|
||||
$port_id = Null;
|
||||
|
||||
/*
|
||||
* Information an all ports is available through $ports_mapped['ports']
|
||||
* This might come in handy sometime in the future to add you nifty new
|
||||
* port mapping schema:
|
||||
*
|
||||
* $ports = $ports_mapped['ports'];
|
||||
*/
|
||||
$maps = $ports_mapped['maps'];
|
||||
|
||||
if (in_array ($port_association_mode, array ('ifIndex', 'ifName', 'ifDescr'))) {
|
||||
$port_id = $maps[$port_association_mode][$port[$port_association_mode]];
|
||||
}
|
||||
|
||||
return $port_id;
|
||||
}
|
||||
|
@@ -712,6 +712,7 @@ $config['poller_modules']['applications'] = 1;
|
||||
$config['poller_modules']['cisco-asa-firewall'] = 1;
|
||||
$config['poller_modules']['mib'] = 0;
|
||||
$config['poller_modules']['cisco-voice'] = 1;
|
||||
$config['poller_modules']['cisco-cbqos'] = 1;
|
||||
$config['poller_modules']['stp'] = 1;
|
||||
|
||||
// List of discovery modules. Need to be in this array to be
|
||||
@@ -745,6 +746,7 @@ $config['discovery_modules']['toner'] = 1;
|
||||
$config['discovery_modules']['ucd-diskio'] = 1;
|
||||
$config['discovery_modules']['services'] = 1;
|
||||
$config['discovery_modules']['charge'] = 1;
|
||||
$config['discovery_modules']['cisco-cbqos'] = 0;
|
||||
$config['discovery_modules']['stp'] = 1;
|
||||
|
||||
$config['modules_compat']['rfc1628']['liebert'] = 1;
|
||||
@@ -856,3 +858,6 @@ $config['notifications']['local'] = 'misc/notifications.rs
|
||||
|
||||
// Update channel (Can be 'master' or 'release')
|
||||
$config['update_channel'] = 'master';
|
||||
|
||||
// Default port association mode
|
||||
$config['default_port_association_mode'] = 'ifIndex';
|
||||
|
@@ -1436,6 +1436,14 @@ $config['os'][$os]['icon'] = 'generic';
|
||||
$config['os'][$os]['over'][0]['graph'] = 'device_bits';
|
||||
$config['os'][$os]['over'][0]['text'] = 'Traffic';
|
||||
|
||||
// EATON PDU
|
||||
$os = 'eatonpdu';
|
||||
$config['os'][$os]['text'] = 'Eaton PDU';
|
||||
$config['os'][$os]['type'] = 'power';
|
||||
$config['os'][$os]['icon'] = 'eaton';
|
||||
$config['os'][$os]['over'][0]['graph'] = 'device_current';
|
||||
$config['os'][$os]['over'][0]['text'] = 'Current';
|
||||
|
||||
// Appliances
|
||||
$os = 'fortios';
|
||||
$config['os'][$os]['text'] = 'FortiOS';
|
||||
|
184
includes/discovery/cisco-cbqos.inc.php
Normal file
184
includes/discovery/cisco-cbqos.inc.php
Normal file
@@ -0,0 +1,184 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS module to capture Cisco Class-Based QoS Details
|
||||
*
|
||||
* Copyright (c) 2015 Aaron Daniels <aaron@daniels.id.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.
|
||||
*/
|
||||
|
||||
if ($device['os_group'] == 'cisco') {
|
||||
|
||||
$module = 'Cisco-CBQOS';
|
||||
echo $module.': ';
|
||||
|
||||
require_once 'includes/component.php';
|
||||
$component = new component();
|
||||
$components = $component->getComponents($device['device_id'],array('type'=>$module));
|
||||
|
||||
// We only care about our device id.
|
||||
$components = $components[$device['device_id']];
|
||||
|
||||
|
||||
// Begin our master array, all other values will be processed into this array.
|
||||
$tblCBQOS = array();
|
||||
|
||||
// Let's gather some data..
|
||||
$tblcbQosServicePolicy = snmpwalk_array_num($device, '.1.3.6.1.4.1.9.9.166.1.1');
|
||||
$tblcbQosObjects = snmpwalk_array_num($device, '.1.3.6.1.4.1.9.9.166.1.5', 2);
|
||||
$tblcbQosPolicyMapCfg = snmpwalk_array_num($device, '.1.3.6.1.4.1.9.9.166.1.6');
|
||||
$tblcbQosClassMapCfg = snmpwalk_array_num($device, '.1.3.6.1.4.1.9.9.166.1.7');
|
||||
$tblcbQosMatchStmtCfg = snmpwalk_array_num($device, '.1.3.6.1.4.1.9.9.166.1.8');
|
||||
|
||||
/*
|
||||
* False == no object found - this is not an error, there is no QOS configured
|
||||
* null == timeout or something else that caused an error, there may be QOS configured but we couldn't get it.
|
||||
*/
|
||||
if ( is_null($tblcbQosServicePolicy) || is_null($tblcbQosObjects) || is_null($tblcbQosPolicyMapCfg) || is_null($tblcbQosClassMapCfg) || is_null($tblcbQosMatchStmtCfg) ) {
|
||||
// We have to error here or we will end up deleting all our QoS components.
|
||||
echo "Error\n";
|
||||
}
|
||||
else {
|
||||
// No Error, lets process things.
|
||||
d_echo("QoS Objects Found:\n");
|
||||
|
||||
foreach ($tblcbQosObjects['1.3.6.1.4.1.9.9.166.1.5.1.1.2'] as $spid => $array) {
|
||||
|
||||
foreach ($array as $spobj => $index) {
|
||||
$result = array();
|
||||
|
||||
// Produce a unique reproducible index for this entry.
|
||||
$result['UID'] = hash('crc32', $spid."-".$spobj);
|
||||
|
||||
// Now that we have a valid identifiers, lets add some more data
|
||||
$result['sp-id'] = $spid;
|
||||
$result['sp-obj'] = $spobj;
|
||||
|
||||
// Add the Type, Policy-map, Class-map, etc.
|
||||
$type = $tblcbQosObjects['1.3.6.1.4.1.9.9.166.1.5.1.1.3'][$spid][$spobj];
|
||||
$result['qos-type'] = $type;
|
||||
|
||||
// Add the Parent, this lets us work out our hierarchy for display later.
|
||||
$result['parent'] = $tblcbQosObjects['1.3.6.1.4.1.9.9.166.1.5.1.1.4'][$spid][$spobj];
|
||||
$result['direction'] = $tblcbQosServicePolicy['1.3.6.1.4.1.9.9.166.1.1.1.1.3'][$spid];
|
||||
$result['ifindex'] = $tblcbQosServicePolicy['1.3.6.1.4.1.9.9.166.1.1.1.1.4'][$spid];
|
||||
|
||||
// Gather different data depending on the type.
|
||||
switch ($type) {
|
||||
case 1:
|
||||
// Policy-map, get data from that table.
|
||||
d_echo("\nIndex: ".$index."\n");
|
||||
d_echo(" UID: ".$result['UID']."\n");
|
||||
d_echo(" SPID.SPOBJ: ".$result['sp-id'].".".$result['sp-obj']."\n");
|
||||
d_echo(" If-Index: ".$result['ifindex']."\n");
|
||||
d_echo(" Type: 1 - Policy-Map\n");
|
||||
$result['label'] = $tblcbQosPolicyMapCfg['1.3.6.1.4.1.9.9.166.1.6.1.1.1'][$index];
|
||||
if ($tblcbQosPolicyMapCfg['1.3.6.1.4.1.9.9.166.1.6.1.1.2'][$index] != "") {
|
||||
$result['label'] .= " - ".$tblcbQosPolicyMapCfg['1.3.6.1.4.1.9.9.166.1.6.1.1.2'][$index];
|
||||
}
|
||||
d_echo(" Label: ".$result['label']."\n");
|
||||
break;
|
||||
case 2:
|
||||
// Class-map, get data from that table.
|
||||
d_echo("\nIndex: ".$index."\n");
|
||||
d_echo(" UID: ".$result['UID']."\n");
|
||||
d_echo(" SPID.SPOBJ: ".$result['sp-id'].".".$result['sp-obj']."\n");
|
||||
d_echo(" If-Index: ".$result['ifindex']."\n");
|
||||
d_echo(" Type: 2 - Class-Map\n");
|
||||
$result['label'] = $tblcbQosClassMapCfg['1.3.6.1.4.1.9.9.166.1.7.1.1.1'][$index];
|
||||
if($tblcbQosClassMapCfg['1.3.6.1.4.1.9.9.166.1.7.1.1.2'][$index] != "") {
|
||||
$result['label'] .= " - ".$tblcbQosClassMapCfg['1.3.6.1.4.1.9.9.166.1.7.1.1.2'][$index];
|
||||
}
|
||||
d_echo(" Label: ".$result['label']."\n");
|
||||
if ($tblcbQosClassMapCfg['1.3.6.1.4.1.9.9.166.1.7.1.1.3'][$index] == 2) {
|
||||
$result['map-type'] = 'Match-All';
|
||||
}
|
||||
elseif ($tblcbQosClassMapCfg['1.3.6.1.4.1.9.9.166.1.7.1.1.3'][$index] == 3) {
|
||||
$result['map-type'] = 'Match-Any';
|
||||
}
|
||||
else {
|
||||
$result['map-type'] = 'None';
|
||||
}
|
||||
|
||||
// Find a child, this will be a type 3
|
||||
foreach ($tblcbQosObjects['1.3.6.1.4.1.9.9.166.1.5.1.1.4'][$spid] as $id => $value) {
|
||||
if ($value == $result['sp-obj']) {
|
||||
// We have our child, import the match
|
||||
if ($tblcbQosObjects['1.3.6.1.4.1.9.9.166.1.5.1.1.3'][$spid][$id] == 3) {
|
||||
$result['match'] = $result['map-type'].": ".$tblcbQosMatchStmtCfg['1.3.6.1.4.1.9.9.166.1.8.1.1.1'][$tblcbQosObjects['1.3.6.1.4.1.9.9.166.1.5.1.1.2'][$spid][$id]];
|
||||
d_echo(" Match: ".$result['match']."\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
continue 2;
|
||||
}
|
||||
|
||||
$tblCBQOS[] = $result;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Ok, we have our 2 array's (Components and SNMP) now we need
|
||||
* to compare and see what needs to be added/updated.
|
||||
*
|
||||
* Let's loop over the SNMP data to see if we need to ADD or UPDATE any components.
|
||||
*/
|
||||
foreach ($tblCBQOS as $key => $array) {
|
||||
$component_key = false;
|
||||
|
||||
// Loop over our components to determine if the component exists, or we need to add it.
|
||||
foreach ($components as $compid => $child) {
|
||||
if ($child['UID'] === $array['UID']) {
|
||||
$component_key = $compid;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$component_key) {
|
||||
// The component doesn't exist, we need to ADD it - ADD.
|
||||
$new_component = $component->createComponent($device['device_id'],$module);
|
||||
$component_key = key($new_component);
|
||||
$components[$component_key] = array_merge($new_component[$component_key], $array);
|
||||
echo "+";
|
||||
}
|
||||
else {
|
||||
// The component does exist, merge the details in - UPDATE.
|
||||
$components[$component_key] = array_merge($components[$component_key], $array);
|
||||
echo ".";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Loop over the Component data to see if we need to DELETE any components.
|
||||
*/
|
||||
foreach ($components as $key => $array) {
|
||||
// Guilty until proven innocent
|
||||
$found = false;
|
||||
|
||||
foreach ($tblCBQOS as $k => $v) {
|
||||
if ($array['UID'] == $v['UID']) {
|
||||
// Yay, we found it...
|
||||
$found = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($found === false) {
|
||||
// The component has not been found. we should delete it.
|
||||
echo "-";
|
||||
$component->deleteComponent($key);
|
||||
}
|
||||
}
|
||||
|
||||
// Write the Components back to the DB.
|
||||
$component->setComponentPrefs($device['device_id'],$components);
|
||||
echo "\n";
|
||||
|
||||
} // End if not error
|
||||
|
||||
}
|
17
includes/discovery/os/eatonpdu.inc.php
Normal file
17
includes/discovery/os/eatonpdu.inc.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS
|
||||
*
|
||||
* Copyright (c) 2016 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.
|
||||
*/
|
||||
|
||||
if (!$os) {
|
||||
if (strstr($sysObjectId, '.1.3.6.1.4.1.534.6.6.7')) {
|
||||
$os = 'eatonpdu';
|
||||
}
|
||||
}
|
@@ -9,27 +9,61 @@ $port_stats = snmpwalk_cache_oid($device, 'ifType', $port_stats, 'IF-MIB');
|
||||
// End Building SNMP Cache Array
|
||||
d_echo($port_stats);
|
||||
|
||||
// Build array of ports in the database
|
||||
// FIXME -- this stuff is a little messy, looping the array to make an array just seems wrong. :>
|
||||
// -- i can make it a function, so that you don't know what it's doing.
|
||||
// -- $ports_db = adamasMagicFunction($ports_db); ?
|
||||
foreach (dbFetchRows('SELECT * FROM `ports` WHERE `device_id` = ?', array($device['device_id'])) as $port) {
|
||||
$ports_db[$port['ifIndex']] = $port;
|
||||
$ports_db_l[$port['ifIndex']] = $port['port_id'];
|
||||
|
||||
// By default libreNMS uses the ifIndex to associate ports on devices with ports discoverd/polled
|
||||
// before and stored in the database. On Linux boxes this is a problem as ifIndexes may be
|
||||
// unstable between reboots or (re)configuration of tunnel interfaces (think: GRE/OpenVPN/Tinc/...)
|
||||
// The port association configuration allows to choose between association via ifIndex, ifName,
|
||||
// or maybe other means in the future. The default port association mode still is ifIndex for
|
||||
// compatibility reasons.
|
||||
$port_association_mode = $config['default_port_association_mode'];
|
||||
if ($device['port_association_mode'])
|
||||
$port_association_mode = get_port_assoc_mode_name ($device['port_association_mode']);
|
||||
|
||||
// Build array of ports in the database and an ifIndex/ifName -> port_id map
|
||||
$ports_mapped = get_ports_mapped ($device['id']);
|
||||
$ports_db = $ports_mapped['ports'];
|
||||
|
||||
//
|
||||
// Rename any old RRD files still named after the previous ifIndex based naming schema.
|
||||
foreach ($ports_mapped['maps']['ifIndex'] as $ifIndex => $port_id) {
|
||||
foreach (array ('', 'adsl', 'dot3') as $suffix) {
|
||||
$suffix_tmp = '';
|
||||
if ($suffix)
|
||||
$suffix_tmp = "-$suffix";
|
||||
|
||||
$old_rrd_path = trim ($config['rrd_dir']) . '/' . $device['hostname'] . "/port-$ifIndex$suffix_tmp.rrd";
|
||||
$new_rrd_path = get_port_rrdfile_path ($device['hostname'], $port_id, $suffix);
|
||||
|
||||
if (is_file ($old_rrd_path)) {
|
||||
rename ($old_rrd_path, $new_rrd_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// New interface detection
|
||||
foreach ($port_stats as $ifIndex => $port) {
|
||||
// Check the port against our filters.
|
||||
// Store ifIndex in port entry and prefetch ifName as we'll need it multiple times
|
||||
$port['ifIndex'] = $ifIndex;
|
||||
$ifName = $port['ifName'];
|
||||
|
||||
// Get port_id according to port_association_mode used for this device
|
||||
$port_id = get_port_id ($ports_mapped, $port, $port_association_mode);
|
||||
|
||||
if (is_port_valid($port, $device)) {
|
||||
if (!is_array($ports_db[$ifIndex])) {
|
||||
$port_id = dbInsert(array('device_id' => $device['device_id'], 'ifIndex' => $ifIndex), 'ports');
|
||||
$ports_db[$ifIndex] = dbFetchRow('SELECT * FROM `ports` WHERE `device_id` = ? AND `ifIndex` = ?', array($device['device_id'], $ifIndex));
|
||||
echo 'Adding: '.$port['ifName'].'('.$ifIndex.')('.$ports_db[$port['ifIndex']]['port_id'].')';
|
||||
|
||||
// Port newly discovered?
|
||||
if (! is_array($ports_db[$port_id])) {
|
||||
$port_id = dbInsert(array('device_id' => $device['device_id'], 'ifIndex' => $ifIndex, 'ifName' => $ifName), 'ports');
|
||||
$ports[$port_id] = dbFetchRow('SELECT * FROM `ports` WHERE `device_id` = ? AND `port_id` = ?', array($device['device_id'], $port_id));
|
||||
echo 'Adding: '.$ifName.'('.$ifIndex.')('.$port_id.')';
|
||||
}
|
||||
else if ($ports_db[$ifIndex]['deleted'] == '1') {
|
||||
dbUpdate(array('deleted' => '0'), 'ports', '`port_id` = ?', array($ports_db[$ifIndex]['port_id']));
|
||||
$ports_db[$ifIndex]['deleted'] = '0';
|
||||
|
||||
// Port re-discovered after previous deletion?
|
||||
else if ($ports_db[$port_id]['deleted'] == '1') {
|
||||
dbUpdate(array('deleted' => '0'), 'ports', '`port_id` = ?', array($ports_db[$port_id]));
|
||||
$ports_db[$port_id]['deleted'] = '0';
|
||||
echo 'U';
|
||||
}
|
||||
else {
|
||||
@@ -39,11 +73,13 @@ foreach ($port_stats as $ifIndex => $port) {
|
||||
// We've seen it. Remove it from the cache.
|
||||
unset($ports_l[$ifIndex]);
|
||||
}
|
||||
|
||||
// Port vanished (mark as deleted)
|
||||
else {
|
||||
if (is_array($ports_db[$port['ifIndex']])) {
|
||||
if ($ports_db[$port['ifIndex']]['deleted'] != '1') {
|
||||
dbUpdate(array('deleted' => '1'), 'ports', '`port_id` = ?', array($ports_db[$ifIndex]['port_id']));
|
||||
$ports_db[$ifIndex]['deleted'] = '1';
|
||||
if (is_array($ports_db[$port_id])) {
|
||||
if ($ports_db[$port_id]['deleted'] != '1') {
|
||||
dbUpdate(array('deleted' => '1'), 'ports', '`port_id` = ?', array($ports_db[$port_id]));
|
||||
$ports_db[$port_id]['deleted'] = '1';
|
||||
echo '-';
|
||||
}
|
||||
}
|
||||
@@ -68,4 +104,3 @@ echo "\n";
|
||||
// Clear Variables Here
|
||||
unset($port_stats);
|
||||
unset($ports_db);
|
||||
unset($ports_db_db);
|
||||
|
23
includes/discovery/sensors/current/eatonpdu.inc.php
Normal file
23
includes/discovery/sensors/current/eatonpdu.inc.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS
|
||||
*
|
||||
* Copyright (c) 2016 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.
|
||||
*/
|
||||
|
||||
if ($device['os'] == 'eatonpdu') {
|
||||
$data = snmpwalk_cache_multi_oid($device, 'outletCurrent', array(), 'EATON-EPDU-MIB');
|
||||
$descr = snmpwalk_cache_multi_oid($device, 'outletName', array(), 'EATON-EPDU-MIB');
|
||||
if (is_array($data)) {
|
||||
$cur_oid = '.1.3.6.1.4.1.534.6.6.7.6.4.1.3.';
|
||||
foreach ($data as $index => $entry) {
|
||||
$i++;
|
||||
discover_sensor($valid['sensor'], 'current', $device, $cur_oid.$index, $i, 'eatonpdu', $descr[$index]['outletName'], '1000', '1', null, null, null, null, $data[$index]['outletCurrent'], 'snmp', $index);
|
||||
}
|
||||
}
|
||||
}
|
@@ -15,8 +15,10 @@ if ($device['os_group'] == 'cisco') {
|
||||
if (is_array($temp)) {
|
||||
$cur_oid = '.1.3.6.1.4.1.9.9.13.1.3.1.3.';
|
||||
foreach ($temp as $index => $entry) {
|
||||
$descr = ucwords($temp[$index]['ciscoEnvMonTemperatureStatusDescr']);
|
||||
discover_sensor($valid['sensor'], 'temperature', $device, $cur_oid.$index, $index, 'cisco', $descr, '1', '1', null, null, $temp[$index]['ciscoEnvMonTemperatureThreshold'], null, $temp[$index]['ciscoEnvMonTemperatureStatusValue'], 'snmp', $index);
|
||||
if ($temp[$index]['ciscoEnvMonTemperatureState'] != 'notPresent') {
|
||||
$descr = ucwords($temp[$index]['ciscoEnvMonTemperatureStatusDescr']);
|
||||
discover_sensor($valid['sensor'], 'temperature', $device, $cur_oid.$index, $index, 'cisco', $descr, '1', '1', null, null, $temp[$index]['ciscoEnvMonTemperatureThreshold'], null, $temp[$index]['ciscoEnvMonTemperatureStatusValue'], 'snmp', $index);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -112,7 +112,72 @@ if ($stpprotocol == 'ieee8021d' || $stpprotocol == 'unknown') {
|
||||
log_event('STP removed', $device, 'stp');
|
||||
echo '-';
|
||||
}
|
||||
|
||||
// STP port related stuff
|
||||
foreach ($stp_raw as $port => $value){
|
||||
if ($port) { // $stp_raw[0] ist not port related so we skip this one
|
||||
$stp_port = array(
|
||||
'priority' => $stp_raw[$port]['dot1dStpPortPriority'],
|
||||
'state' => $stp_raw[$port]['dot1dStpPortState'],
|
||||
'enable' => $stp_raw[$port]['dot1dStpPortEnable'],
|
||||
'pathCost' => $stp_raw[$port]['dot1dStpPortPathCost'],
|
||||
'designatedCost' => $stp_raw[$port]['dot1dStpPortDesignatedCost'],
|
||||
'designatedPort' => $stp_raw[$port]['dot1dStpPortDesignatedPort'],
|
||||
'forwardTransitions' => $stp_raw[$port]['dot1dStpPortForwardTransitions']
|
||||
);
|
||||
|
||||
// set device binding
|
||||
$stp_port['device_id'] = $device['device_id'];
|
||||
|
||||
// set port binding
|
||||
$stp_port['port_id'] = dbFetchCell('SELECT port_id FROM `ports` WHERE `device_id` = ? AND `ifIndex` = ?', array($device['device_id'], $stp_raw[$port]['dot1dStpPort']));
|
||||
|
||||
$dr = str_replace(array(' ', ':', '-'), '', strtolower($stp_raw[$port]['dot1dStpPortDesignatedRoot']));
|
||||
$dr = substr($dr, -12); //remove first two octets
|
||||
$stp_port['designatedRoot'] = $dr;
|
||||
|
||||
$db = str_replace(array(' ', ':', '-'), '', strtolower($stp_raw[$port]['dot1dStpPortDesignatedBridge']));
|
||||
$db = substr($db, -12); //remove first two octets
|
||||
$stp_port['designatedBridge'] = $db;
|
||||
|
||||
if ($device['os'] == 'pbn') {
|
||||
// It seems that PBN guys don't care about ieee 802.1d :-(
|
||||
// So try to find the right port with some crazy conversations
|
||||
$dp_value = dechex($stp_port['priority']);
|
||||
$dp_value = $dp_value.'00';
|
||||
$dp_value = hexdec($dp_value);
|
||||
if ($stp_raw[$port]['dot1dStpPortDesignatedPort']) {
|
||||
$dp = $stp_raw[$port]['dot1dStpPortDesignatedPort'] - $dp_value;
|
||||
$stp_port['designatedPort'] = $dp;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Port saved in format priority+port (ieee 802.1d-1998: clause 8.5.5.1)
|
||||
$dp = substr($stp_raw[$port]['dot1dStpPortDesignatedPort'], -2); //discard the first octet (priority part)
|
||||
$stp_port['designatedPort'] = hexdec($dp);
|
||||
}
|
||||
|
||||
d_echo($stp_port);
|
||||
|
||||
// Write to db
|
||||
if (!dbFetchCell('SELECT 1 FROM `ports_stp` WHERE `device_id` = ? AND `port_id` = ?', array($device['device_id'], $stp_port['port_id']))) {
|
||||
dbInsert($stp_port,'ports_stp');
|
||||
echo '+';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Delete STP ports from db if absent in SNMP query
|
||||
$stp_port_db = dbFetchRows('SELECT * FROM `ports_stp` WHERE `device_id` = ?', array($device['device_id']));
|
||||
//d_echo($stp_port_db);
|
||||
foreach($stp_port_db as $port => $value){
|
||||
$if_index = dbFetchCell('SELECT `ifIndex` FROM `ports` WHERE `device_id` = ? AND `port_id` = ?', array($device['device_id'], $value['port_id']));
|
||||
if ($if_index != $stp_raw[$if_index]['dot1dStpPort']){
|
||||
dbDelete('ports_stp', '`device_id` = ? AND `port_id` = ?', array($device['device_id'], $value['port_id']));
|
||||
echo '-';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unset($stp_raw, $stp, $stp_db);
|
||||
unset($stp_raw, $stp, $stp_db, $stp_port, $stp_port_db);
|
||||
echo "\n";
|
||||
|
@@ -239,12 +239,20 @@ function delete_device($id) {
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function addHost($host, $snmpver, $port = '161', $transport = 'udp', $quiet = '0', $poller_group = '0', $force_add = '0') {
|
||||
function addHost($host, $snmpver, $port = '161', $transport = 'udp', $quiet = '0', $poller_group = '0', $force_add = '0', $port_assoc_mode = 'ifIndex') {
|
||||
global $config;
|
||||
|
||||
list($hostshort) = explode(".", $host);
|
||||
// Test Database Exists
|
||||
if (host_exists($host) === false) {
|
||||
// Valid port assoc mode
|
||||
if (! is_valid_port_assoc_mode ($port_assoc_mode)) {
|
||||
if ($quiet == 0) {
|
||||
print_error ("Invalid port association_mode '$port_assoc_mode'. Valid modes are: " . join (', ', get_port_assoc_modes ()));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ($config['addhost_alwayscheckip'] === TRUE) {
|
||||
$ip = gethostbyname($host);
|
||||
} else {
|
||||
@@ -257,15 +265,15 @@ function addHost($host, $snmpver, $port = '161', $transport = 'udp', $quiet = '0
|
||||
if (empty($snmpver)) {
|
||||
// Try SNMPv2c
|
||||
$snmpver = 'v2c';
|
||||
$ret = addHost($host, $snmpver, $port, $transport, $quiet, $poller_group, $force_add);
|
||||
$ret = addHost($host, $snmpver, $port, $transport, $quiet, $poller_group, $force_add, $port_assoc_mode);
|
||||
if (!$ret) {
|
||||
//Try SNMPv3
|
||||
$snmpver = 'v3';
|
||||
$ret = addHost($host, $snmpver, $port, $transport, $quiet, $poller_group, $force_add);
|
||||
$ret = addHost($host, $snmpver, $port, $transport, $quiet, $poller_group, $force_add, $port_assoc_mode);
|
||||
if (!$ret) {
|
||||
// Try SNMPv1
|
||||
$snmpver = 'v1';
|
||||
return addHost($host, $snmpver, $port, $transport, $quiet, $poller_group, $force_add);
|
||||
return addHost($host, $snmpver, $port, $transport, $quiet, $poller_group, $force_add, $port_assoc_mode);
|
||||
}
|
||||
else {
|
||||
return $ret;
|
||||
@@ -279,12 +287,12 @@ function addHost($host, $snmpver, $port = '161', $transport = 'udp', $quiet = '0
|
||||
if ($snmpver === "v3") {
|
||||
// Try each set of parameters from config
|
||||
foreach ($config['snmp']['v3'] as $v3) {
|
||||
$device = deviceArray($host, NULL, $snmpver, $port, $transport, $v3);
|
||||
$device = deviceArray($host, NULL, $snmpver, $port, $transport, $v3, $port_assoc_mode);
|
||||
if($quiet == '0') { print_message("Trying v3 parameters " . $v3['authname'] . "/" . $v3['authlevel'] . " ... "); }
|
||||
if ($force_add == 1 || isSNMPable($device)) {
|
||||
$snmphost = snmp_get($device, "sysName.0", "-Oqv", "SNMPv2-MIB");
|
||||
if (empty($snmphost) or ($snmphost == $host || $hostshort = $host)) {
|
||||
$device_id = createHost ($host, NULL, $snmpver, $port, $transport, $v3, $poller_group);
|
||||
$device_id = createHost ($host, NULL, $snmpver, $port, $transport, $v3, $poller_group, $port_assoc_mode);
|
||||
return $device_id;
|
||||
}
|
||||
else {
|
||||
@@ -303,14 +311,14 @@ function addHost($host, $snmpver, $port = '161', $transport = 'udp', $quiet = '0
|
||||
elseif ($snmpver === "v2c" or $snmpver === "v1") {
|
||||
// try each community from config
|
||||
foreach ($config['snmp']['community'] as $community) {
|
||||
$device = deviceArray($host, $community, $snmpver, $port, $transport, NULL);
|
||||
$device = deviceArray($host, $community, $snmpver, $port, $transport, NULL, $port_assoc_mode);
|
||||
if($quiet == '0') {
|
||||
print_message("Trying community $community ...");
|
||||
}
|
||||
if ($force_add == 1 || isSNMPable($device)) {
|
||||
$snmphost = snmp_get($device, "sysName.0", "-Oqv", "SNMPv2-MIB");
|
||||
if (empty($snmphost) || ($snmphost && ($snmphost == $host || $hostshort = $host))) {
|
||||
$device_id = createHost ($host, $community, $snmpver, $port, $transport,array(),$poller_group);
|
||||
$device_id = createHost ($host, $community, $snmpver, $port, $transport,array(),$poller_group, $port_assoc_mode);
|
||||
return $device_id;
|
||||
}
|
||||
else {
|
||||
@@ -382,12 +390,18 @@ next;
|
||||
}
|
||||
}
|
||||
|
||||
function deviceArray($host, $community, $snmpver, $port = 161, $transport = 'udp', $v3) {
|
||||
function deviceArray($host, $community, $snmpver, $port = 161, $transport = 'udp', $v3, $port_assoc_mode = 'ifIndex') {
|
||||
$device = array();
|
||||
$device['hostname'] = $host;
|
||||
$device['port'] = $port;
|
||||
$device['transport'] = $transport;
|
||||
|
||||
/* Get port_assoc_mode id if neccessary
|
||||
* We can work with names of IDs here */
|
||||
if (! is_int ($port_assoc_mode))
|
||||
$port_assoc_mode = get_port_assoc_mode_id ($port_assoc_mode);
|
||||
$device['port_association_mode'] = $port_assoc_mode;
|
||||
|
||||
$device['snmpver'] = $snmpver;
|
||||
if ($snmpver === "v2c" or $snmpver === "v1") {
|
||||
$device['community'] = $community;
|
||||
@@ -554,7 +568,7 @@ function getpollergroup($poller_group='0') {
|
||||
}
|
||||
}
|
||||
|
||||
function createHost($host, $community = NULL, $snmpver, $port = 161, $transport = 'udp', $v3 = array(), $poller_group='0') {
|
||||
function createHost($host, $community = NULL, $snmpver, $port = 161, $transport = 'udp', $v3 = array(), $poller_group='0', $port_assoc_mode = 'ifIndex') {
|
||||
global $config;
|
||||
$host = trim(strtolower($host));
|
||||
|
||||
@@ -569,6 +583,7 @@ function createHost($host, $community = NULL, $snmpver, $port = 161, $transport
|
||||
'snmpver' => $snmpver,
|
||||
'poller_group' => $poller_group,
|
||||
'status_reason' => '',
|
||||
'port_association_mode' => $port_assoc_mode,
|
||||
);
|
||||
|
||||
$device = array_merge($device, $v3);
|
||||
|
@@ -168,10 +168,10 @@ if ($config['enable_bgp']) {
|
||||
|
||||
$peerrrd = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename('bgp-'.$peer['bgpPeerIdentifier'].'.rrd');
|
||||
if (!is_file($peerrrd)) {
|
||||
$create_rrd = 'DS:bgpPeerOutUpdates:COUNTER:600:U:100000000000
|
||||
DS:bgpPeerInUpdates:COUNTER:600:U:100000000000
|
||||
DS:bgpPeerOutTotal:COUNTER:600:U:100000000000
|
||||
DS:bgpPeerInTotal:COUNTER:600:U:100000000000
|
||||
$create_rrd = 'DS:bgpPeerOutUpdates:COUNTER:600:U:100000000000
|
||||
DS:bgpPeerInUpdates:COUNTER:600:U:100000000000
|
||||
DS:bgpPeerOutTotal:COUNTER:600:U:100000000000
|
||||
DS:bgpPeerInTotal:COUNTER:600:U:100000000000
|
||||
DS:bgpPeerEstablished:GAUGE:600:0:U '.$config['rrd_rra'];
|
||||
|
||||
rrdtool_create($peerrrd, $create_rrd);
|
||||
@@ -294,45 +294,6 @@ if ($config['enable_bgp']) {
|
||||
unset($cbgp_data);
|
||||
}//end if
|
||||
|
||||
if ($device['os'] == 'junos') {
|
||||
// Missing: cbgpPeerAdminLimit cbgpPeerPrefixThreshold cbgpPeerPrefixClearThreshold cbgpPeerSuppressedPrefixes cbgpPeerWithdrawnPrefixes
|
||||
$safis['unicast'] = 1;
|
||||
$safis['multicast'] = 2;
|
||||
|
||||
if (!isset($peerIndexes)) {
|
||||
$j_bgp = snmpwalk_cache_multi_oid($device, 'jnxBgpM2PeerTable', $jbgp, 'BGP4-V2-MIB-JUNIPER', $config['install_dir'].'/mibs/junos');
|
||||
foreach ($j_bgp as $index => $entry) {
|
||||
switch ($entry['jnxBgpM2PeerRemoteAddrType']) {
|
||||
case 'ipv4':
|
||||
$ip = long2ip(hexdec($entry['jnxBgpM2PeerRemoteAddr']));
|
||||
$j_peerIndexes[$ip] = $entry['jnxBgpM2PeerIndex'];
|
||||
break;
|
||||
|
||||
case 'ipv6':
|
||||
$ip6 = trim(str_replace(' ', '', $entry['jnxBgpM2PeerRemoteAddr']), '"');
|
||||
$ip6 = substr($ip6, 0, 4).':'.substr($ip6, 4, 4).':'.substr($ip6, 8, 4).':'.substr($ip6, 12, 4).':'.substr($ip6, 16, 4).':'.substr($ip6, 20, 4).':'.substr($ip6, 24, 4).':'.substr($ip6, 28, 4);
|
||||
$ip6 = Net_IPv6::compress($ip6);
|
||||
$j_peerIndexes[$ip6] = $entry['jnxBgpM2PeerIndex'];
|
||||
break;
|
||||
|
||||
default:
|
||||
echo "PANIC: Don't know RemoteAddrType ".$entry['jnxBgpM2PeerRemoteAddrType']."!\n";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}//end if
|
||||
|
||||
$j_prefixes = snmpwalk_cache_multi_oid($device, 'jnxBgpM2PrefixCountersTable', $jbgp, 'BGP4-V2-MIB-JUNIPER', $config['install_dir'].'/mibs/junos');
|
||||
|
||||
$cbgpPeerAcceptedPrefixes = $j_prefixes[$j_peerIndexes[$peer['bgpPeerIdentifier']].".$afi.".$safis[$safi]]['jnxBgpM2PrefixInPrefixesAccepted'];
|
||||
$cbgpPeerDeniedPrefixes = $j_prefixes[$j_peerIndexes[$peer['bgpPeerIdentifier']].".$afi.".$safis[$safi]]['jnxBgpM2PrefixInPrefixesRejected'];
|
||||
$cbgpPeerAdvertisedPrefixes = $j_prefixes[$j_peerIndexes[$peer['bgpPeerIdentifier']].".$afi.".$safis[$safi]]['jnxBgpM2PrefixOutPrefixes'];
|
||||
|
||||
unset($j_prefixes);
|
||||
unset($j_bgp);
|
||||
unset($j_peerIndexes);
|
||||
}//end if
|
||||
|
||||
// FIXME THESE FIELDS DO NOT EXIST IN THE DATABASE!
|
||||
$update = 'UPDATE bgpPeers_cbgp SET';
|
||||
$peer['c_update']['AcceptedPrefixes'] = $cbgpPeerAcceptedPrefixes;
|
||||
@@ -344,14 +305,28 @@ if ($config['enable_bgp']) {
|
||||
$peer['c_update']['SuppressedPrefixes'] = $cbgpPeerSuppressedPrefixes;
|
||||
$peer['c_update']['WithdrawnPrefixes'] = $cbgpPeerWithdrawnPrefixes;
|
||||
|
||||
|
||||
$oids = array(
|
||||
'AcceptedPrefixes',
|
||||
'DeniedPrefixes',
|
||||
'AdvertisedPrefixes',
|
||||
'SuppressedPrefixes',
|
||||
'WithdrawnPrefixes',
|
||||
);
|
||||
|
||||
foreach ($oids as $oid) {
|
||||
$peer['c_update'][$oid.'_delta'] = $peer['c_update'][$oid] - $peer_afi[$oid];
|
||||
$peer['c_update'][$oid.'_prev'] = $peer_afi[$oid];
|
||||
}
|
||||
|
||||
dbUpdate($peer['c_update'], 'bgpPeers_cbgp', '`device_id` = ? AND bgpPeerIdentifier = ? AND afi = ? AND safi = ?', array($device['device_id'], $peer['bgpPeerIdentifier'], $afi, $safi));
|
||||
|
||||
$cbgp_rrd = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename('cbgp-'.$peer['bgpPeerIdentifier'].".$afi.$safi.rrd");
|
||||
if (!is_file($cbgp_rrd)) {
|
||||
$rrd_create = 'DS:AcceptedPrefixes:GAUGE:600:U:100000000000
|
||||
DS:DeniedPrefixes:GAUGE:600:U:100000000000
|
||||
DS:AdvertisedPrefixes:GAUGE:600:U:100000000000
|
||||
DS:SuppressedPrefixes:GAUGE:600:U:100000000000
|
||||
$rrd_create = 'DS:AcceptedPrefixes:GAUGE:600:U:100000000000
|
||||
DS:DeniedPrefixes:GAUGE:600:U:100000000000
|
||||
DS:AdvertisedPrefixes:GAUGE:600:U:100000000000
|
||||
DS:SuppressedPrefixes:GAUGE:600:U:100000000000
|
||||
DS:WithdrawnPrefixes:GAUGE:600:U:100000000000 '.$config['rrd_rra'];
|
||||
rrdtool_create($cbgp_rrd, $rrd_create);
|
||||
}
|
||||
|
72
includes/polling/cisco-cbqos.inc.php
Normal file
72
includes/polling/cisco-cbqos.inc.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS module to capture Cisco Class-Based QoS Details
|
||||
*
|
||||
* Copyright (c) 2015 Aaron Daniels <aaron@daniels.id.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.
|
||||
*/
|
||||
|
||||
if ($device['os_group'] == "cisco") {
|
||||
|
||||
$module = 'Cisco-CBQOS';
|
||||
|
||||
require_once 'includes/component.php';
|
||||
$component = new component();
|
||||
$options['filter']['type'] = array('=',$module);
|
||||
$options['filter']['disabled'] = array('=',0);
|
||||
$options['filter']['ignore'] = array('=',0);
|
||||
$components = $component->getComponents($device['device_id'],$options);
|
||||
|
||||
// We only care about our device id.
|
||||
$components = $components[$device['device_id']];
|
||||
|
||||
// Only collect SNMP data if we have enabled components
|
||||
if (count($components > 0)) {
|
||||
// Let's gather the stats..
|
||||
$tblcbQosClassMapStats = snmpwalk_array_num($device, '.1.3.6.1.4.1.9.9.166.1.15.1.1', 2);
|
||||
|
||||
// Loop through the components and extract the data.
|
||||
foreach ($components as $key => $array) {
|
||||
$type = $array['qos-type'];
|
||||
|
||||
// Get data from the class table.
|
||||
if ($type == 2) {
|
||||
// Let's make sure the rrd is setup for this class.
|
||||
$filename = "port-".$array['ifindex']."-cbqos-".$array['sp-id']."-".$array['sp-obj'].".rrd";
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename ($filename);
|
||||
|
||||
if (!file_exists ($rrd_filename)) {
|
||||
rrdtool_create ($rrd_filename, " DS:postbits:COUNTER:600:0:U DS:bufferdrops:COUNTER:600:0:U DS:qosdrops:COUNTER:600:0:U" . $config['rrd_rra']);
|
||||
}
|
||||
|
||||
// Let's print some debugging info.
|
||||
d_echo("\n\nComponent: ".$key."\n");
|
||||
d_echo(" Class-Map: ".$array['label']."\n");
|
||||
d_echo(" SPID.SPOBJ: ".$array['sp-id'].".".$array['sp-obj']."\n");
|
||||
d_echo(" PostBytes: 1.3.6.1.4.1.9.9.166.1.15.1.1.10.".$array['sp-id'].".".$array['sp-obj']." = ".$tblcbQosClassMapStats['1.3.6.1.4.1.9.9.166.1.15.1.1.10'][$array['sp-id']][$array['sp-obj']]."\n");
|
||||
d_echo(" BufferDrops: 1.3.6.1.4.1.9.9.166.1.15.1.1.21.".$array['sp-id'].".".$array['sp-obj']." = ".$tblcbQosClassMapStats['1.3.6.1.4.1.9.9.166.1.15.1.1.21'][$array['sp-id']][$array['sp-obj']]."\n");
|
||||
d_echo(" QOSDrops: 1.3.6.1.4.1.9.9.166.1.15.1.1.17.".$array['sp-id'].".".$array['sp-obj']." = ".$tblcbQosClassMapStats['1.3.6.1.4.1.9.9.166.1.15.1.1.17'][$array['sp-id']][$array['sp-obj']]."\n");
|
||||
|
||||
$rrd['postbytes'] = $tblcbQosClassMapStats['1.3.6.1.4.1.9.9.166.1.15.1.1.10'][$array['sp-id']][$array['sp-obj']];
|
||||
$rrd['bufferdrops'] = $tblcbQosClassMapStats['1.3.6.1.4.1.9.9.166.1.15.1.1.21'][$array['sp-id']][$array['sp-obj']];
|
||||
$rrd['qosdrops'] = $tblcbQosClassMapStats['1.3.6.1.4.1.9.9.166.1.15.1.1.17'][$array['sp-id']][$array['sp-obj']];
|
||||
|
||||
// Update rrd
|
||||
rrdtool_update ($rrd_filename, $rrd);
|
||||
|
||||
// Clean-up after yourself!
|
||||
unset($filename, $rrd_filename);
|
||||
}
|
||||
} // End foreach components
|
||||
|
||||
echo $module." ";
|
||||
} // end if count components
|
||||
|
||||
// Clean-up after yourself!
|
||||
unset($type, $components, $component, $options, $module);
|
||||
}
|
15
includes/polling/os/eatonpdu.inc.php
Normal file
15
includes/polling/os/eatonpdu.inc.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS
|
||||
*
|
||||
* Copyright (c) 2016 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.
|
||||
*/
|
||||
|
||||
$hardware = trim(snmp_get($device, 'partNumber.0', '-Ovq', 'EATON-EPDU-MIB'), '"');
|
||||
$version = trim(snmp_get($device, 'firmwareVersion.0', '-Ovq', 'EATON-EPDU-MIB'), '"');
|
||||
$serial = trim(snmp_get($device, 'serialNumber.0', '-Ovq', 'EATON-EPDU-MIB'), '"');
|
@@ -39,11 +39,11 @@
|
||||
// adslAturPerfESs.1 = 0 seconds
|
||||
// adslAturPerfValidIntervals.1 = 0
|
||||
// adslAturPerfInvalidIntervals.1 = 0
|
||||
if (isset($port_stats[$port['ifIndex']]['adslLineCoding'])) {
|
||||
if (isset($port_stats[$port_id]['adslLineCoding'])) {
|
||||
// Check to make sure Port data is cached.
|
||||
$this_port = &$port_stats[$port['ifIndex']];
|
||||
$this_port = &$port_stats[$port_id];
|
||||
|
||||
$rrdfile = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename('port-'.$port['ifIndex'].'-adsl.rrd');
|
||||
$rrdfile = get_port_rrdfile_path ($device['hostname'], $port_id, 'adsl');
|
||||
|
||||
$rrd_create = ' --step 300';
|
||||
$rrd_create .= ' DS:AtucCurrSnrMgn:GAUGE:600:0:635';
|
||||
@@ -130,8 +130,8 @@ if (isset($port_stats[$port['ifIndex']]['adslLineCoding'])) {
|
||||
$this_port[$oid] = ($this_port[$oid] / 10);
|
||||
}
|
||||
|
||||
if (dbFetchCell('SELECT COUNT(*) FROM `ports_adsl` WHERE `port_id` = ?', array($port['port_id'])) == '0') {
|
||||
dbInsert(array('port_id' => $port['port_id']), 'ports_adsl');
|
||||
if (dbFetchCell('SELECT COUNT(*) FROM `ports_adsl` WHERE `port_id` = ?', array($port_id)) == '0') {
|
||||
dbInsert(array('port_id' => $port_id), 'ports_adsl');
|
||||
}
|
||||
|
||||
$port['adsl_update'] = array('port_adsl_updated' => array('NOW()'));
|
||||
@@ -141,7 +141,7 @@ if (isset($port_stats[$port['ifIndex']]['adslLineCoding'])) {
|
||||
$port['adsl_update'][$oid] = $data;
|
||||
}
|
||||
|
||||
dbUpdate($port['adsl_update'], 'ports_adsl', '`port_id` = ?', array($port['port_id']));
|
||||
dbUpdate($port['adsl_update'], 'ports_adsl', '`port_id` = ?', array($port_id));
|
||||
|
||||
if ($this_port['adslAtucCurrSnrMgn'] > '1280') {
|
||||
$this_port['adslAtucCurrSnrMgn'] = 'U';
|
||||
|
@@ -1,13 +1,14 @@
|
||||
<?php
|
||||
|
||||
if ($port_stats[$port['ifIndex']] &&
|
||||
if ($port_stats[$port_id] &&
|
||||
$port['ifType'] == 'ethernetCsmacd' &&
|
||||
isset($port_stats[$port['ifIndex']]['dot3StatsIndex'])) {
|
||||
isset($port_stats[$port_id]['dot3StatsIndex'])) {
|
||||
// Check to make sure Port data is cached.
|
||||
$this_port = &$port_stats[$port[ifIndex]];
|
||||
$this_port = &$port_stats[$port_id];
|
||||
|
||||
// TODO: remove legacy check?
|
||||
$old_rrdfile = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename('etherlike-'.$port['ifIndex'].'.rrd');
|
||||
$rrdfile = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename('port-'.$port['ifIndex'].'-dot3.rrd');
|
||||
$rrd_file = get_port_rrdfile_path ($device['hostname'], $port_id, 'dot3');
|
||||
|
||||
$rrd_create = $config['rrd_rra'];
|
||||
|
||||
|
@@ -35,14 +35,13 @@ $peth_oids = array(
|
||||
'pethMainPseConsumptionPower',
|
||||
);
|
||||
|
||||
if ($port_stats[$port['ifIndex']]
|
||||
if ($port_stats[$port_id]
|
||||
&& $port['ifType'] == 'ethernetCsmacd'
|
||||
&& isset($port_stats[$port['ifIndex']]['dot3StatsIndex'])) {
|
||||
&& isset($port_stats[$port_id]['dot3StatsIndex'])) {
|
||||
// Check to make sure Port data is cached.
|
||||
$this_port = &$port_stats[$port['ifIndex']];
|
||||
|
||||
$rrdfile = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename('port-'.$port['ifIndex'].'-poe.rrd');
|
||||
$this_port = &$port_stats[$port_id];
|
||||
|
||||
$rrdfile = get_port_rrdfile_path ($device['hostname'], $port_id, 'poe');
|
||||
if (!file_exists($rrdfile)) {
|
||||
$rrd_create .= $config['rrd_rra'];
|
||||
|
||||
|
@@ -191,50 +191,91 @@ $polled = time();
|
||||
// End Building SNMP Cache Array
|
||||
d_echo($port_stats);
|
||||
|
||||
// Build array of ports in the database
|
||||
// FIXME -- this stuff is a little messy, looping the array to make an array just seems wrong. :>
|
||||
// -- i can make it a function, so that you don't know what it's doing.
|
||||
// -- $ports = adamasMagicFunction($ports_db); ?
|
||||
// select * doesn't do what we want if multiple tables have the same column name -- last one wins :/
|
||||
$ports_db = dbFetchRows('SELECT *, `ports_statistics`.`port_id` AS `ports_statistics_port_id`, `ports`.`port_id` AS `port_id` FROM `ports` LEFT OUTER JOIN `ports_statistics` ON `ports`.`port_id` = `ports_statistics`.`port_id` WHERE `ports`.`device_id` = ?', array($device['device_id']));
|
||||
// By default libreNMS uses the ifIndex to associate ports on devices with ports discoverd/polled
|
||||
// before and stored in the database. On Linux boxes this is a problem as ifIndexes may be
|
||||
// unstable between reboots or (re)configuration of tunnel interfaces (think: GRE/OpenVPN/Tinc/...)
|
||||
// The port association configuration allows to choose between association via ifIndex, ifName,
|
||||
// or maybe other means in the future. The default port association mode still is ifIndex for
|
||||
// compatibility reasons.
|
||||
$port_association_mode = $config['default_port_association_mode'];
|
||||
if ($device['port_association_mode'])
|
||||
$port_association_mode = get_port_assoc_mode_name ($device['port_association_mode']);
|
||||
|
||||
foreach ($ports_db as $port) {
|
||||
$ports[$port['ifIndex']] = $port;
|
||||
// Query known ports and mapping table in order of discovery to make sure
|
||||
// the latest discoverd/polled port is in the mapping tables.
|
||||
$ports_mapped = get_ports_mapped ($device['device_id'], true);
|
||||
$ports = $ports_mapped['ports'];
|
||||
|
||||
//
|
||||
// Rename any old RRD files still named after the previous ifIndex based naming schema.
|
||||
foreach ($ports_mapped['maps']['ifIndex'] as $ifIndex => $port_id) {
|
||||
foreach (array ('', 'adsl', 'dot3') as $suffix) {
|
||||
$suffix_tmp = '';
|
||||
if ($suffix)
|
||||
$suffix_tmp = "-$suffix";
|
||||
|
||||
$old_rrd_path = trim ($config['rrd_dir']) . '/' . $device['hostname'] . "/port-$ifIndex$suffix_tmp.rrd";
|
||||
$new_rrd_path = get_port_rrdfile_path ($device['hostname'], $port_id, $suffix);
|
||||
|
||||
if (is_file ($old_rrd_path)) {
|
||||
rename ($old_rrd_path, $new_rrd_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// New interface detection
|
||||
foreach ($port_stats as $ifIndex => $port) {
|
||||
// Store ifIndex in port entry and prefetch ifName as we'll need it multiple times
|
||||
$port['ifIndex'] = $ifIndex;
|
||||
$ifName = $port['ifName'];
|
||||
|
||||
// Get port_id according to port_association_mode used for this device
|
||||
$port_id = get_port_id ($ports_mapped, $port, $port_association_mode);
|
||||
|
||||
if (is_port_valid($port, $device)) {
|
||||
echo 'valid';
|
||||
if (!is_array($ports[$port['ifIndex']])) {
|
||||
$port_id = dbInsert(array('device_id' => $device['device_id'], 'ifIndex' => $ifIndex), 'ports');
|
||||
|
||||
// Port newly discovered?
|
||||
if (! $ports[$port_id]) {
|
||||
$port_id = dbInsert(array('device_id' => $device['device_id'], 'ifIndex' => $ifIndex, 'ifName' => $ifName), 'ports');
|
||||
dbInsert(array('port_id' => $port_id), 'ports_statistics');
|
||||
$ports[$port['ifIndex']] = dbFetchRow('SELECT * FROM `ports` WHERE `port_id` = ?', array($port_id));
|
||||
echo 'Adding: '.$port['ifName'].'('.$ifIndex.')('.$ports[$port['ifIndex']]['port_id'].')';
|
||||
$ports[$port_id] = dbFetchRow('SELECT * FROM `ports` WHERE `port_id` = ?', array($port_id));
|
||||
echo 'Adding: '.$ifName.'('.$ifIndex.')('.$port_id.')';
|
||||
// print_r($ports);
|
||||
}
|
||||
else if ($ports[$ifIndex]['deleted'] == '1') {
|
||||
dbUpdate(array('deleted' => '0'), 'ports', '`port_id` = ?', array($ports[$ifIndex]['port_id']));
|
||||
$ports[$ifIndex]['deleted'] = '0';
|
||||
}
|
||||
if ($ports[$ifIndex]['ports_statistics_port_id'] === null) {
|
||||
// in case the port was created before we created the table
|
||||
dbInsert(array('port_id' => $ports[$ifIndex]['port_id']), 'ports_statistics');
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($ports[$port['ifIndex']]['deleted'] != '1') {
|
||||
dbUpdate(array('deleted' => '1'), 'ports', '`port_id` = ?', array($ports[$ifIndex]['port_id']));
|
||||
$ports[$ifIndex]['deleted'] = '1';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// End New interface detection
|
||||
// Port re-discovered after previous deletion?
|
||||
else if ($ports[$port_id]['deleted'] == 1) {
|
||||
dbUpdate(array('deleted' => '0'), 'ports', '`port_id` = ?', array($port_id));
|
||||
$ports[$port_id]['deleted'] = '0';
|
||||
}
|
||||
if ($ports[$port_id]['ports_statistics_port_id'] === null) {
|
||||
// in case the port was created before we created the table
|
||||
dbInsert(array('port_id' => $port_id), 'ports_statistics');
|
||||
}
|
||||
|
||||
// Assure stable mapping
|
||||
$port_stats[$ifIndex]['port_id'] = $port_id;
|
||||
$ports[$port_id]['ifIndex'] = $ifIndex;
|
||||
}
|
||||
|
||||
// Port vanished (mark as deleted)
|
||||
else {
|
||||
if ($ports[$port_id]['deleted'] != '1') {
|
||||
dbUpdate(array('deleted' => '1'), 'ports', '`port_id` = ?', array($port_id));
|
||||
$ports[$port_id]['deleted'] = '1';
|
||||
}
|
||||
}
|
||||
} // End new interface detection
|
||||
|
||||
|
||||
echo "\n";
|
||||
// Loop ports in the DB and update where necessary
|
||||
foreach ($ports as $port) {
|
||||
echo 'Port '.$port['ifDescr'].'('.$port['ifIndex'].') ';
|
||||
$port_id = $port['port_id'];
|
||||
|
||||
echo 'Port ' . $port['ifName'] . ': ' . $port['ifDescr'] . '(' . $port['ifIndex'] . ') ';
|
||||
if ($port_stats[$port['ifIndex']] && $port['disabled'] != '1') {
|
||||
// Check to make sure Port data is cached.
|
||||
$this_port = &$port_stats[$port['ifIndex']];
|
||||
@@ -477,7 +518,7 @@ foreach ($ports as $port) {
|
||||
}
|
||||
|
||||
// Update RRDs
|
||||
$rrdfile = $host_rrd.'/port-'.safename($port['ifIndex'].'.rrd');
|
||||
$rrdfile = get_port_rrdfile_path ($device['hostname'], $port_id);
|
||||
if (!is_file($rrdfile)) {
|
||||
rrdtool_create(
|
||||
$rrdfile,
|
||||
@@ -576,9 +617,9 @@ foreach ($ports as $port) {
|
||||
|
||||
// Update Database
|
||||
if (count($port['update'])) {
|
||||
$updated = dbUpdate($port['update'], 'ports', '`port_id` = ?', array($port['port_id']));
|
||||
$updated = dbUpdate($port['update'], 'ports', '`port_id` = ?', array($port_id));
|
||||
// do we want to do something else with this?
|
||||
$updated += dbUpdate($port['update_extended'], 'ports_statistics', '`port_id` = ?', array($port['port_id']));
|
||||
$updated += dbUpdate($port['update_extended'], 'ports_statistics', '`port_id` = ?', array($port_id));
|
||||
d_echo("$updated updated");
|
||||
}
|
||||
|
||||
@@ -588,7 +629,7 @@ foreach ($ports as $port) {
|
||||
echo 'Port Deleted';
|
||||
// Port missing from SNMP cache.
|
||||
if ($port['deleted'] != '1') {
|
||||
dbUpdate(array('deleted' => '1'), 'ports', '`device_id` = ? AND `ifIndex` = ?', array($device['device_id'], $port['ifIndex']));
|
||||
dbUpdate(array('deleted' => '1'), 'ports', '`device_id` = ? AND `port_id` = ?', array($device['device_id'], $port_id));
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -599,7 +640,7 @@ foreach ($ports as $port) {
|
||||
|
||||
// Clear Per-Port Variables Here
|
||||
unset($this_port);
|
||||
}//end foreach
|
||||
} //end port update
|
||||
|
||||
// Clear Variables Here
|
||||
unset($port_stats);
|
||||
|
@@ -39,6 +39,7 @@ if ($stpprotocol == 'ieee8021d' || $stpprotocol == 'unknown') {
|
||||
|
||||
// read the 802.1D subtree
|
||||
$stp_raw = snmpwalk_cache_oid($device, 'dot1dStp', array(), 'RSTP-MIB');
|
||||
d_echo($stp_raw);
|
||||
$stp = array(
|
||||
'protocolSpecification' => $stp_raw[0]['dot1dStpProtocolSpecification'],
|
||||
'priority' => $stp_raw[0]['dot1dStpPriority'],
|
||||
@@ -121,7 +122,59 @@ if ($stpprotocol == 'ieee8021d' || $stpprotocol == 'unknown') {
|
||||
dbUpdate($stp,'stp','device_id = ?', array($device['device_id']));
|
||||
echo '.';
|
||||
}
|
||||
|
||||
// STP port related stuff
|
||||
foreach ($stp_raw as $port => $value){
|
||||
if ($port) { // $stp_raw[0] ist not port related so we skip this one
|
||||
$stp_port = array(
|
||||
'priority' => $stp_raw[$port]['dot1dStpPortPriority'],
|
||||
'state' => $stp_raw[$port]['dot1dStpPortState'],
|
||||
'enable' => $stp_raw[$port]['dot1dStpPortEnable'],
|
||||
'pathCost' => $stp_raw[$port]['dot1dStpPortPathCost'],
|
||||
'designatedCost' => $stp_raw[$port]['dot1dStpPortDesignatedCost'],
|
||||
'designatedPort' => $stp_raw[$port]['dot1dStpPortDesignatedPort'],
|
||||
'forwardTransitions' => $stp_raw[$port]['dot1dStpPortForwardTransitions']
|
||||
);
|
||||
|
||||
// set device binding
|
||||
$stp_port['device_id'] = $device['device_id'];
|
||||
|
||||
// set port binding
|
||||
$stp_port['port_id'] = dbFetchCell('SELECT port_id FROM `ports` WHERE `device_id` = ? AND `ifIndex` = ?', array($device['device_id'], $stp_raw[$port]['dot1dStpPort']));
|
||||
|
||||
$dr = str_replace(array(' ', ':', '-'), '', strtolower($stp_raw[$port]['dot1dStpPortDesignatedRoot']));
|
||||
$dr = substr($dr, -12); //remove first two octets
|
||||
$stp_port['designatedRoot'] = $dr;
|
||||
|
||||
$db = str_replace(array(' ', ':', '-'), '', strtolower($stp_raw[$port]['dot1dStpPortDesignatedBridge']));
|
||||
$db = substr($db, -12); //remove first two octets
|
||||
$stp_port['designatedBridge'] = $db;
|
||||
|
||||
if ($device['os'] == 'pbn') {
|
||||
// It seems that PBN guys don't care about ieee 802.1d :-(
|
||||
// So try to find the right port with some crazy conversations
|
||||
$dp_value = dechex($stp_port['priority']);
|
||||
$dp_value = $dp_value.'00';
|
||||
$dp_value = hexdec($dp_value);
|
||||
if ($stp_raw[$port]['dot1dStpPortDesignatedPort']) {
|
||||
$dp = $stp_raw[$port]['dot1dStpPortDesignatedPort'] - $dp_value;
|
||||
$stp_port['designatedPort'] = $dp;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Port saved in format priority+port (ieee 802.1d-1998: clause 8.5.5.1)
|
||||
$dp = substr($stp_raw[$port]['dot1dStpPortDesignatedPort'], -2); //discard the first octet (priority part)
|
||||
$stp_port['designatedPort'] = hexdec($dp);
|
||||
}
|
||||
|
||||
//d_echo($stp_port);
|
||||
|
||||
// Update db
|
||||
dbUpdate($stp_port,'ports_stp','`device_id` = ? AND `port_id` = ?', array($device['device_id'], $stp_port['port_id']));
|
||||
echo '.';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unset($stp_raw, $stp, $stp_db);
|
||||
unset($stp_raw, $stp, $stp_db, $stp_port);
|
||||
echo "\n";
|
||||
|
@@ -1274,4 +1274,70 @@ function register_mibs($device, $mibs, $included_by)
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
|
||||
} // register_mibs
|
||||
|
||||
/**
|
||||
* SNMPWalk_array_num - performs a numeric SNMPWalk and returns an array containing $count indexes
|
||||
* One Index:
|
||||
* From: 1.3.6.1.4.1.9.9.166.1.15.1.1.27.18.655360 = 0
|
||||
* To: $array['1.3.6.1.4.1.9.9.166.1.15.1.1.27.18']['655360'] = 0
|
||||
* Two Indexes:
|
||||
* From: 1.3.6.1.4.1.9.9.166.1.15.1.1.27.18.655360 = 0
|
||||
* To: $array['1.3.6.1.4.1.9.9.166.1.15.1.1.27']['18']['655360'] = 0
|
||||
* And so on...
|
||||
* Think snmpwalk_cache_*_oid but for numeric data.
|
||||
*
|
||||
* Why is this useful?
|
||||
* Some SNMP data contains a single index (eg. ifIndex in IF-MIB) and some is dual indexed
|
||||
* (eg. PolicyIndex/ObjectsIndex in CISCO-CLASS-BASED-QOS-MIB).
|
||||
* The resulting array allows us to easily access the top level index we want and iterate over the data from there.
|
||||
*
|
||||
* @param $device
|
||||
* @param $OID
|
||||
* @param int $indexes
|
||||
* @internal param $string
|
||||
* @return array
|
||||
*/
|
||||
function snmpwalk_array_num($device,$oid,$indexes=1) {
|
||||
$array = array();
|
||||
$string = snmp_walk($device, $oid, '-Osqn');
|
||||
|
||||
if ( $string === false) {
|
||||
// False means: No Such Object.
|
||||
return false;
|
||||
}
|
||||
if ($string == "") {
|
||||
// Empty means SNMP timeout or some such.
|
||||
return null;
|
||||
}
|
||||
|
||||
// Let's turn the string into something we can work with.
|
||||
foreach (explode("\n", $string) as $line) {
|
||||
if ($line[0] == '.') {
|
||||
// strip the leading . if it exists.
|
||||
$line = substr($line,1);
|
||||
}
|
||||
list($key, $value) = explode(' ', $line, 2);
|
||||
$prop_id = explode('.', $key);
|
||||
$value = trim($value);
|
||||
|
||||
// if we have requested more levels that exist, set to the max.
|
||||
if ($indexes > count($prop_id)) {
|
||||
$indexes = count($prop_id)-1;
|
||||
}
|
||||
|
||||
for ($i=0;$i<$indexes;$i++) {
|
||||
// Pop the index off.
|
||||
$index = array_pop($prop_id);
|
||||
$value = array($index => $value);
|
||||
}
|
||||
|
||||
// Rebuild our key
|
||||
$key = implode('.',$prop_id);
|
||||
|
||||
// Add the entry to the master array
|
||||
$array = array_replace_recursive($array,array($key => $value));
|
||||
}
|
||||
return $array;
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user