diff --git a/addhost.php b/addhost.php index 2280c54e3..381c602da 100755 --- a/addhost.php +++ b/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 ] [-f] <%Whostname%n> [community] [v1|v2c] [port] ['.implode('|', $config['snmp']['transports']).'] - Usage (SNMPv3) : Config Defaults : ./addhost.php [-g ] [-f]<%Whostname%n> any v3 [user] [port] ['.implode('|', $config['snmp']['transports']).'] - No Auth, No Priv : ./addhost.php [-g ] [-f]<%Whostname%n> nanp v3 [user] [port] ['.implode('|', $config['snmp']['transports']).'] - Auth, No Priv : ./addhost.php [-g ] [-f]<%Whostname%n> anp v3 [md5|sha] [port] ['.implode('|', $config['snmp']['transports']).'] - Auth, Priv : ./addhost.php [-g ] [-f]<%Whostname%n> ap v3 [md5|sha] [aes|dsa] [port] ['.implode('|', $config['snmp']['transports']).'] + Usage (SNMPv1/2c): ./addhost.php [-g ] [-f] [-p ] <%Whostname%n> [community] [v1|v2c] [port] ['.implode('|', $config['snmp']['transports']).'] + Usage (SNMPv3) : Config Defaults : ./addhost.php [-g ] [-f] [-p ] <%Whostname%n> any v3 [user] [port] ['.implode('|', $config['snmp']['transports']).'] + No Auth, No Priv : ./addhost.php [-g ] [-f] [-p ] <%Whostname%n> nanp v3 [user] [port] ['.implode('|', $config['snmp']['transports']).'] + Auth, No Priv : ./addhost.php [-g ] [-f] [-p ] <%Whostname%n> anp v3 [md5|sha] [port] ['.implode('|', $config['snmp']['transports']).'] + Auth, Priv : ./addhost.php [-g ] [-f] [-p ] <%Whostname%n> ap v3 [md5|sha] [aes|dsa] [port] ['.implode('|', $config['snmp']['transports']).'] -g 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 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 ' diff --git a/config.php.default b/config.php.default index f6b031cd7..2da0514e0 100755 --- a/config.php.default +++ b/config.php.default @@ -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'; diff --git a/doc/API/API-Docs.md b/doc/API/API-Docs.md index 4f9d4362f..eacdcfada 100644 --- a/doc/API/API-Docs.md +++ b/doc/API/API-Docs.md @@ -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. diff --git a/doc/Developing/Code-Structure.md b/doc/Developing/Code-Structure.md index 32fe6a60a..0448aae26 100644 --- a/doc/Developing/Code-Structure.md +++ b/doc/Developing/Code-Structure.md @@ -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. diff --git a/doc/Developing/Dynamic-Config.md b/doc/Developing/Dynamic-Config.md index acc9d3079..14c97beba 100644 --- a/doc/Developing/Dynamic-Config.md +++ b/doc/Developing/Dynamic-Config.md @@ -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) diff --git a/doc/Developing/Style-Guidelines.md b/doc/Developing/Style-Guidelines.md index d6acb1265..4d7ac9f2a 100644 --- a/doc/Developing/Style-Guidelines.md +++ b/doc/Developing/Style-Guidelines.md @@ -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 ``. -- 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 diff --git a/doc/Developing/Using-Git.md b/doc/Developing/Using-Git.md index ae2dc43fa..075d41684 100644 --- a/doc/Developing/Using-Git.md +++ b/doc/Developing/Using-Git.md @@ -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 \ No newline at end of file diff --git a/doc/Extensions/Agent-Setup.md b/doc/Extensions/Agent-Setup.md index f72e64f35..62a9ec473 100644 --- a/doc/Extensions/Agent-Setup.md +++ b/doc/Extensions/Agent-Setup.md @@ -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 diff --git a/doc/Extensions/Alerting.md b/doc/Extensions/Alerting.md index 02d1958e9..6ce8431f8 100644 --- a/doc/Extensions/Alerting.md +++ b/doc/Extensions/Alerting.md @@ -38,7 +38,7 @@ Table of Content: # About -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 # Rules -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. ## Syntax -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. ## Examples @@ -90,17 +90,17 @@ Alert when: # Templates -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. ## Syntax 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
Value: %value{/foreach}` Placeholders: @@ -123,7 +123,7 @@ Templates can be matched against several rules. ## Examples -Default Template: +Default Template: ```text %title\r\n Severity: %severity\r\n @@ -138,13 +138,13 @@ Alert sent to: {foreach %contacts}%value <%key> {/foreach} # Transports -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( ## Boxcar -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'; ## Clickatell -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'; ## PlaySMS -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"`. ## Device (Boolean) diff --git a/doc/Extensions/Authentication.md b/doc/Extensions/Authentication.md index 2f0a0eccc..adb468a51 100644 --- a/doc/Extensions/Authentication.md +++ b/doc/Extensions/Authentication.md @@ -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']['']['level'] = 10; +$config['auth_ad_groups']['']['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 `` with your Active Directory admin-user group and `` 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. ``` diff --git a/doc/Extensions/Component.md b/doc/Extensions/Component.md index 235335380..40331981d 100644 --- a/doc/Extensions/Component.md +++ b/doc/Extensions/Component.md @@ -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] => ) ) diff --git a/doc/Extensions/Device-Groups.md b/doc/Extensions/Device-Groups.md index c38db06a8..f7207b195 100644 --- a/doc/Extensions/Device-Groups.md +++ b/doc/Extensions/Device-Groups.md @@ -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 `. -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. diff --git a/doc/Extensions/Distributed-Poller.md b/doc/Extensions/Distributed-Poller.md index ee706a8b7..a951642ec 100644 --- a/doc/Extensions/Distributed-Poller.md +++ b/doc/Extensions/Distributed-Poller.md @@ -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: ![Example Setup](http://docs.librenms.org/img/librenms-distributed-diagram.png) @@ -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: diff --git a/doc/Extensions/Globe-Frontpage.md b/doc/Extensions/Globe-Frontpage.md index adac26f45..6e2d31662 100644 --- a/doc/Extensions/Globe-Frontpage.md +++ b/doc/Extensions/Globe-Frontpage.md @@ -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 diff --git a/doc/Extensions/Graylog.md b/doc/Extensions/Graylog.md index 7dd6654ce..1c0da5501 100644 --- a/doc/Extensions/Graylog.md +++ b/doc/Extensions/Graylog.md @@ -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: diff --git a/doc/Extensions/IRC-Bot-Extensions.md b/doc/Extensions/IRC-Bot-Extensions.md index 0debac380..c36b4d3cf 100644 --- a/doc/Extensions/IRC-Bot-Extensions.md +++ b/doc/Extensions/IRC-Bot-Extensions.md @@ -41,7 +41,7 @@ Function( (Type) $Variable [= Default] [,...] ) | Returns | Description ### Attributes 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. diff --git a/doc/Extensions/IRC-Bot.md b/doc/Extensions/IRC-Bot.md index 58d0b9c70..eda0bef37 100644 --- a/doc/Extensions/IRC-Bot.md +++ b/doc/Extensions/IRC-Bot.md @@ -48,7 +48,7 @@ Command | Description `.port ` | Prints Port-related information from `ifname` on given `hostname`. `.quit` | Disconnect from IRC and exit. `.reload` | Reload configuration. -`.status ` | Prints status informations for given `type`. Type can be `devices`, `services`, `ports`. Shorthands are: `dev`,`srv`,`prt` +`.status ` | 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_) diff --git a/doc/Extensions/InfluxDB.md b/doc/Extensions/InfluxDB.md index e96d3393b..d24b441f3 100644 --- a/doc/Extensions/InfluxDB.md +++ b/doc/Extensions/InfluxDB.md @@ -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. diff --git a/doc/Extensions/Memcached.md b/doc/Extensions/Memcached.md index 3d226e83a..80063c787 100644 --- a/doc/Extensions/Memcached.md +++ b/doc/Extensions/Memcached.md @@ -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. diff --git a/doc/Extensions/Network-Map.md b/doc/Extensions/Network-Map.md index 63a74352c..d2e092e35 100644 --- a/doc/Extensions/Network-Map.md +++ b/doc/Extensions/Network-Map.md @@ -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'] = '{ diff --git a/doc/Extensions/Oxidized.md b/doc/Extensions/Oxidized.md index 23153780b..e74bf5c3c 100644 --- a/doc/Extensions/Oxidized.md +++ b/doc/Extensions/Oxidized.md @@ -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 diff --git a/doc/Extensions/Plugin-System.md b/doc/Extensions/Plugin-System.md index 544f7a1a0..7307a7ff0 100644 --- a/doc/Extensions/Plugin-System.md +++ b/doc/Extensions/Plugin-System.md @@ -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() { diff --git a/doc/Extensions/Port-Description-Parser.md b/doc/Extensions/Port-Description-Parser.md index ccdf8740d..4eb7a9635 100644 --- a/doc/Extensions/Port-Description-Parser.md +++ b/doc/Extensions/Port-Description-Parser.md @@ -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 diff --git a/doc/Extensions/Proxmox.md b/doc/Extensions/Proxmox.md index 4b7f8a2a1..0733876b9 100644 --- a/doc/Extensions/Proxmox.md +++ b/doc/Extensions/Proxmox.md @@ -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. diff --git a/doc/Extensions/RRDCached.md b/doc/Extensions/RRDCached.md index 4728686fe..72609cadc 100644 --- a/doc/Extensions/RRDCached.md +++ b/doc/Extensions/RRDCached.md @@ -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. diff --git a/doc/Extensions/RRDTune.md b/doc/Extensions/RRDTune.md index 7ee7095d2..5cd1ed483 100644 --- a/doc/Extensions/RRDTune.md +++ b/doc/Extensions/RRDTune.md @@ -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 -p diff --git a/doc/Extensions/Services.md b/doc/Extensions/Services.md index dba098588..fe2608552 100644 --- a/doc/Extensions/Services.md +++ b/doc/Extensions/Services.md @@ -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 diff --git a/doc/Extensions/Smokeping.md b/doc/Extensions/Smokeping.md index c04436eb7..92c4e6078 100644 --- a/doc/Extensions/Smokeping.md +++ b/doc/Extensions/Smokeping.md @@ -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 diff --git a/doc/Extensions/Sub-Directory.md b/doc/Extensions/Sub-Directory.md index 11a74d67c..a5a99a4b8 100644 --- a/doc/Extensions/Sub-Directory.md +++ b/doc/Extensions/Sub-Directory.md @@ -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 ``` -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. diff --git a/doc/Extensions/Syslog.md b/doc/Extensions/Syslog.md index b34f9405a..cb0ef8a0b 100644 --- a/doc/Extensions/Syslog.md +++ b/doc/Extensions/Syslog.md @@ -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/ ### diff --git a/doc/Extensions/Two-Factor-Auth.md b/doc/Extensions/Two-Factor-Auth.md index 0b9c7513a..daa8b3e86 100644 --- a/doc/Extensions/Two-Factor-Auth.md +++ b/doc/Extensions/Two-Factor-Auth.md @@ -9,33 +9,33 @@ Table of Content: # About -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. # Types -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. ## Timebased One-Time-Password (TOTP) -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. ## Counterbased One-Time-Password (TOTP) -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. # Configuration diff --git a/doc/Extensions/Varnish.md b/doc/Extensions/Varnish.md index 98fda2adf..6e4421508 100644 --- a/doc/Extensions/Varnish.md +++ b/doc/Extensions/Varnish.md @@ -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:`` to: `` ```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. diff --git a/doc/General/Changelog.md b/doc/General/Changelog.md index 67d4e2bf0..54a97dacc 100644 --- a/doc/General/Changelog.md +++ b/doc/General/Changelog.md @@ -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) diff --git a/doc/General/Contributing.md b/doc/General/Contributing.md index 31d7b0bc1..4027cfeae 100644 --- a/doc/General/Contributing.md +++ b/doc/General/Contributing.md @@ -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 diff --git a/doc/General/Credits.md b/doc/General/Credits.md index b67b5d7b1..72dcf627d 100644 --- a/doc/General/Credits.md +++ b/doc/General/Credits.md @@ -28,11 +28,11 @@ LibreNMS ships with the following software components: - Code for UBNT Devices Mark Gibbons - Initial code base submited via PR721 + Initial code base submitted via PR721 - Jquery LazyLoad http://www.appelsiini.net/projects/lazyload - Mika Tuupola (@tuupola on github) + Mika Tuupola (@tuupola on GitHub) MIT License - influxdb-php diff --git a/doc/Installation/Installation-(RHEL-CentOS).md b/doc/Installation/Installation-(RHEL-CentOS).md index b899aa242..46100d078 100644 --- a/doc/Installation/Installation-(RHEL-CentOS).md +++ b/doc/Installation/Installation-(RHEL-CentOS).md @@ -153,8 +153,8 @@ Next, add the following to `/etc/httpd/conf.d/librenms.conf` ``` -__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; diff --git a/doc/Support/Configuration.md b/doc/Support/Configuration.md index 15be9ed6c..44c904e6d 100644 --- a/doc/Support/Configuration.md +++ b/doc/Support/Configuration.md @@ -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 diff --git a/doc/Support/Discovery Support.md b/doc/Support/Discovery Support.md index d08a663aa..acba7527d 100644 --- a/doc/Support/Discovery Support.md +++ b/doc/Support/Discovery Support.md @@ -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 -n Poll as instance of 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 [-d] [-l] [-h] Example: 192.168.0.0/24 -d Enable Debug -l Show Legend - -h Print this text + -h Print this text ``` diff --git a/doc/Support/FAQ.md b/doc/Support/FAQ.md index d6da5de50..8f9147e88 100644 --- a/doc/Support/FAQ.md +++ b/doc/Support/FAQ.md @@ -71,8 +71,8 @@ If the page you are trying to load has a substantial amount of data in it then i #### Why do I not see any graphs? -This is usually due to there being blank spaces outside of the `` 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 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. #### How do I debug pages not loading correctly? @@ -92,12 +92,12 @@ Please see the [Poller Support](http://docs.librenms.org/Support/Poller Support) #### Why do I get a lot apache or rrdtool zombies in my process list? -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). #### Why do I see traffic spikes in my graphs? -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 #### How can I test another users branch? -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 diff --git a/doc/Support/Features.md b/doc/Support/Features.md index 2d994c4bc..e65e697f6 100644 --- a/doc/Support/Features.md +++ b/doc/Support/Features.md @@ -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 diff --git a/doc/Support/Install Validation.md b/doc/Support/Install Validation.md index 6283a9972..ba90879de 100644 --- a/doc/Support/Install Validation.md +++ b/doc/Support/Install Validation.md @@ -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. diff --git a/doc/Support/Poller Support.md b/doc/Support/Poller Support.md index ad99c4219..9ab377378 100644 --- a/doc/Support/Poller Support.md +++ b/doc/Support/Poller Support.md @@ -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: diff --git a/doc/Support/Support-New-OS.md b/doc/Support/Support-New-OS.md index e63244a26..be2bec7c9 100644 --- a/doc/Support/Support-New-OS.md +++ b/doc/Support/Support-New-OS.md @@ -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 diff --git a/html/css/styles.css b/html/css/styles.css index ea9dde575..ead23f407 100644 --- a/html/css/styles.css +++ b/html/css/styles.css @@ -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; diff --git a/html/includes/common/generic-graph.inc.php b/html/includes/common/generic-graph.inc.php index 87bb88373..bbcf9ff33 100644 --- a/html/includes/common/generic-graph.inc.php +++ b/html/includes/common/generic-graph.inc.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2015-2016 Daniel Preussker, QuxLabs UG * 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[] = '
+
+
+ +
+
+ +
+
@@ -365,12 +373,13 @@ $(function() { '; } 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[] = ''; + $common_output[] = ''; } diff --git a/html/includes/common/stp-ports.inc.php b/html/includes/common/stp-ports.inc.php new file mode 100644 index 000000000..8cee0a7e2 --- /dev/null +++ b/html/includes/common/stp-ports.inc.php @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + +
PortPriorityStateEnablePath costDesignated rootDesignated costDesignated bridgeDesignated portForward transitions
+
+ + +'; diff --git a/html/includes/graphs/bill/bits.inc.php b/html/includes/graphs/bill/bits.inc.php index 2e80ef792..266fa86a2 100644 --- a/html/includes/graphs/bill/bits.inc.php +++ b/html/includes/graphs/bill/bits.inc.php @@ -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++; } diff --git a/html/includes/graphs/customer/bits.inc.php b/html/includes/graphs/customer/bits.inc.php index f66f91df0..ee3d4a741 100644 --- a/html/includes/graphs/customer/bits.inc.php +++ b/html/includes/graphs/customer/bits.inc.php @@ -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'; diff --git a/html/includes/graphs/device/bits.inc.php b/html/includes/graphs/device/bits.inc.php index eaeed92f4..f796490f2 100644 --- a/html/includes/graphs/device/bits.inc.php +++ b/html/includes/graphs/device/bits.inc.php @@ -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! diff --git a/html/includes/graphs/global/bits.inc.php b/html/includes/graphs/global/bits.inc.php index 763a9d103..350d96f87 100644 --- a/html/includes/graphs/global/bits.inc.php +++ b/html/includes/graphs/global/bits.inc.php @@ -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; diff --git a/html/includes/graphs/location/bits.inc.php b/html/includes/graphs/location/bits.inc.php index 53b0a656e..7f77108a9 100644 --- a/html/includes/graphs/location/bits.inc.php +++ b/html/includes/graphs/location/bits.inc.php @@ -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']; diff --git a/html/includes/graphs/multiport/bits.inc.php b/html/includes/graphs/multiport/bits.inc.php index de3206c23..e64e39b31 100644 --- a/html/includes/graphs/multiport/bits.inc.php +++ b/html/includes/graphs/multiport/bits.inc.php @@ -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++; } } diff --git a/html/includes/graphs/multiport/bits_duo.inc.php b/html/includes/graphs/multiport/bits_duo.inc.php index 205ca3834..cc9892dde 100644 --- a/html/includes/graphs/multiport/bits_duo.inc.php +++ b/html/includes/graphs/multiport/bits_duo.inc.php @@ -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; diff --git a/html/includes/graphs/multiport/bits_separate.inc.php b/html/includes/graphs/multiport/bits_separate.inc.php index d54259d02..980386286 100644 --- a/html/includes/graphs/multiport/bits_separate.inc.php +++ b/html/includes/graphs/multiport/bits_separate.inc.php @@ -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']); diff --git a/html/includes/graphs/multiport/bits_trio.inc.php b/html/includes/graphs/multiport/bits_trio.inc.php index a1112a677..563ae1b9b 100644 --- a/html/includes/graphs/multiport/bits_trio.inc.php +++ b/html/includes/graphs/multiport/bits_trio.inc.php @@ -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; diff --git a/html/includes/graphs/port/adsl_attainable.inc.php b/html/includes/graphs/port/adsl_attainable.inc.php index ad84314a0..7f2e2f33a 100644 --- a/html/includes/graphs/port/adsl_attainable.inc.php +++ b/html/includes/graphs/port/adsl_attainable.inc.php @@ -1,6 +1,6 @@ + * + * 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; +} diff --git a/html/includes/graphs/port/cbqos_qosdrops.inc.php b/html/includes/graphs/port/cbqos_qosdrops.inc.php new file mode 100644 index 000000000..36f856eed --- /dev/null +++ b/html/includes/graphs/port/cbqos_qosdrops.inc.php @@ -0,0 +1,75 @@ + + * + * 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; +} diff --git a/html/includes/graphs/port/cbqos_traffic.inc.php b/html/includes/graphs/port/cbqos_traffic.inc.php new file mode 100644 index 000000000..eabd91909 --- /dev/null +++ b/html/includes/graphs/port/cbqos_traffic.inc.php @@ -0,0 +1,75 @@ + + * + * 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; +} diff --git a/html/includes/graphs/port/etherlike.inc.php b/html/includes/graphs/port/etherlike.inc.php index b997b3050..86475f73f 100644 --- a/html/includes/graphs/port/etherlike.inc.php +++ b/html/includes/graphs/port/etherlike.inc.php @@ -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) { diff --git a/html/includes/graphs/port/nupkts.inc.php b/html/includes/graphs/port/nupkts.inc.php index 175bae6d8..a4c4296b1 100644 --- a/html/includes/graphs/port/nupkts.inc.php +++ b/html/includes/graphs/port/nupkts.inc.php @@ -1,15 +1,17 @@ '-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, diff --git a/html/includes/print-interface.inc.php b/html/includes/print-interface.inc.php index e191f75db..ab8278501 100644 --- a/html/includes/print-interface.inc.php +++ b/html/includes/print-interface.inc.php @@ -338,10 +338,10 @@ echo ''; // 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)) { diff --git a/html/includes/print-stp.inc.php b/html/includes/print-stp.inc.php index e256be9c8..e2a838385 100644 --- a/html/includes/print-stp.inc.php +++ b/html/includes/print-stp.inc.php @@ -1,5 +1,6 @@ '; $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 " - $key - $stp[$key] + $key + $stp[$key] "; } +echo ''; diff --git a/html/includes/table/stp-ports.inc.php b/html/includes/table/stp-ports.inc.php new file mode 100644 index 000000000..5f80e06c1 --- /dev/null +++ b/html/includes/table/stp-ports.inc.php @@ -0,0 +1,57 @@ + generate_port_link($stp_ports_db, $stp_ports_db['ifName'])."
".$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'])."
".$stp_ports_db['designatedRoot'], + 'designatedCost' => $stp_ports_db['designatedCost'], + 'designatedBridge' => generate_device_link($bridge_device, $bridge_device['hostname'])."
".$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); diff --git a/html/pages/addhost.inc.php b/html/pages/addhost.inc.php index 2844982d7..fdbf9b0e3 100644 --- a/html/pages/addhost.inc.php +++ b/html/pages/addhost.inc.php @@ -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.''; } +?> + +
+ +
+ +
+
diff --git a/html/pages/device/apps/ceph.inc.php b/html/pages/device/apps/ceph.inc.php index 988d64803..50dedc8c4 100644 --- a/html/pages/device/apps/ceph.inc.php +++ b/html/pages/device/apps/ceph.inc.php @@ -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 '

'.$pool.' Reads/Writes

'; @@ -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 '

'.$osd.' Latency

'; @@ -57,6 +61,8 @@ foreach ($graphs as $key => $text) { $pool = $pools[1]; if ($pool == "c") { echo '

Cluster Usage

'; + $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 '

'.$pool.' Usage

'; + $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 ''; echo '

'.$pool.' Objects

'; + $graph_array['to'] = $config['time']['now']; + $graph_array['id'] = $app['app_id']; $graph_array['type'] = 'application_ceph_pool_objects'; $graph_array['pool'] = $pool; diff --git a/html/pages/device/edit/snmp.inc.php b/html/pages/device/edit/snmp.inc.php index cf2054cfc..b77f3dcc4 100644 --- a/html/pages/device/edit/snmp.inc.php +++ b/html/pages/device/edit/snmp.inc.php @@ -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 "
+
+ +
+ +
+
diff --git a/html/pages/device/overview/generic/sensor.inc.php b/html/pages/device/overview/generic/sensor.inc.php index 076f5b049..ef4288e7c 100644 --- a/html/pages/device/overview/generic/sensor.inc.php +++ b/html/pages/device/overview/generic/sensor.inc.php @@ -1,6 +1,6 @@ diff --git a/html/pages/device/port.inc.php b/html/pages/device/port.inc.php index b00b36855..d1682ee56 100644 --- a/html/pages/device/port.inc.php +++ b/html/pages/device/port.inc.php @@ -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; diff --git a/html/pages/device/port/adsl.inc.php b/html/pages/device/port/adsl.inc.php index 170f2a2c5..b9230ccfb 100644 --- a/html/pages/device/port/adsl.inc.php +++ b/html/pages/device/port/adsl.inc.php @@ -1,6 +1,6 @@ ADSL Line Speed
'; $graph_type = 'port_adsl_speed'; diff --git a/html/pages/device/port/cbqos.inc.php b/html/pages/device/port/cbqos.inc.php new file mode 100644 index 000000000..e85d3de25 --- /dev/null +++ b/html/pages/device/port/cbqos.inc.php @@ -0,0 +1,130 @@ + + * + * 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 "
    "; + echo "
  • "; + if ($array['qos-type'] == 1) { + // Its a policy, we need to make it a link. + echo('' . $array['label'] . ''); + } + else { + // No policy, no link + echo $array['label']; + } + if (isset($array['match'])) { + echo ' ('.$array['match'].')'; + } + + find_child($components,$id,$level+1); + + echo "
  • "; + echo "
"; + } + } +} + +$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 "
    "; + echo '
     Ingress Policy:
    '; + $found = false; + foreach ($components as $id => $array) { + if ( ($array['qos-type'] == 1) && ($array['ifindex'] == $port['ifIndex']) && ($array['direction'] == 1) && ($array['parent'] == 0) ) { + echo "
  • "; + echo('' . $array['label'] . ''); + find_child($components,$id,1); + echo "
  • "; + $found = true; + } + } + if (!$found) { + // No Ingress policies + echo '
    No Policies
    '; + } + echo '
'; + + // Display the egress policy at the top of the page. + echo "
    "; + echo '
     Egress Policy:
    '; + $found = false; + foreach ($components as $id => $array) { + if ( ($array['qos-type'] == 1) && ($array['ifindex'] == $port['ifIndex']) && ($array['direction'] == 2) && ($array['parent'] == 0) ) { + echo "
  • "; + echo('' . $array['label'] . ''); + find_child($components,$id,1); + echo "
  • "; + $found = true; + } + } + if (!$found) { + // No Egress policies + echo '
    No Policies
    '; + } + echo "
\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 "
 
\n\n"; + + // Display each graph row. + echo "
"; + echo "
Traffic by CBQoS Class - ".$components[$vars['policy']]['label']."
"; + $graph_array['policy'] = $vars['policy']; + $graph_type = 'port_cbqos_traffic'; + include 'includes/print-interface-graphs.inc.php'; + + echo "
QoS Drops by CBQoS Class - ".$components[$vars['policy']]['label']."
"; + $graph_array['policy'] = $vars['policy']; + $graph_type = 'port_cbqos_bufferdrops'; + include 'includes/print-interface-graphs.inc.php'; + + echo "
Buffer Drops by CBQoS Class - ".$components[$vars['policy']]['label']."
"; + $graph_array['policy'] = $vars['policy']; + $graph_type = 'port_cbqos_qosdrops'; + include 'includes/print-interface-graphs.inc.php'; + echo "
\n\n"; + } + } +} diff --git a/html/pages/device/port/graphs.inc.php b/html/pages/device/port/graphs.inc.php index e56f24bf3..64fdde60a 100644 --- a/html/pages/device/port/graphs.inc.php +++ b/html/pages/device/port/graphs.inc.php @@ -1,6 +1,6 @@
@@ -41,7 +41,7 @@ if (file_exists($config['rrd_dir'].'/'.$device['hostname'].'/port-'.$port['ifInd include 'includes/print-interface-graphs.inc.php'; echo '
'; - 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 '

Ethernet Errors

diff --git a/html/pages/device/stp.inc.php b/html/pages/device/stp.inc.php index 74a803b0b..37ccd55fa 100644 --- a/html/pages/device/stp.inc.php +++ b/html/pages/device/stp.inc.php @@ -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 ''; - -$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 '
'; - $pagetitle[] = 'STP'; diff --git a/html/pages/iftype.inc.php b/html/pages/iftype.inc.php index 05cfa2217..266b98fb6 100644 --- a/html/pages/iftype.inc.php +++ b/html/pages/iftype.inc.php @@ -94,7 +94,7 @@ if ($if_list) { echo '
'; - 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'; diff --git a/includes/common.php b/includes/common.php index 0b7a63573..33a31cde9 100644 --- a/includes/common.php +++ b/includes/common.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; +} diff --git a/includes/defaults.inc.php b/includes/defaults.inc.php index a02588729..f646317d6 100644 --- a/includes/defaults.inc.php +++ b/includes/defaults.inc.php @@ -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'; diff --git a/includes/definitions.inc.php b/includes/definitions.inc.php index 9d1e960dc..07550b2e3 100644 --- a/includes/definitions.inc.php +++ b/includes/definitions.inc.php @@ -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'; diff --git a/includes/discovery/cisco-cbqos.inc.php b/includes/discovery/cisco-cbqos.inc.php new file mode 100644 index 000000000..2082c950e --- /dev/null +++ b/includes/discovery/cisco-cbqos.inc.php @@ -0,0 +1,184 @@ + + * + * 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 + +} diff --git a/includes/discovery/os/eatonpdu.inc.php b/includes/discovery/os/eatonpdu.inc.php new file mode 100644 index 000000000..8445e1817 --- /dev/null +++ b/includes/discovery/os/eatonpdu.inc.php @@ -0,0 +1,17 @@ + + * 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'; + } +} diff --git a/includes/discovery/ports.inc.php b/includes/discovery/ports.inc.php index 32067fa05..c682fa6e5 100644 --- a/includes/discovery/ports.inc.php +++ b/includes/discovery/ports.inc.php @@ -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); diff --git a/includes/discovery/sensors/current/eatonpdu.inc.php b/includes/discovery/sensors/current/eatonpdu.inc.php new file mode 100644 index 000000000..f69ada216 --- /dev/null +++ b/includes/discovery/sensors/current/eatonpdu.inc.php @@ -0,0 +1,23 @@ + + * 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); + } + } +} diff --git a/includes/discovery/sensors/temperatures/cisco-envmon.inc.php b/includes/discovery/sensors/temperatures/cisco-envmon.inc.php index 74408318d..2268f2b33 100644 --- a/includes/discovery/sensors/temperatures/cisco-envmon.inc.php +++ b/includes/discovery/sensors/temperatures/cisco-envmon.inc.php @@ -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); + } } } } diff --git a/includes/discovery/stp.inc.php b/includes/discovery/stp.inc.php index c6be49f56..6e85a8ff0 100644 --- a/includes/discovery/stp.inc.php +++ b/includes/discovery/stp.inc.php @@ -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"; diff --git a/includes/functions.php b/includes/functions.php index f97dd4177..e399a10ae 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -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); diff --git a/includes/polling/bgp-peers.inc.php b/includes/polling/bgp-peers.inc.php index 40ff425a0..d50524020 100644 --- a/includes/polling/bgp-peers.inc.php +++ b/includes/polling/bgp-peers.inc.php @@ -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); } diff --git a/includes/polling/cisco-cbqos.inc.php b/includes/polling/cisco-cbqos.inc.php new file mode 100644 index 000000000..e113b4fa2 --- /dev/null +++ b/includes/polling/cisco-cbqos.inc.php @@ -0,0 +1,72 @@ + + * + * 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); +} \ No newline at end of file diff --git a/includes/polling/os/eatonpdu.inc.php b/includes/polling/os/eatonpdu.inc.php new file mode 100644 index 000000000..c5343e743 --- /dev/null +++ b/includes/polling/os/eatonpdu.inc.php @@ -0,0 +1,15 @@ + + * 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'), '"'); diff --git a/includes/polling/port-adsl.inc.php b/includes/polling/port-adsl.inc.php index 883cfcced..e3567e26b 100644 --- a/includes/polling/port-adsl.inc.php +++ b/includes/polling/port-adsl.inc.php @@ -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'; diff --git a/includes/polling/port-etherlike.inc.php b/includes/polling/port-etherlike.inc.php index 0576d4b19..bf947b92d 100644 --- a/includes/polling/port-etherlike.inc.php +++ b/includes/polling/port-etherlike.inc.php @@ -1,13 +1,14 @@ -// -- 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); diff --git a/includes/polling/stp.inc.php b/includes/polling/stp.inc.php index d9886a58c..a7003659c 100644 --- a/includes/polling/stp.inc.php +++ b/includes/polling/stp.inc.php @@ -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"; diff --git a/includes/snmp.inc.php b/includes/snmp.inc.php index 635346a37..15d89bbd9 100644 --- a/includes/snmp.inc.php +++ b/includes/snmp.inc.php @@ -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; +} diff --git a/mibs/EATON-EPDU-MIB b/mibs/EATON-EPDU-MIB new file mode 100755 index 000000000..9cda4f47f --- /dev/null +++ b/mibs/EATON-EPDU-MIB @@ -0,0 +1,3013 @@ + +EATON-EPDU-MIB DEFINITIONS ::= BEGIN + +IMPORTS + OBJECT-TYPE, NOTIFICATION-TYPE, MODULE-IDENTITY, + Counter32, Unsigned32, Integer32 + FROM SNMPv2-SMI + NOTIFICATION-GROUP, OBJECT-GROUP, MODULE-COMPLIANCE + FROM SNMPv2-CONF + TEXTUAL-CONVENTION, DateAndTime, DisplayString + FROM SNMPv2-TC + pduAgent + FROM EATON-OIDS; + +eatonEpdu MODULE-IDENTITY + LAST-UPDATED "201312181200Z" + ORGANIZATION + "Eaton Corporation" + CONTACT-INFO + "www.eaton.com/epdu" + DESCRIPTION + "The MIB module for Eaton ePDUs (Enclosure Power Distribution Units)." + + REVISION "201409291200Z" + DESCRIPTION + "Added outletControlSwitchable and outletControlShutoffDelay object." + + REVISION "201312181200Z" + DESCRIPTION + "Added notifyStrappingStatus and strappingStatus object." + + REVISION "201309021200Z" + DESCRIPTION + "- Add values for commInterface : ftp (4), xml (5)" + + REVISION "201305291200Z" + DESCRIPTION + "- Edited values for outletType: removed nema51520(21); added nemaL715(29), rf203p277 (30)" + + REVISION "201302211200Z" + DESCRIPTION + "- Added unit objects : unitType. + - Added input objects : inputCurrentCrestFactor, inputCurrentPercentLoad, inputPowerFactor, inputVAR, inputPlugType. + - Added gang objects : groupCurrentCrestFactor, groupCurrentPercentLoad, groupPowerFactor, groupVAR. + - Added outlet objects : outletCurrentCrestFactor, outletCurrentPercentLoad, outletPowerFactor, outletVAR." + + REVISION "201111211200Z" + DESCRIPTION + "- Added notifyGroupBreakerStatus object. + - Renamed groupStatus object to groupBreakerStatus. This object had not yet + been implemented so there is no user impact. + - Updated descriptions for inputWhTimer, groupWhTimer, and outletWhTimer." + + REVISION "201110241200Z" + DESCRIPTION + "- Added notifyBootUp object. + - Added outletType object. + - Updated description for all lower and upper thresholds to indicate that + a value of -1 indicates that it is not supported by a particular ePDU model. + - Updated descriptions for inputVA, inputWatts, groupVA, groupWatts, outletVA, + outletWatts to indicate that a value of -1 indicates that it is not + supported by a particular ePDU model. + - Added a note to unit, group, and outlet level control command objects + indicating that some products (mainly with part numbers that begin with IPV + or IPC) do not support delayed outlet control commands and will reply with + an error if a command value is written that is > 0. + - Corrected description for inputType. + - Added a UnixTimeStamp Textual Convention and changed the SYNTAX of + inputWhTimer, groupWhTimer, and outletWhTimer to use it. + - Updated the contact info to reference the ePDU website." + + REVISION "201102071529Z" + DESCRIPTION + "Initial release." +::= { pduAgent 7 } + + +UnixTimeStamp ::= TEXTUAL-CONVENTION + STATUS current + DESCRIPTION + "Unix time stamp. Measured in seconds since January 1, 1970." + SYNTAX Counter32 + + +-- eatonEpdu { iso org(3) dod(6) internet(1) private(4) +-- enterprises(1) eaton(534) products(6) pduAgent(6) (7) } + +notifications OBJECT IDENTIFIER ::= { eatonEpdu 0 } +units OBJECT IDENTIFIER ::= { eatonEpdu 1 } +inputs OBJECT IDENTIFIER ::= { eatonEpdu 3 } +groups OBJECT IDENTIFIER ::= { eatonEpdu 5 } +outlets OBJECT IDENTIFIER ::= { eatonEpdu 6 } +environmental OBJECT IDENTIFIER ::= { eatonEpdu 7 } +conformance OBJECT IDENTIFIER ::= { eatonEpdu 25 } +objectGroups OBJECT IDENTIFIER ::= { conformance 5 } + +notifyUserLogin NOTIFICATION-TYPE + OBJECTS { userName, + commInterface } + STATUS current + DESCRIPTION + "Sent whenever a user logs in." + ::= { notifications 1 } + +notifyUserLogout NOTIFICATION-TYPE + OBJECTS { userName, + commInterface } + STATUS current + DESCRIPTION + "Sent whenever a user logs out." + ::= { notifications 2 } + +notifyFailedLogin NOTIFICATION-TYPE + OBJECTS { userName, + commInterface } + STATUS current + DESCRIPTION + "Sent when someone attempts to log in and fails. On some models, may be + sent after three failed login attempts." + ::= { notifications 3 } + +notifyBootUp NOTIFICATION-TYPE + OBJECTS { strappingIndex } + STATUS current + DESCRIPTION + "Sent whenever an ePDU finishes booting up (hard or soft reboot)." + ::= { notifications 4 } + +notifyInputVoltageThStatus NOTIFICATION-TYPE + OBJECTS { strappingIndex, + inputIndex, + inputVoltageIndex, + inputVoltage, + inputVoltageThStatus } + STATUS current + DESCRIPTION + "Sent whenever an input voltage threshold status changes." + ::= { notifications 11 } + +notifyInputCurrentThStatus NOTIFICATION-TYPE + OBJECTS { strappingIndex, + inputIndex, + inputCurrentIndex, + inputCurrent, + inputCurrentThStatus } + STATUS current + DESCRIPTION + "Sent whenever an input current threshold status changes." + ::= { notifications 12 } + +notifyInputFrequencyStatus NOTIFICATION-TYPE + OBJECTS { strappingIndex, + inputIndex, + inputFrequency, + inputFrequencyStatus } + STATUS current + DESCRIPTION + "Sent whenever the input frequency status changes." + ::= { notifications 13 } + +notifyGroupVoltageThStatus NOTIFICATION-TYPE + OBJECTS { strappingIndex, + groupIndex, + groupVoltage, + groupVoltageThStatus } + STATUS current + DESCRIPTION + "Sent whenever a group voltage threshold status changes." + ::= { notifications 21 } + +notifyGroupCurrentThStatus NOTIFICATION-TYPE + OBJECTS { strappingIndex, + groupIndex, + groupCurrent, + groupCurrentThStatus } + STATUS current + DESCRIPTION + "Sent whenever a group current threshold status changes." + ::= { notifications 22 } + +notifyGroupBreakerStatus NOTIFICATION-TYPE + OBJECTS { strappingIndex, + groupIndex, + groupBreakerStatus } + STATUS current + DESCRIPTION + "Sent whenever a group status changes to indicate whether the circuit + breaker is on or off." + ::= { notifications 23 } + +notifyOutletVoltageThStatus NOTIFICATION-TYPE + OBJECTS { strappingIndex, + outletIndex, + outletVoltage, + outletVoltageThStatus } + STATUS current + DESCRIPTION + "Sent whenever an outlet voltage threshold status changes." + ::= { notifications 31 } + +notifyOutletCurrentThStatus NOTIFICATION-TYPE + OBJECTS { strappingIndex, + outletIndex, + outletCurrent, + outletCurrentThStatus } + STATUS current + DESCRIPTION + "Sent whenever an outlet current threshold status changes." + ::= { notifications 32 } + +notifyOutletControlStatus NOTIFICATION-TYPE + OBJECTS { strappingIndex, + outletIndex, + outletControlStatus } + STATUS current + DESCRIPTION + "Sent whenever an outlet state On / Off changes." + ::= { notifications 33 } + +notifyTemperatureThStatus NOTIFICATION-TYPE + OBJECTS { strappingIndex, + temperatureIndex, + temperatureValue, + temperatureThStatus } + STATUS current + DESCRIPTION + "Sent whenever a temperature threshold status changes." + ::= { notifications 41 } + +notifyHumidityThStatus NOTIFICATION-TYPE + OBJECTS { strappingIndex, + humidityIndex, + humidityValue, + humidityThStatus } + STATUS current + DESCRIPTION + "Sent whenever a humidity threshold status changes." + ::= { notifications 42 } + +notifyContactState NOTIFICATION-TYPE + OBJECTS { strappingIndex, + contactIndex, + contactState } + STATUS current + DESCRIPTION + "Sent whenever a contact sensor state changes." + ::= { notifications 43 } + +notifyProbeStatus NOTIFICATION-TYPE + OBJECTS { strappingIndex, + temperatureIndex, + temperatureProbeStatus } + STATUS current + DESCRIPTION + "Sent whenever the environment probe status changes." + ::= { notifications 44 } + +notifyCommunicationStatus NOTIFICATION-TYPE + OBJECTS { strappingIndex, + communicationStatus } + STATUS current + DESCRIPTION + "Sent whenever the PDU communication status changes." + ::= { notifications 51 } + +notifyInternalStatus NOTIFICATION-TYPE + OBJECTS { strappingIndex, + internalStatus } + STATUS current + DESCRIPTION + "Sent whenever the PDU internal status changes." + ::= { notifications 52 } + +notifyTest NOTIFICATION-TYPE + STATUS current + DESCRIPTION + "Sent whenever the trap test feature is used by the communication card." + ::= { notifications 53 } + +notifyStrappingStatus NOTIFICATION-TYPE + OBJECTS { strappingIndex, + strappingStatus } + STATUS current + DESCRIPTION + "Sent whenever the strapping communication status changes." + ::= { notifications 54 } + +unitsPresent OBJECT-TYPE + SYNTAX DisplayString + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Each unit is identified by a Strapping Index. This object returns a comma-delimited list of the + Strapping Indexes of all units present in the strapping group. For example, if units 0, 1, 5, + and 7 are present, this value will be '0,1,5,7'. For units that do not support strapping, + a Strapping Index of '0' is assumed." + ::= { units 1 } + +unitTable OBJECT-TYPE + SYNTAX SEQUENCE OF UnitEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A list of units. In most cases this list will only contain one entry. + However, some units have a 'strapping' feature which allow units to be + daisy-chained together such that all of them can be accessed through + the SNMP interface of the master. If strapping is enabled, the + strapping indexes of the units that can be accessed will be listed in the + unitsPresent object." + ::= { units 2 } + +unitEntry OBJECT-TYPE + SYNTAX UnitEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "An entry for a PDU." + INDEX { strappingIndex } + ::= { unitTable 1 } + +UnitEntry ::= SEQUENCE { + strappingIndex + Integer32, + productName + OCTET STRING, + partNumber + OCTET STRING, + serialNumber + OCTET STRING, + firmwareVersion + OCTET STRING, + unitName + OCTET STRING, + lcdControl + INTEGER, + clockValue + DateAndTime, + temperatureScale + INTEGER, + unitType + INTEGER, + inputCount + Integer32, + groupCount + Integer32, + outletCount + Integer32, + temperatureCount + Integer32, + humidityCount + Integer32, + contactCount + Integer32, + communicationStatus + INTEGER, + internalStatus + INTEGER, + strappingStatus + INTEGER, + userName + OCTET STRING, + commInterface + INTEGER +} + +strappingIndex OBJECT-TYPE + SYNTAX Integer32 (0..23) + MAX-ACCESS accessible-for-notify + STATUS current + DESCRIPTION + "For units that support 'strapping' functionality, this will be a unique + value for each unit. If units do not support 'strapping', this will + always be '0'." + ::= { unitEntry 1 } + +productName OBJECT-TYPE + SYNTAX OCTET STRING (SIZE(1..127)) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Name of the product." + ::= { unitEntry 2 } + +partNumber OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Part number of the unit." + ::= { unitEntry 3 } + +serialNumber OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Serial number of the unit." + ::= { unitEntry 4 } + +firmwareVersion OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Firmware version." + ::= { unitEntry 5 } + +unitName OBJECT-TYPE + SYNTAX OCTET STRING (SIZE(1..63)) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Descriptive name for the unit." + ::= { unitEntry 6 } + +lcdControl OBJECT-TYPE + SYNTAX INTEGER { + notApplicable (0), + lcdScreenOff (1), + lcdKeyLock (2), + lcdScreenOffAndKeyLock (3) + } + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Control the local LCD." + ::= { unitEntry 7 } + +clockValue OBJECT-TYPE + SYNTAX DateAndTime + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Clock value. This could be from either a real-time clock (in which case + it is likely writeable) or from a time server via NTP (probably read-only)." + ::= { unitEntry 8 } + +temperatureScale OBJECT-TYPE + SYNTAX INTEGER { + celsius (0), + fahrenheit (1) + } + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Scale used to return temperature objects." + ::= { unitEntry 9 } + +unitType OBJECT-TYPE + SYNTAX INTEGER { + unknown (0), + switched (1), + advancedMonitored (2), + managed (3), + monitored (4) + } + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Technical capabilities of the PDU. Functionality is as follows: + Monitored (MI) - input and usually section/group monitoring. + Advanced Monitored (AM) - input, section/group, and outlet monitoring. + Switched (SW) - input and section/group monitoring, outlet switching. + Managed (MA) - input, section/group, and outlet monitoring plug outlet switching." + ::= { unitEntry 10 } + +inputCount OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Number of inputs on this ePDU." + ::= { unitEntry 20 } + +groupCount OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Number of groups on this ePDU. Groups include breakers, outlet sections, + and user-defined groups." + ::= { unitEntry 21 } + +outletCount OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Number of outlets on this ePDU." + ::= { unitEntry 22 } + +temperatureCount OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Max number of temperature measurements on this ePDU." + ::= { unitEntry 23 } + +humidityCount OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Max number of humidity measurements on this ePDU." + ::= { unitEntry 24 } + +contactCount OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Max number of contact sensors on this ePDU." + ::= { unitEntry 25 } + +communicationStatus OBJECT-TYPE + SYNTAX INTEGER { + good (0), + communicationLost (1) + } + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Status of the internal communication with the PDU." + ::= { unitEntry 30 } + +internalStatus OBJECT-TYPE + SYNTAX INTEGER { + good (0), + internalFailure (1) + } + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Status of the internal failure inside the PDU." + ::= { unitEntry 31 } + +strappingStatus OBJECT-TYPE + SYNTAX INTEGER { + good (0), + communicationLost (1) + } + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Status of the external communication with a strapping unit." + ::= { unitEntry 32 } + +userName OBJECT-TYPE + SYNTAX OCTET STRING (SIZE(0..31)) + MAX-ACCESS accessible-for-notify + STATUS current + DESCRIPTION + "Username used to log into the PDU." + ::= { unitEntry 40 } + +commInterface OBJECT-TYPE + SYNTAX INTEGER { + serial (0), + usb (1), + telnet (2), + web (3), + ftp (4), + xml (5) + } + MAX-ACCESS accessible-for-notify + STATUS current + DESCRIPTION + "Communications interface used to log into the PDU." + ::= { unitEntry 41 } + +unitControlTable OBJECT-TYPE + SYNTAX SEQUENCE OF UnitControlEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A list of units that have controllable outlets." + ::= { units 3 } + +unitControlEntry OBJECT-TYPE + SYNTAX UnitControlEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "An entry for a PDU which has controllable outlets." + INDEX { strappingIndex } + ::= { unitControlTable 1 } + +UnitControlEntry ::= SEQUENCE { + unitControlOffCmd + Integer32, + unitControlOnCmd + Integer32 +} + +unitControlOffCmd OBJECT-TYPE + SYNTAX Integer32 (-1..99999) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Unit-level outlet control command. + + Once the command is issued, outlets will turn Off. + 0-n : Time in seconds until the outlet Sequence Off command is issued + -1 : Cancel a pending unit-level Off command + + When read, returns -1 if no command is pending, or the current downcount in seconds of a pending command. + + Certain ePDUs (mainly those with part numbers beginning with IPV or IPC) do not support delayed control + commands. These will respond with an error if a command value of > 0 is written to this object." + ::= { unitControlEntry 2 } + +unitControlOnCmd OBJECT-TYPE + SYNTAX Integer32 (-1..99999) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Unit-level outlet control command. + + Once the command is issued, outlets will turn On according to their outletControlSequenceDelay value. + 0-n : Time in seconds until the outlet Sequence On command is issued + -1 : Cancel a pending unit-level On command + + When read, returns -1 if no command is pending, or the current downcount in seconds of a pending command. + + Certain ePDUs (mainly those with part numbers beginning with IPV or IPC) do not support delayed control + commands. These will respond with an error if a command value of > 0 is written to this object." + ::= { unitControlEntry 3 } + +inputTable OBJECT-TYPE + SYNTAX SEQUENCE OF InputEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "List of inputs to the PDU." + ::= { inputs 1 } + +inputEntry OBJECT-TYPE + SYNTAX InputEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "An entry for a particular input." + INDEX { strappingIndex, + inputIndex } + ::= { inputTable 1 } + +InputEntry ::= SEQUENCE { + inputIndex + Integer32, + inputType + INTEGER, + inputFrequency + Integer32, + inputFrequencyStatus + INTEGER, + inputVoltageCount + Integer32, + inputCurrentCount + Integer32, + inputPowerCount + Integer32, + inputPlugType + INTEGER +} + +inputIndex OBJECT-TYPE + SYNTAX Integer32 (1..2) + MAX-ACCESS accessible-for-notify + STATUS current + DESCRIPTION + "A unique value for each input. Its value ranges from 1 to inputCount." + ::= { inputEntry 1 } + +inputType OBJECT-TYPE + SYNTAX INTEGER { + singlePhase (1), + splitPhase (2), + threePhaseDelta (3), + threePhaseWye (4) + } + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Type of input - single phase, split phase, three phase delta, or three + phase wye." + ::= { inputEntry 2 } + +inputFrequency OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Units are 0.1 Hz; divide by ten to get Hz." + ::= { inputEntry 3 } + +inputFrequencyStatus OBJECT-TYPE + SYNTAX INTEGER { + good (0), + outOfRange (1) + } + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Status of the measured input frequency relative to the nominal frequency and the admitted tolerance." + ::= { inputEntry 4 } + +inputVoltageCount OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Number of input voltage measurements on this ePDU." + ::= { inputEntry 5 } + +inputCurrentCount OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Number of input current measurements on this ePDU." + ::= { inputEntry 6 } + +inputPowerCount OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Number of rows in the inputPowerTable." + ::= { inputEntry 7 } + +inputPlugType OBJECT-TYPE + SYNTAX INTEGER { + other1Phase (100), + other2Phase (200), + other3Phase (300), + iecC14Inlet (101), + iecC20Inlet (102), + iec316P6 (103), + iec332P6 (104), + iec360P6 (105), + iecC14Plug (106), + iecC20Plug (107), + nema515 (120), + nemaL515 (121), + nema520 (122), + nemaL520 (123), + nema615 (124), + nemaL615 (125), + nemaL530 (126), + nema620 (127), + nemaL620 (128), + nemaL630 (129), + cs8265 (130), + french (150), + schuko (151), + uk (152), + nemaL1420 (201), + nemaL1430 (202), + iec516P6 (301), + iec460P9 (302), + iec560P9 (303), + iec532P6 (304), + iec563P6 (306), + nemaL1520 (320), + nemaL2120 (321), + nemaL1530 (322), + nemaL2130 (323), + cs8365 (324), + nemaL2220 (325), + nemaL2230 (326), + bladeUps208V (350), + bladeUps400V (351) + } + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Identifies which plug is on the input." + ::= { inputEntry 8 } + +inputVoltageTable OBJECT-TYPE + SYNTAX SEQUENCE OF InputVoltageEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A list of input voltage measurements. The number of entries + is given by inputVoltageCount." + ::= { inputs 2 } + +inputVoltageEntry OBJECT-TYPE + SYNTAX InputVoltageEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "An entry for a particular input voltage measurement." + INDEX { strappingIndex, + inputIndex, + inputVoltageIndex } + ::= { inputVoltageTable 1 } + +InputVoltageEntry ::= SEQUENCE { + inputVoltageIndex + Integer32, + inputVoltageMeasType + INTEGER, + inputVoltage + Integer32, + inputVoltageThStatus + INTEGER, + inputVoltageThLowerWarning + Integer32, + inputVoltageThLowerCritical + Integer32, + inputVoltageThUpperWarning + Integer32, + inputVoltageThUpperCritical + Integer32 +} + +inputVoltageIndex OBJECT-TYPE + SYNTAX Integer32 (1..3) + MAX-ACCESS accessible-for-notify + STATUS current + DESCRIPTION + "A unique value for each input voltage measurement. Its value ranges + from 1 to inputVoltageCount." + ::= { inputVoltageEntry 1 } + +inputVoltageMeasType OBJECT-TYPE + SYNTAX INTEGER { + singlePhase (1), + phase1toN (2), + phase2toN (3), + phase3toN (4), + phase1to2 (5), + phase2to3 (6), + phase3to1 (7) + } + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Value indicates what input voltage is being measured in this table row - single phase + voltage, phase 1 to neutral, phase 2 to neutral, phase 3 to neutral, phase 1 to phase 2, + phase 2 to phase 3, or phase 3 to phase 1." + ::= { inputVoltageEntry 2 } + +inputVoltage OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "An input voltage measurement value. Units are millivolts." + ::= { inputVoltageEntry 3 } + +inputVoltageThStatus OBJECT-TYPE + SYNTAX INTEGER { + good (0), + lowWarning (1), + lowCritical (2), + highWarning (3), + highCritical (4) + } + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Status of the measured input voltage relative to the configured thresholds." + ::= { inputVoltageEntry 4 } + +inputVoltageThLowerWarning OBJECT-TYPE + SYNTAX Integer32 (-1..500000) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Lower warning threshold. Units are millivolts. A negative value indicates + that this object is not available." + ::= { inputVoltageEntry 5 } + +inputVoltageThLowerCritical OBJECT-TYPE + SYNTAX Integer32 (-1..500000) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Lower critical threshold. Units are millivolts. A negative value indicates + that this object is not available." + ::= { inputVoltageEntry 6 } + +inputVoltageThUpperWarning OBJECT-TYPE + SYNTAX Integer32 (-1..500000) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Upper warning threshold. Units are millivolts. A negative value indicates + that this object is not available." + ::= { inputVoltageEntry 7 } + +inputVoltageThUpperCritical OBJECT-TYPE + SYNTAX Integer32 (-1..500000) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Upper critical threshold. Units are millivolts. A negative value indicates + that this object is not available." + ::= { inputVoltageEntry 8 } + +inputCurrentTable OBJECT-TYPE + SYNTAX SEQUENCE OF InputCurrentEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A list of input current measurements. The number of entries + is given by inputCurrentCount." + ::= { inputs 3 } + +inputCurrentEntry OBJECT-TYPE + SYNTAX InputCurrentEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "An entry for a particular input current measurement." + INDEX { strappingIndex, + inputIndex, + inputCurrentIndex } + ::= { inputCurrentTable 1 } + +InputCurrentEntry ::= SEQUENCE { + inputCurrentIndex + Integer32, + inputCurrentMeasType + INTEGER, + inputCurrentCapacity + Integer32, + inputCurrent + Integer32, + inputCurrentThStatus + INTEGER, + inputCurrentThLowerWarning + Integer32, + inputCurrentThLowerCritical + Integer32, + inputCurrentThUpperWarning + Integer32, + inputCurrentThUpperCritical + Integer32, + inputCurrentCrestFactor + Integer32, + inputCurrentPercentLoad + Integer32 +} + +inputCurrentIndex OBJECT-TYPE + SYNTAX Integer32 (1..4) + MAX-ACCESS accessible-for-notify + STATUS current + DESCRIPTION + "A unique value for each input current measurement. Its value ranges + from 1 to inputCurrentCount." + ::= { inputCurrentEntry 1 } + +inputCurrentMeasType OBJECT-TYPE + SYNTAX INTEGER { + singlePhase (1), + neutral (2), + phase1 (3), + phase2 (4), + phase3 (5) + } + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Which input wire is being measured in this table row - single phase, neutral, phase 1, + phase 2, or phase 3." + ::= { inputCurrentEntry 2 } + +inputCurrentCapacity OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Rated current capacity of the input. A negative value indicates that + the hardware current capacity is unknown. Units are milliamps." + ::= { inputCurrentEntry 3 } + +inputCurrent OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "An input current measurement value. Units are milliamps." + ::= { inputCurrentEntry 4 } + +inputCurrentThStatus OBJECT-TYPE + SYNTAX INTEGER { + good (0), + lowWarning (1), + lowCritical (2), + highWarning (3), + highCritical (4) + } + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Status of the measured input current relative to the configured thresholds." + ::= { inputCurrentEntry 5 } + +inputCurrentThLowerWarning OBJECT-TYPE + SYNTAX Integer32 (-1..100000) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Lower warning threshold. Units are milliamps. A negative value indicates + that this object is not available." + ::= { inputCurrentEntry 6 } + +inputCurrentThLowerCritical OBJECT-TYPE + SYNTAX Integer32 (-1..100000) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Lower critical threshold. Units are milliamps. A negative value indicates + that this object is not available." + ::= { inputCurrentEntry 7 } + +inputCurrentThUpperWarning OBJECT-TYPE + SYNTAX Integer32 (-1..100000) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Upper warning threshold. Units are milliamps. A negative value indicates + that this object is not available." + ::= { inputCurrentEntry 8 } + +inputCurrentThUpperCritical OBJECT-TYPE + SYNTAX Integer32 (-1..100000) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Upper critical threshold. Units are milliamps. A negative value indicates + that this object is not available." + ::= { inputCurrentEntry 9 } + +inputCurrentCrestFactor OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Current crest factor. Units are in milli, for example a crest factor of + 1.414 will be returned as 1414. A negative value indicates + that this object is not available." + ::= { inputCurrentEntry 10 } + +inputCurrentPercentLoad OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Current percent load, based on the rated current capacity. Units are + percentage, for example 80% will be returned as 80. A negative + value indicates that this object is not available." + ::= { inputCurrentEntry 11 } + +inputPowerTable OBJECT-TYPE + SYNTAX SEQUENCE OF InputPowerEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A list of input power measurements. The number of entries + is given by inputPowerCount." + ::= { inputs 4 } + +inputPowerEntry OBJECT-TYPE + SYNTAX InputPowerEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "An entry for an input power measurement." + INDEX { strappingIndex, + inputIndex, + inputPowerIndex } + ::= { inputPowerTable 1 } + +InputPowerEntry ::= SEQUENCE { + inputPowerIndex + Integer32, + inputPowerMeasType + INTEGER, + inputVA + Integer32, + inputWatts + Integer32, + inputWh + Unsigned32, + inputWhTimer + UnixTimeStamp, + inputPowerFactor + Integer32, + inputVAR + Integer32 +} + +inputPowerIndex OBJECT-TYPE + SYNTAX Integer32 (1..12) + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A unique value for each input power measurement. Its value ranges + from 1 to inputPowerCount." + ::= { inputPowerEntry 1 } + +inputPowerMeasType OBJECT-TYPE + SYNTAX INTEGER { + unknown (0), + phase1 (1), + phase2 (2), + phase3 (3), + total (4) + } + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Value indicates what is being measured in this table row." + ::= { inputPowerEntry 2 } + +inputVA OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "An input VA value. Units are VA. A negative value indicates + that this object is not available." + ::= { inputPowerEntry 3 } + +inputWatts OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "An input Watts value. Units are Watts. A negative value indicates + that this object is not available." + ::= { inputPowerEntry 4 } + +inputWh OBJECT-TYPE + SYNTAX Unsigned32 (0..4294967295) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Units are Watt-hours. This object is writable so that it can be reset to 0. When it is + written to, the inputWhTimer will be reset updated as well." + ::= { inputPowerEntry 5 } + +inputWhTimer OBJECT-TYPE + SYNTAX UnixTimeStamp + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Timestamp of when input Watt-hours (inputWh) was last reset." + ::= { inputPowerEntry 6 } + +inputPowerFactor OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "An input PF value. Units are in thousandths, for example a power factor + of 0.958 would be returned as 958, and 0.92 would be returned + as 920. A negative value indicates that this object is not + available." + ::= { inputPowerEntry 7 } + +inputVAR OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "An input VAR value. Units are VAR. A negative value indicates + that this object is not available." + ::= { inputPowerEntry 8 } + + + + + +inputTotalPowerTable OBJECT-TYPE + SYNTAX SEQUENCE OF InputTotalPowerEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A list of total input power measurements." + ::= { inputs 5 } + +inputTotalPowerEntry OBJECT-TYPE + SYNTAX InputTotalPowerEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "An entry for a total input power measurement." + INDEX { strappingIndex, + inputIndex } + ::= { inputTotalPowerTable 1 } + +InputTotalPowerEntry ::= SEQUENCE { + inputTotalVA + Integer32, + inputTotalWatts + Integer32, + inputTotalWh + Unsigned32, + inputTotalWhTimer + UnixTimeStamp, + inputTotalPowerFactor + Integer32, + inputTotalVAR + Integer32 +} + +inputTotalVA OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "An input VA value. Units are VA. A negative value indicates + that this object is not available." + ::= { inputTotalPowerEntry 3 } + +inputTotalWatts OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "An input Watts value. Units are Watts. A negative value indicates + that this object is not available." + ::= { inputTotalPowerEntry 4 } + +inputTotalWh OBJECT-TYPE + SYNTAX Unsigned32 (0..4294967295) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Units are Watt-hours. This object is writable so that it can be reset to 0. When it is + written to, the inputWhTimer will be reset updated as well." + ::= { inputTotalPowerEntry 5 } + +inputTotalWhTimer OBJECT-TYPE + SYNTAX UnixTimeStamp + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Timestamp of when input Watt-hours (inputWh) was last reset." + ::= { inputTotalPowerEntry 6 } + +inputTotalPowerFactor OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "An input PF value. Units are in thousandths, for example a power factor + of 0.958 would be returned as 958, and 0.92 would be returned + as 920. A negative value indicates that this object is not + available." + ::= { inputTotalPowerEntry 7 } + +inputTotalVAR OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "An input VAR value. Units are VAR. A negative value indicates + that this object is not available." + ::= { inputTotalPowerEntry 8 } + + + + + +groupTable OBJECT-TYPE + SYNTAX SEQUENCE OF GroupEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A list of groups. The number of entries is given by groupCount." + ::= { groups 1 } + +groupEntry OBJECT-TYPE + SYNTAX GroupEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "An entry for a particular group." + INDEX { strappingIndex, + groupIndex } + ::= { groupTable 1 } + +GroupEntry ::= SEQUENCE { + groupIndex + Integer32, + groupID + DisplayString, + groupName + OCTET STRING, + groupType + INTEGER, + groupBreakerStatus + INTEGER, + groupChildCount + Integer32 +} + +groupIndex OBJECT-TYPE + SYNTAX Integer32 (1..64) + MAX-ACCESS accessible-for-notify + STATUS current + DESCRIPTION + "A unique value for each group. Its value ranges from 1 to groupCount." + ::= { groupEntry 1 } + +groupID OBJECT-TYPE + SYNTAX DisplayString (SIZE(2..4)) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Alphanumeric designator for the group. This value may be written + on the face of the unit." + ::= { groupEntry 2 } + +groupName OBJECT-TYPE + SYNTAX OCTET STRING (SIZE(1..31)) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "A descriptive name for the group." + ::= { groupEntry 3 } + +groupType OBJECT-TYPE + SYNTAX INTEGER { + unknown (0), + breaker1pole (1), + breaker2pole (2), + breaker3pole (3), + outletSection (4), + userDefined (5) + } + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The type of the group." + ::= { groupEntry 4 } + +groupBreakerStatus OBJECT-TYPE + SYNTAX INTEGER { + notApplicable (0), + breakerOn (1), + breakerOff (2) + } + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Only applicable to breaker-groups. Indicates whether a breaker is turned + off or on." + ::= { groupEntry 5 } + +groupChildCount OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Number of children for this group." + ::= { groupEntry 6 } + +groupChildTable OBJECT-TYPE + SYNTAX SEQUENCE OF GroupChildEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A list of children for this group. For example, this table will link + to all of the outlets that are contained in a particular group." + ::= { groups 2 } + +groupChildEntry OBJECT-TYPE + SYNTAX GroupChildEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "An entry for a particular child." + INDEX { strappingIndex, + groupIndex, + groupChildIndex } + ::= { groupChildTable 1 } + +GroupChildEntry ::= SEQUENCE { + groupChildIndex + Integer32, + groupChildType + INTEGER, + groupChildOID + OBJECT IDENTIFIER +} + +groupChildIndex OBJECT-TYPE + SYNTAX Integer32 (1..32) + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A unique value for each child. Its value ranges from 1 to groupChildCount." + ::= { groupChildEntry 1 } + +groupChildType OBJECT-TYPE + SYNTAX INTEGER { + unknown (0), + section (2), + custom (3), + outlet (4) + } + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The type of the child." + ::= { groupChildEntry 2 } + +groupChildOID OBJECT-TYPE + SYNTAX OBJECT IDENTIFIER + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Object ID of a child object." + ::= { groupChildEntry 3 } + +groupVoltageTable OBJECT-TYPE + SYNTAX SEQUENCE OF GroupVoltageEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A list of group voltage measurements. There can be only one voltage + measurement for each group." + ::= { groups 3 } + +groupVoltageEntry OBJECT-TYPE + SYNTAX GroupVoltageEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "An entry for a group voltage measurement." + INDEX { strappingIndex, + groupIndex } + ::= { groupVoltageTable 1 } + +GroupVoltageEntry ::= SEQUENCE { + groupVoltageMeasType + INTEGER, + groupVoltage + Integer32, + groupVoltageThStatus + INTEGER, + groupVoltageThLowerWarning + Integer32, + groupVoltageThLowerCritical + Integer32, + groupVoltageThUpperWarning + Integer32, + groupVoltageThUpperCritical + Integer32 +} + +groupVoltageMeasType OBJECT-TYPE + SYNTAX INTEGER { + unknown (0), + singlePhase (1), + phase1toN (2), + phase2toN (3), + phase3toN (4), + phase1to2 (5), + phase2to3 (6), + phase3to1 (7) + } + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Value indicates what voltage is being measured in this table row." + ::= { groupVoltageEntry 2 } + +groupVoltage OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Units are millivolts." + ::= { groupVoltageEntry 3 } + +groupVoltageThStatus OBJECT-TYPE + SYNTAX INTEGER { + good (0), + lowWarning (1), + lowCritical (2), + highWarning (3), + highCritical (4) + } + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Status of the measured group voltage relative to the configured thresholds." + ::= { groupVoltageEntry 4 } + +groupVoltageThLowerWarning OBJECT-TYPE + SYNTAX Integer32 (-1..500000) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Lower warning threshold. Units are millivolts. A negative value indicates + that this object is not available." + ::= { groupVoltageEntry 5 } + +groupVoltageThLowerCritical OBJECT-TYPE + SYNTAX Integer32 (-1..500000) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Lower critical threshold. Units are millivolts. A negative value indicates + that this object is not available." + ::= { groupVoltageEntry 6 } + +groupVoltageThUpperWarning OBJECT-TYPE + SYNTAX Integer32 (-1..500000) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Upper warning threshold. Units are millivolts. A negative value indicates + that this object is not available." + ::= { groupVoltageEntry 7 } + +groupVoltageThUpperCritical OBJECT-TYPE + SYNTAX Integer32 (-1..500000) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Upper critical threshold. Units are millivolts. A negative value indicates + that this object is not available." + ::= { groupVoltageEntry 8 } + +groupCurrentTable OBJECT-TYPE + SYNTAX SEQUENCE OF GroupCurrentEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A list of group current measurements. There can be only one current + measurement for each group." + ::= { groups 4 } + +groupCurrentEntry OBJECT-TYPE + SYNTAX GroupCurrentEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "An entry for a group current measurement." + INDEX { strappingIndex, + groupIndex } + ::= { groupCurrentTable 1 } + +GroupCurrentEntry ::= SEQUENCE { + groupCurrentCapacity + Integer32, + groupCurrent + Integer32, + groupCurrentThStatus + INTEGER, + groupCurrentThLowerWarning + Integer32, + groupCurrentThLowerCritical + Integer32, + groupCurrentThUpperWarning + Integer32, + groupCurrentThUpperCritical + Integer32, + groupCurrentCrestFactor + Integer32, + groupCurrentPercentLoad + Integer32 +} + +groupCurrentCapacity OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Rated current capacity of the group. Units are milliamps. A negative + value indicates that the hardware current capacity is unknown (it + will always be unknown for custom groups)." + ::= { groupCurrentEntry 2 } + +groupCurrent OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "A group current measurement value. Units are milliamps." + ::= { groupCurrentEntry 3 } + +groupCurrentThStatus OBJECT-TYPE + SYNTAX INTEGER { + good (0), + lowWarning (1), + lowCritical (2), + highWarning (3), + highCritical (4) + } + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Status of the measured group current relative to the configured thresholds." + ::= { groupCurrentEntry 4 } + +groupCurrentThLowerWarning OBJECT-TYPE + SYNTAX Integer32 (-1..100000) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Lower warning threshold. Units are milliamps. A negative value indicates + that this object is not available." + ::= { groupCurrentEntry 5 } + +groupCurrentThLowerCritical OBJECT-TYPE + SYNTAX Integer32 (-1..100000) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Lower critical threshold. Units are milliamps. A negative value indicates + that this object is not available." + ::= { groupCurrentEntry 6 } + +groupCurrentThUpperWarning OBJECT-TYPE + SYNTAX Integer32 (-1..100000) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Upper warning threshold. Units are milliamps. A negative value indicates + that this object is not available." + ::= { groupCurrentEntry 7 } + +groupCurrentThUpperCritical OBJECT-TYPE + SYNTAX Integer32 (-1..100000) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Upper critical threshold. Units are milliamps. A negative value indicates + that this object is not available." + ::= { groupCurrentEntry 8 } + +groupCurrentCrestFactor OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Current crest factor. Units are in milli, for example a crest factor of + 1.414 will be returned as 1414. A negative value indicates + that this object is not available." + ::= { groupCurrentEntry 9 } + +groupCurrentPercentLoad OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Current percent load, based on the rated current capacity. Units are + percentage, for example 80% will be returned as 80. A negative + value indicates that this object is not available." + ::= { groupCurrentEntry 10 } + +groupPowerTable OBJECT-TYPE + SYNTAX SEQUENCE OF GroupPowerEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A list of group power measurements. There can be only one power + measurement for each group." + ::= { groups 5 } + +groupPowerEntry OBJECT-TYPE + SYNTAX GroupPowerEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "An entry for a group power measurement." + INDEX { strappingIndex, + groupIndex } + ::= { groupPowerTable 1 } + +GroupPowerEntry ::= SEQUENCE { + groupVA + Integer32, + groupWatts + Integer32, + groupWh + Unsigned32, + groupWhTimer + UnixTimeStamp, + groupPowerFactor + Integer32, + groupVAR + Integer32 +} + +groupVA OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "A group VA value. Units are VA. A negative value indicates + that this object is not available." + ::= { groupPowerEntry 2 } + +groupWatts OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "A group Watts value. Units are Watts. A negative value indicates + that this object is not available." + ::= { groupPowerEntry 3 } + +groupWh OBJECT-TYPE + SYNTAX Unsigned32 (0..4294967295) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Units are Watt-hours. This object is writable so that it can be reset to 0. When it is + written to, the inputWhTotalTimer will be reset to 0 as well." + ::= { groupPowerEntry 4 } + +groupWhTimer OBJECT-TYPE + SYNTAX UnixTimeStamp + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Timestamp of when group Watt-hours (groupWh) was last reset." + ::= { groupPowerEntry 5 } + +groupPowerFactor OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "A group PF value. Units are in thousandths, for example a power factor + of 0.958 would be returned as 958, and 0.92 would be returned + as 920. A negative value indicates that this object is not available." + ::= { groupPowerEntry 6 } + +groupVAR OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "A group VAR value. Units are VAR. A negative value indicates + that this object is not available." + ::= { groupPowerEntry 7 } + +groupControlTable OBJECT-TYPE + SYNTAX SEQUENCE OF GroupControlEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A list of controllable groups." + ::= { groups 6 } + +groupControlEntry OBJECT-TYPE + SYNTAX GroupControlEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "An entry for a controllable group." + INDEX { strappingIndex, + groupIndex } + ::= { groupControlTable 1 } + +GroupControlEntry ::= SEQUENCE { + groupControlStatus + INTEGER, + groupControlOffCmd + Integer32, + groupControl0nCmd + Integer32, + groupControlRebootCmd + Integer32 +} + +groupControlStatus OBJECT-TYPE + SYNTAX INTEGER { + off (0), + on (1), + rebooting (2), + mixed (3) + } + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Current state of a controlled group. A value of 'mixed' means that + that the outlets within the group have differing states." + ::= { groupControlEntry 2 } + +groupControlOffCmd OBJECT-TYPE + SYNTAX Integer32 (-1..99999) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Group-level outlet control command. + + Once the command is issued, the outlets in the group will turn Off immediately. + 0-n : Time in seconds until the group command is issued + -1 : Cancel a pending group-level Off command + + When read, returns -1 if no command is pending, or the current downcount in seconds of a pending command. + + Certain ePDUs (mainly those with part numbers beginning with IPV or IPC) do not support delayed control + commands. These will respond with an error if a command value of > 0 is written to this object." + ::= { groupControlEntry 3 } + +groupControl0nCmd OBJECT-TYPE + SYNTAX Integer32 (-1..99999) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Group-level outlet control command. + + Once the command is issued, the outlets in the group will turn On immediately. + 0-n : Time in seconds until the group command is issued + -1 : Cancel a pending group-level On command + + When read, returns -1 if no command is pending, or the current downcount in seconds of a pending command. + + Certain ePDUs (mainly those with part numbers beginning with IPV or IPC) do not support delayed control + commands. These will respond with an error if a command value of > 0 is written to this object." + ::= { groupControlEntry 4 } + +groupControlRebootCmd OBJECT-TYPE + SYNTAX Integer32 (-1..0) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Group-level outlet control command. + + For outlets that are On prior to the Reboot command, they will switch Off immediately when the command is + issued, remain Off for outletControlRebootOffTime seconds, and then turn back On. + For outlets that are Off prior to the Reboot command, they will turn On after a delay of outletControlRebootOffTime + seconds from when the command is issued. + 0-n : Time in seconds until the Reboot command is issued + -1 : Cancel a pending group-level Reboot command + + When read, returns -1 if no command is pending, or the current downcount in seconds of a pending command. + + Certain ePDUs (mainly those with part numbers beginning with IPV or IPC) do not support delayed control + commands. These will respond with an error if a command value of > 0 is written to this object." + ::= { groupControlEntry 5 } + +outletTable OBJECT-TYPE + SYNTAX SEQUENCE OF OutletEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A list of outlets. The number of entries is given by outletCount." + ::= { outlets 1 } + +outletEntry OBJECT-TYPE + SYNTAX OutletEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "An entry for a particular outlet." + INDEX { strappingIndex, + outletIndex } + ::= { outletTable 1 } + +OutletEntry ::= SEQUENCE { + outletIndex + Integer32, + outletID + DisplayString, + outletName + OCTET STRING, + outletParentCount + Integer32, + outletType + INTEGER +} + +outletIndex OBJECT-TYPE + SYNTAX Integer32 (1..64) + MAX-ACCESS accessible-for-notify + STATUS current + DESCRIPTION + "A unique value for each outlet. its value ranges from 1 to outletCount." + ::= { outletEntry 1 } + +outletID OBJECT-TYPE + SYNTAX DisplayString (SIZE(2..4)) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Alphanumeric designator for the outlet." + ::= { outletEntry 2 } + +outletName OBJECT-TYPE + SYNTAX OCTET STRING (SIZE(1..31)) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "A descriptive name for the outlet." + ::= { outletEntry 3 } + +outletParentCount OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Number of parents for this outlet." + ::= { outletEntry 4 } + +outletType OBJECT-TYPE + SYNTAX INTEGER { + unknown (0), + iecC13 (1), + iecC19 (2), + uk (10), + french (11), + schuko (12), + nema515 (20), + nema51520 (21), + nema520 (22), + nemaL520 (23), + nemaL530 (24), + nema615 (25), + nema620 (26), + nemaL620 (27), + nemaL630 (28), + nemaL715 (29), + rf203p277 (30) + } + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The physical type of outlet." + ::= { outletEntry 5 } + +outletParentTable OBJECT-TYPE + SYNTAX SEQUENCE OF OutletParentEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A list of parents for this outlet. For example, this table will link + to all of the groups that have this outlet as a child." + ::= { outlets 2 } + +outletParentEntry OBJECT-TYPE + SYNTAX OutletParentEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "An entry for a particular parent." + INDEX { strappingIndex, + outletIndex, + outletParentIndex } + ::= { outletParentTable 1 } + +OutletParentEntry ::= SEQUENCE { + outletParentIndex + Integer32, + outletParentType + INTEGER, + outletParentOID + OBJECT IDENTIFIER +} + +outletParentIndex OBJECT-TYPE + SYNTAX Integer32 (1..32) + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A unique value for each parent. Its value ranges from 1 to outletParentCount." + ::= { outletParentEntry 1 } + +outletParentType OBJECT-TYPE + SYNTAX INTEGER { + unknown (0), + breaker (1), + section (2), + custom (3) + } + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The type of the parent." + ::= { outletParentEntry 2 } + +outletParentOID OBJECT-TYPE + SYNTAX OBJECT IDENTIFIER + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Object ID of a parent object." + ::= { outletParentEntry 3 } + +outletVoltageTable OBJECT-TYPE + SYNTAX SEQUENCE OF OutletVoltageEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A list of outlet voltage measurements." + ::= { outlets 3 } + +outletVoltageEntry OBJECT-TYPE + SYNTAX OutletVoltageEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "An entry for an outlet voltage measurement." + INDEX { strappingIndex, + outletIndex } + ::= { outletVoltageTable 1 } + +OutletVoltageEntry ::= SEQUENCE { + outletVoltage + Integer32, + outletVoltageThStatus + INTEGER, + outletVoltageThLowerWarning + Integer32, + outletVoltageThLowerCritical + Integer32, + outletVoltageThUpperWarning + Integer32, + outletVoltageThUpperCritical + Integer32 +} + +outletVoltage OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Units are millivolts." + ::= { outletVoltageEntry 2 } + +outletVoltageThStatus OBJECT-TYPE + SYNTAX INTEGER { + good (0), + lowWarning (1), + lowCritical (2), + highWarning (3), + highCritical (4) + } + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Status of the measured outlet voltage relative to the configured thresholds." + ::= { outletVoltageEntry 3 } + +outletVoltageThLowerWarning OBJECT-TYPE + SYNTAX Integer32 (-1..500000) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Lower warning threshold. Units are millivolts. A negative value indicates + that this object is not available." + ::= { outletVoltageEntry 4 } + +outletVoltageThLowerCritical OBJECT-TYPE + SYNTAX Integer32 (-1..500000) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Lower critical threshold. Units are millivolts. A negative value indicates + that this object is not available." + ::= { outletVoltageEntry 5 } + +outletVoltageThUpperWarning OBJECT-TYPE + SYNTAX Integer32 (-1..500000) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Upper warning threshold. Units are millivolts. A negative value indicates + that this object is not available." + ::= { outletVoltageEntry 6 } + +outletVoltageThUpperCritical OBJECT-TYPE + SYNTAX Integer32 (-1..500000) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Upper critical threshold. Units are millivolts. A negative value indicates + that this object is not available." + ::= { outletVoltageEntry 7 } + +outletCurrentTable OBJECT-TYPE + SYNTAX SEQUENCE OF OutletCurrentEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A list of outlet current measurements." + ::= { outlets 4 } + +outletCurrentEntry OBJECT-TYPE + SYNTAX OutletCurrentEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "An entry for an outlet current measurement." + INDEX { strappingIndex, + outletIndex } + ::= { outletCurrentTable 1 } + +OutletCurrentEntry ::= SEQUENCE { + outletCurrentCapacity + Integer32, + outletCurrent + Integer32, + outletCurrentThStatus + INTEGER, + outletCurrentThLowerWarning + Integer32, + outletCurrentThLowerCritical + Integer32, + outletCurrentThUpperWarning + Integer32, + outletCurrentThUpperCritical + Integer32, + outletCurrentCrestFactor + Integer32, + outletCurrentPercentLoad + Integer32 +} + +outletCurrentCapacity OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Rated current capacity of the outlet. Units are milliamps. A negative + value indicates that the hardware current capacity is unknown." + ::= { outletCurrentEntry 2 } + +outletCurrent OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "An outlet current measurement value. Units are milliamps." + ::= { outletCurrentEntry 3 } + +outletCurrentThStatus OBJECT-TYPE + SYNTAX INTEGER { + good (0), + lowWarning (1), + lowCritical (2), + highWarning (3), + highCritical (4) + } + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Status of the measured outlet current relative to the configured thresholds." + ::= { outletCurrentEntry 4 } + +outletCurrentThLowerWarning OBJECT-TYPE + SYNTAX Integer32 (-1..100000) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Lower warning threshold. Units are milliamps. A negative value indicates + that this object is not available." + ::= { outletCurrentEntry 5 } + +outletCurrentThLowerCritical OBJECT-TYPE + SYNTAX Integer32 (-1..100000) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Lower critical threshold. Units are milliamps. A negative value indicates + that this object is not available." + ::= { outletCurrentEntry 6 } + +outletCurrentThUpperWarning OBJECT-TYPE + SYNTAX Integer32 (-1..100000) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Upper warning threshold. Units are milliamps. A negative value indicates + that this object is not available." + ::= { outletCurrentEntry 7 } + +outletCurrentThUpperCritical OBJECT-TYPE + SYNTAX Integer32 (-1..100000) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Upper critical threshold. Units are milliamps. A negative value indicates + that this object is not available." + ::= { outletCurrentEntry 8 } + +outletCurrentCrestFactor OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Current crest factor. Units are in milli, for example a crest factor of + 1.414 will be returned as 1414. A negative value indicates + that this object is not available." + ::= { outletCurrentEntry 9 } + +outletCurrentPercentLoad OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Current percent load, based on the rated current capacity. Units are + percentage, for example 80% will be returned as 80. A negative + value indicates that this object is not available." + ::= { outletCurrentEntry 10 } + +outletPowerTable OBJECT-TYPE + SYNTAX SEQUENCE OF OutletPowerEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A list of outlet power measurements." + ::= { outlets 5 } + +outletPowerEntry OBJECT-TYPE + SYNTAX OutletPowerEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "An entry for an outlet power measurement." + INDEX { strappingIndex, + outletIndex } + ::= { outletPowerTable 1 } + +OutletPowerEntry ::= SEQUENCE { + outletVA + Integer32, + outletWatts + Integer32, + outletWh + Unsigned32, + outletWhTimer + UnixTimeStamp, + outletPowerFactor + Integer32, + outletVAR + Integer32 +} + +outletVA OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "An outlet VA value. Units are VA. A negative value indicates + that this object is not available." + ::= { outletPowerEntry 2 } + +outletWatts OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "An outlet Watts value. Units are Watts. A negative value indicates + that this object is not available." + ::= { outletPowerEntry 3 } + +outletWh OBJECT-TYPE + SYNTAX Unsigned32 (0..4294967295) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Units are Watt-hours. This object is writable so that it can be reset to 0. When it is + written to, the inputWhTotalTimer will be reset to 0 as well." + ::= { outletPowerEntry 4 } + +outletWhTimer OBJECT-TYPE + SYNTAX UnixTimeStamp + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Timestamp of when outlet Watt-hours (outletWh) was last reset." + ::= { outletPowerEntry 5 } + +outletPowerFactor OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "An outlet PF value. Units are in thousandths, for example a power factor + of 0.958 would be returned as 958, and 0.92 would be returned + as 920. A negative value indicates that this object is not available." + ::= { outletPowerEntry 6 } + +outletVAR OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "An outlet VAR value. Units are VAR. A negative value indicates + that this object is not available." + ::= { outletPowerEntry 7 } + +outletControlTable OBJECT-TYPE + SYNTAX SEQUENCE OF OutletControlEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A list of controllable outlets." + ::= { outlets 6 } + +outletControlEntry OBJECT-TYPE + SYNTAX OutletControlEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "An entry for a controllable outlet." + INDEX { strappingIndex, + outletIndex } + ::= { outletControlTable 1 } + +OutletControlEntry ::= SEQUENCE { + outletControlStatus + INTEGER, + outletControlOffCmd + Integer32, + outletControlOnCmd + Integer32, + outletControlRebootCmd + Integer32, + outletControlPowerOnState + INTEGER, + outletControlSequenceDelay + Integer32, + outletControlRebootOffTime + Integer32, + outletControlSwitchable + INTEGER, + outletControlShutoffDelay + Integer32 +} + +outletControlStatus OBJECT-TYPE + SYNTAX INTEGER { + off (0), + on (1), + pendingOff (2), + pendingOn (3) + } + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Current state of a controlled outlet." + ::= { outletControlEntry 2 } + +outletControlOffCmd OBJECT-TYPE + SYNTAX Integer32 (-1..99999) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Outlet control command. + + Once the command is issued, the outlet will turn Off immediately. + 0-n : Time in seconds until the outlet command is issued + -1 : Cancel a pending outlet Off command + + When read, returns -1 if no command is pending, or the current downcount in seconds of a pending command. + + Certain ePDUs (mainly those with part numbers beginning with IPV or IPC) do not support delayed control + commands. These will respond with an error if a command value of > 0 is written to this object." + ::= { outletControlEntry 3 } + +outletControlOnCmd OBJECT-TYPE + SYNTAX Integer32 (-1..99999) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Outlet control command. + + Once the command is issued, the outlet will turn On immediately. + 0-n : Time in seconds until the outlet command is issued + -1 : Cancel a pending outlet On command + + When read, returns -1 if no command is pending, or the current downcount in seconds of a pending command. + + Certain ePDUs (mainly those with part numbers beginning with IPV or IPC) do not support delayed control + commands. These will respond with an error if a command value of > 0 is written to this object." + ::= { outletControlEntry 4 } + +outletControlRebootCmd OBJECT-TYPE + SYNTAX Integer32 (-1..99999) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Outlet control command. + + For outlets that are On prior to this Reboot command, they will switch Off immediately when the command is + issued, remain Off for outletControlRebootOffTime seconds, and then turn back On. + For outlets that are Off prior to the Reboot command, they will turn On after a delay of outletControlRebootOffTime + seconds from when the command is issued. + 0-n : Time in seconds until the Reboot command is issued + -1 : Cancel a pending outlet Reboot command + + When read, returns -1 if no command is pending, or the current downcount in seconds of a pending command. + + Certain ePDUs (mainly those with part numbers beginning with IPV or IPC) do not support delayed control + commands. These will respond with an error if a command value of > 0 is written to this object." + ::= { outletControlEntry 5 } + +outletControlPowerOnState OBJECT-TYPE + SYNTAX INTEGER { + off (0), + on (1), + lastState (2) + } + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Determines the outlet state when power is applied to the unit. + 0 : not restart at device startup + 1 : should sequence back ON in line with outletControlSequenceTime + 2 : should take the state the outlet had when power was lost. + If the state was ON, should sequence back ON in line with outletControlSequenceTime." + ::= { outletControlEntry 6 } + +outletControlSequenceDelay OBJECT-TYPE + SYNTAX Integer32 (-1..99999) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Time delay in seconds from when a Global Sequence On command is issued to + when the command is executed on this outlet. This delay is also used as a power-on + delay. Set to -1 to exclude this outlet from Global Sequence On + commands." + ::= { outletControlEntry 7 } + +outletControlRebootOffTime OBJECT-TYPE + SYNTAX Integer32 (1..99999) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Time delay in seconds that the outlet should remain in the Off state when executing a Reboot command." + ::= { outletControlEntry 8 } + +outletControlSwitchable OBJECT-TYPE + SYNTAX INTEGER { + switchable (1), + notSwitchable (2) + } + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Determines the outlet capability to be controlled On/Off from the communication channels. + 1 : control On/Off enabled + 2 : control On/Off disabled." + ::= { outletControlEntry 9 } + +outletControlShutoffDelay OBJECT-TYPE + SYNTAX Integer32 (-1..99999) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Time delay in seconds that could be taken in account before shutting of the outlet. + An application which need to shutoff properly an outlet will read this parameter first + then write it to the command outletControlOffCmd." + ::= { outletControlEntry 10 } + +temperatureTable OBJECT-TYPE + SYNTAX SEQUENCE OF TemperatureEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A list of temperature probe measurements. The number of entries is + given by temperatureCount." + ::= { environmental 1 } + +temperatureEntry OBJECT-TYPE + SYNTAX TemperatureEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "An entry for a temperature measurement." + INDEX { strappingIndex, + temperatureIndex } + ::= { temperatureTable 1 } + +TemperatureEntry ::= SEQUENCE { + temperatureIndex + Integer32, + temperatureName + OCTET STRING, + temperatureProbeStatus + INTEGER, + temperatureValue + Integer32, + temperatureThStatus + INTEGER, + temperatureThLowerWarning + Integer32, + temperatureThLowerCritical + Integer32, + temperatureThUpperWarning + Integer32, + temperatureThUpperCritical + Integer32 +} + +temperatureIndex OBJECT-TYPE + SYNTAX Integer32 (1..2) + MAX-ACCESS accessible-for-notify + STATUS current + DESCRIPTION + "A unique value for each temperature probe measurement. Its value + ranges from 1 to temperatureCount." + ::= { temperatureEntry 1 } + +temperatureName OBJECT-TYPE + SYNTAX OCTET STRING (SIZE(1..31)) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "A descriptive name for the temperature probe." + ::= { temperatureEntry 2 } + +temperatureProbeStatus OBJECT-TYPE + SYNTAX INTEGER { + bad (-1), + disconnected (0), + connected (1) + } + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Indicates whether a probe is connected or not." + ::= { temperatureEntry 3 } + +temperatureValue OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Units are in tenths of a degree according to the scale specified by + temperatureScale (either Fahrenheit or Celsius). Divide by ten to get + degrees." + ::= { temperatureEntry 4 } + +temperatureThStatus OBJECT-TYPE + SYNTAX INTEGER { + good (0), + lowWarning (1), + lowCritical (2), + highWarning (3), + highCritical (4) + } + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Status of the measured temperature relative to the configured + thresholds." + ::= { temperatureEntry 5 } + +temperatureThLowerWarning OBJECT-TYPE + SYNTAX Integer32 (-1..150000) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Lower warning threshold. Units are tenths of a degree. A negative value + indicates that this object is not available." + ::= { temperatureEntry 6 } + +temperatureThLowerCritical OBJECT-TYPE + SYNTAX Integer32 (-1..150000) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Lower critical threshold. Units are tenths of a degree. A negative value + indicates that this object is not available." + ::= { temperatureEntry 7 } + +temperatureThUpperWarning OBJECT-TYPE + SYNTAX Integer32 (-1..150000) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Upper warning threshold. Units are tenths of a degree. A negative value + indicates that this object is not available." + ::= { temperatureEntry 8 } + +temperatureThUpperCritical OBJECT-TYPE + SYNTAX Integer32 (-1..150000) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Upper critical threshold. Units are tenths of a degree. A negative value + indicates that this object is not available." + ::= { temperatureEntry 9 } + +humidityTable OBJECT-TYPE + SYNTAX SEQUENCE OF HumidityEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A list of humidity probe measurements. The number of entries is + given by humidityCount." + ::= { environmental 2 } + +humidityEntry OBJECT-TYPE + SYNTAX HumidityEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "An entry for a humidity measurement." + INDEX { strappingIndex, + humidityIndex } + ::= { humidityTable 1 } + +HumidityEntry ::= SEQUENCE { + humidityIndex + Integer32, + humidityName + OCTET STRING, + humidityProbeStatus + INTEGER, + humidityValue + Integer32, + humidityThStatus + INTEGER, + humidityThLowerWarning + Integer32, + humidityThLowerCritical + Integer32, + humidityThUpperWarning + Integer32, + humidityThUpperCritical + Integer32 +} + +humidityIndex OBJECT-TYPE + SYNTAX Integer32 (1..2) + MAX-ACCESS accessible-for-notify + STATUS current + DESCRIPTION + "A unique value for each humidity probe measurement. Its value + ranges from 1 to humidityCount." + ::= { humidityEntry 1 } + +humidityName OBJECT-TYPE + SYNTAX OCTET STRING (SIZE(1..31)) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "A descriptive name for the humidity probe." + ::= { humidityEntry 2 } + +humidityProbeStatus OBJECT-TYPE + SYNTAX INTEGER { + bad (-1), + disconnected (0), + connected (1) + } + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Indicates whether a probe is connected or not." + ::= { humidityEntry 3 } + +humidityValue OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Units are tenths of a percent relative humidity. Divide the value by 10 to get %RH." + ::= { humidityEntry 4 } + +humidityThStatus OBJECT-TYPE + SYNTAX INTEGER { + good (0), + lowWarning (1), + lowCritical (2), + highWarning (3), + highCritical (4) + } + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Status of the measured humidity relative to the configured + thresholds." + ::= { humidityEntry 5 } + +humidityThLowerWarning OBJECT-TYPE + SYNTAX Integer32 (-1..1000) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Lower warning threshold. Units are 0.1 %RH. A negative value + indicates that this object is not available." + ::= { humidityEntry 6 } + +humidityThLowerCritical OBJECT-TYPE + SYNTAX Integer32 (-1..1000) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Lower critical threshold. Units are 0.1 %RH. A negative value + indicates that this object is not available." + ::= { humidityEntry 7 } + +humidityThUpperWarning OBJECT-TYPE + SYNTAX Integer32 (-1..1000) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Upper warning threshold. Units are 0.1 %RH. A negative value + indicates that this object is not available." + ::= { humidityEntry 8 } + +humidityThUpperCritical OBJECT-TYPE + SYNTAX Integer32 (-1..1000) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Upper critical threshold. Units are 0.1 %RH. A negative value + indicates that this object is not available." + ::= { humidityEntry 9 } + +contactTable OBJECT-TYPE + SYNTAX SEQUENCE OF ContactEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A list of contact sensors. The number of entries is + given by contactCount." + ::= { environmental 3 } + +contactEntry OBJECT-TYPE + SYNTAX ContactEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "An entry for a contact sensor" + INDEX { strappingIndex, + contactIndex } + ::= { contactTable 1 } + +ContactEntry ::= SEQUENCE { + contactIndex + Integer32, + contactName + OCTET STRING, + contactProbeStatus + INTEGER, + contactState + INTEGER +} + +contactIndex OBJECT-TYPE + SYNTAX Integer32 (1..3) + MAX-ACCESS accessible-for-notify + STATUS current + DESCRIPTION + "A unique value for each contact sensor. Its value ranges from 1 to + contactCount." + ::= { contactEntry 1 } + +contactName OBJECT-TYPE + SYNTAX OCTET STRING (SIZE(1..31)) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "A descriptive name for the contact sensor." + ::= { contactEntry 2 } + +contactProbeStatus OBJECT-TYPE + SYNTAX INTEGER { + bad (-1), + disconnected (0), + connected (1) + } + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Indicates whether a probe is connected or not. + Will not be returned if the contact sensor is internal to the ePDU, + in that case only contactState should be read." + ::= { contactEntry 3 } + +contactState OBJECT-TYPE + SYNTAX INTEGER { + contactBad (-1), + contactOpen (0), + contactClosed (1) + } + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The state of the contact sensor." + ::= { contactEntry 4 } + +eatonEpduCompliances MODULE-COMPLIANCE + STATUS current + DESCRIPTION + "The requirements for conforming to the ePDU MIB." + MODULE + MANDATORY-GROUPS { epduRequiredGroup } + GROUP epduOptionalGroup + DESCRIPTION + "Different ePDUs will support a subset of the defined objects." + GROUP epduNotifyGroup + DESCRIPTION + "Different ePDUs will support a subset of the defined notifications." + ::= { conformance 1 } + +epduRequiredGroup OBJECT-GROUP + OBJECTS { unitName, + firmwareVersion } + STATUS current + DESCRIPTION + "Minimal objects are required to conform to this MIB." + ::= { objectGroups 1 } + +epduOptionalGroup OBJECT-GROUP + OBJECTS { clockValue, + commInterface, + communicationStatus, + contactCount, + contactIndex, + contactName, + contactProbeStatus, + contactState, + groupChildCount, + groupChildOID, + groupChildType, + groupControl0nCmd, + groupControlOffCmd, + groupControlRebootCmd, + groupControlStatus, + groupCount, + groupCurrent, + groupCurrentCapacity, + groupCurrentCrestFactor, + groupCurrentPercentLoad, + groupCurrentThLowerCritical, + groupCurrentThLowerWarning, + groupCurrentThStatus, + groupCurrentThUpperCritical, + groupCurrentThUpperWarning, + groupID, + groupIndex, + groupName, + groupBreakerStatus, + groupPowerFactor, + groupType, + groupVA, + groupVAR, + groupVoltage, + groupVoltageMeasType, + groupVoltageThLowerCritical, + groupVoltageThLowerWarning, + groupVoltageThStatus, + groupVoltageThUpperCritical, + groupVoltageThUpperWarning, + groupWatts, + groupWh, + groupWhTimer, + humidityCount, + humidityIndex, + humidityName, + humidityProbeStatus, + humidityThLowerCritical, + humidityThLowerWarning, + humidityThStatus, + humidityThUpperCritical, + humidityThUpperWarning, + humidityValue, + inputCount, + inputCurrent, + inputCurrentCapacity, + inputCurrentCount, + inputCurrentCrestFactor, + inputCurrentIndex, + inputCurrentMeasType, + inputCurrentPercentLoad, + inputCurrentThLowerCritical, + inputCurrentThLowerWarning, + inputCurrentThStatus, + inputCurrentThUpperCritical, + inputCurrentThUpperWarning, + inputFrequency, + inputFrequencyStatus, + inputIndex, + inputPlugType, + inputPowerCount, + inputPowerFactor, + inputPowerMeasType, + inputType, + inputVA, + inputVAR, + inputVoltage, + inputVoltageCount, + inputVoltageIndex, + inputVoltageMeasType, + inputVoltageThLowerCritical, + inputVoltageThLowerWarning, + inputVoltageThStatus, + inputVoltageThUpperCritical, + inputVoltageThUpperWarning, + inputWatts, + inputWh, + inputWhTimer, + inputTotalVA, + inputTotalWatts, + inputTotalWh, + inputTotalWhTimer, + inputTotalPowerFactor, + inputTotalVAR, + internalStatus, + lcdControl, + outletControlSwitchable, + outletControlShutoffDelay, + outletControlOffCmd, + outletControlOnCmd, + outletControlPowerOnState, + outletControlRebootCmd, + outletControlRebootOffTime, + outletControlSequenceDelay, + outletControlStatus, + outletCount, + outletCurrent, + outletCurrentCapacity, + outletCurrentCrestFactor, + outletCurrentPercentLoad, + outletCurrentThLowerCritical, + outletCurrentThLowerWarning, + outletCurrentThStatus, + outletCurrentThUpperCritical, + outletCurrentThUpperWarning, + outletID, + outletIndex, + outletName, + outletParentCount, + outletParentOID, + outletParentType, + outletPowerFactor, + outletType, + outletVA, + outletVAR, + outletVoltage, + outletVoltageThLowerCritical, + outletVoltageThLowerWarning, + outletVoltageThStatus, + outletVoltageThUpperCritical, + outletVoltageThUpperWarning, + outletWatts, + outletWh, + outletWhTimer, + partNumber, + productName, + serialNumber, + strappingIndex, + strappingStatus, + temperatureCount, + temperatureIndex, + temperatureName, + temperatureProbeStatus, + temperatureScale, + unitType, + temperatureThLowerCritical, + temperatureThLowerWarning, + temperatureThStatus, + temperatureThUpperCritical, + temperatureThUpperWarning, + temperatureValue, + unitControlOffCmd, + unitControlOnCmd, + unitName, + unitsPresent, + userName } + STATUS current + DESCRIPTION + "Most objects in this MIB are optional." + ::= { objectGroups 2 } + +epduNotifyGroup NOTIFICATION-GROUP + NOTIFICATIONS { notifyBootUp, + notifyCommunicationStatus, + notifyContactState, + notifyFailedLogin, + notifyGroupCurrentThStatus, + notifyGroupVoltageThStatus, + notifyGroupBreakerStatus, + notifyHumidityThStatus, + notifyInputCurrentThStatus, + notifyInputFrequencyStatus, + notifyInputVoltageThStatus, + notifyInternalStatus, + notifyOutletControlStatus, + notifyOutletCurrentThStatus, + notifyOutletVoltageThStatus, + notifyProbeStatus, + notifyStrappingStatus, + notifyTemperatureThStatus, + notifyTest, + notifyUserLogin, + notifyUserLogout } + STATUS current + DESCRIPTION + "These notifications will be supported depending on the features of the ePDU. + Check the web interface for options to turn these notifications on/off. If + an option is not listed, then the ePDU likely does not support that + notification." + ::= { objectGroups 3 } +END + + +-- This MIB was created using NuDesign Team's Visual MIBuilder (Ver 4.7). + diff --git a/mibs/EATON-OIDS b/mibs/EATON-OIDS new file mode 100755 index 000000000..7a318f013 --- /dev/null +++ b/mibs/EATON-OIDS @@ -0,0 +1,171 @@ +EATON-OIDS DEFINITIONS ::= BEGIN + +IMPORTS + MODULE-IDENTITY, enterprises FROM SNMPv2-SMI + Integer32 FROM SNMPv2-SMI + TEXTUAL-CONVENTION FROM SNMPv2-TC; + +eaton MODULE-IDENTITY + LAST-UPDATED "201001240000Z" + ORGANIZATION "Eaton Corporation" + CONTACT-INFO + "Eaton Power Quality Technical Support (PQTS) group + www.eaton.com/powerxpert + Technical Resource Center phone numbers + United States: 1.800.843.9433 or 919.870.3028 + Canada: 1.800.461.9166 ext. 260 + All other countries: Call your local service representative." + DESCRIPTION + "Assigns major branches from the root of + Eaton's OID tree (534). + + Copyright (C) Exide Electronics 1992-98 + Copyright (C) Powerware Corporation 1999-2004 + Copyright (C) Eaton Corporation (2005-)." + + REVISION "201001240000Z" + DESCRIPTION + "Added assignments for eatonEpdu and eatonEpduMa." + + REVISION "200906180000Z" + DESCRIPTION + "Added assignments for powerCmnd and OSDCIIMIB." + + + REVISION "200708060000Z" + DESCRIPTION + "Added assignments for pcdMIB and pxmMIB. + Added common Textual Conventions for Integers." + + REVISION "200707050000Z" + DESCRIPTION + "Added assignment for eatonEpduMIB. + Cleaned up file for public consumption." + + REVISION "200610150000Z" + DESCRIPTION + "Added assignments for powerChain and pxgMIB." + + REVISION "200605250000Z" + DESCRIPTION + "Revised from the original assignments in XUPS-MIB.txt. + Note that enterprises.534. was originally assigned to Exide + Electronics before Powerware was acquired by Eaton." + + ::= { enterprises 534 } + +-- EATON-OIDS { iso org(3) dod(6) internet(1) private(4) +-- enterprises(1) eaton(534) } + + +-- The Powerware "PowerMIB" for UPSs +xupsMIB OBJECT IDENTIFIER ::= {eaton 1} +-- Define the Environment group here since it is used in the Eaton-EMP-MIB as well +xupsEnvironment OBJECT IDENTIFIER ::= {xupsMIB 6} + +-- +-- The root of the list of Object Identifiers that are used to +-- distinguish Eaton's SNMP agents (for use in sysObjId): +xupsObjectId OBJECT IDENTIFIER ::= {eaton 2} + powerwareEthernetSnmpAdapter OBJECT IDENTIFIER ::= {xupsObjectId 1} + powerwareNetworkSnmpAdapterEther OBJECT IDENTIFIER ::= {xupsObjectId 2} + powerwareNetworkSnmpAdapterToken OBJECT IDENTIFIER ::= {xupsObjectId 3} + onlinetDaemon OBJECT IDENTIFIER ::= {xupsObjectId 4} + connectUPSAdapterEthernet OBJECT IDENTIFIER ::= {xupsObjectId 5} + powerwareNetworkDigitalIOEther OBJECT IDENTIFIER ::= {xupsObjectId 6} + connectUPSAdapterTokenRing OBJECT IDENTIFIER ::= {xupsObjectId 7} + simpleSnmpAdapter OBJECT IDENTIFIER ::= {xupsObjectId 8} + powerwareEliSnmpAdapter OBJECT IDENTIFIER ::= {xupsObjectId 9} + powerwareBasicEmbeddedEthernet OBJECT IDENTIFIER ::= {xupsObjectId 10} + eatonPowerChainGateway OBJECT IDENTIFIER ::= {xupsObjectId 11} + eatonPowerChainDevice OBJECT IDENTIFIER ::= {xupsObjectId 12} + eatonPowerXpertMeter OBJECT IDENTIFIER ::= {xupsObjectId 13} + + +-- Digital IO MIB (deprecated) +-- File XUPSIOV1.MIB +xupsIoMIB OBJECT IDENTIFIER ::= {eaton 3} + +-- DataTrax Forseer and Powervision branch +powerVision OBJECT IDENTIFIER ::= {eaton 4} + +-- orphaned: BEEP (Basic Embedded Ethernet Product) +-- File XUPS-BASIC-MIB.txt +--xupsBasic OBJECT IDENTIFIER ::= {eaton 5} + +-- A branch for Powerware Product MIBs +products OBJECT IDENTIFIER ::= {eaton 6} + -- Product assignments + + pduAgent OBJECT IDENTIFIER ::= {products 6} + -- pduAgent product assignments + -- File MIB_hdpdu.mib for HD PDU + hdpdu OBJECT IDENTIFIER ::= {pduAgent 2} + + -- MIB for Eaton PDU, first for 9315's 3-phase PDU + -- Defined in EATON-PDU-MIB.txt + eatonPdu OBJECT IDENTIFIER ::= {pduAgent 4} + + -- MIB for Eaton Powerware first-generation Managed ePDUs + -- Defined in EATON-EPDU-MA-MIB.txt + -- eatonEpduMa OBJECT IDENTIFIER ::= {pduAgent 6} + + -- MIB for Eaton Powerware ePDUs + -- Defined in EATON-EPDU-MIB.txt + -- eatonEpdu OBJECT IDENTIFIER ::= {pduAgent 7} + + + dataCenter OBJECT IDENTIFIER ::= {products 7} + -- dataCenter product assignments + environmentalMonitor OBJECT IDENTIFIER ::= {dataCenter 1} + + +-- A branch for Eaton IT Department +itProjects OBJECT IDENTIFIER ::= {eaton 7} + pki OBJECT IDENTIFIER ::= {itProjects 1} + +-- A branch for PowerChain Product MIBs +powerChain OBJECT IDENTIFIER ::= {eaton 8} + -- Product assignments + + -- MIB to support Alarms and Events in PowerXpert toolkit-enabled + -- Devices, Gateways, PXMeters + -- Defined in file EATON-PXG-MIB.txt + -- pxgMIB OBJECT IDENTIFIER ::= {powerChain 1} + + -- MIB to support common measures in Power Chain Devices + -- Defined in file EATON-PCD-MIB.txt + -- pcdMIB OBJECT IDENTIFIER ::= {powerChain 2} + + -- MIB to support power measures in Power Meters + -- Defined in file EATON-PWR-MTR-MIB.txt + -- pxmMIB OBJECT IDENTIFIER ::= {powerChain 3} + +-- A branch for powercomand commercial control Product MIBs +powerCmnd OBJECT IDENTIFIER ::= {eaton 9} + + -- Product assignments + -- MIB to support the OSDCII controller + -- Defined in file EATON-OSDCII-MIB.txt + -- osdcMIB OBJECT IDENTIFIER ::= {powerCmnd 1} + +-- Define some common Textual Conventions +-- PositiveInteger and NonNegativeInteger are borrowed from RFC1628 + PositiveInteger ::= TEXTUAL-CONVENTION + DISPLAY-HINT "d" + STATUS current + DESCRIPTION + "This data type is a non-zero and non-negative value." + SYNTAX Integer32 (1..2147483647) + + NonNegativeInteger ::= TEXTUAL-CONVENTION + DISPLAY-HINT "d" + STATUS current + DESCRIPTION + "This data type is a non-negative value." + SYNTAX Integer32 (0..2147483647) + + + + END + diff --git a/scripts/tune_port.php b/scripts/tune_port.php index 2798469cc..14b62abe6 100755 --- a/scripts/tune_port.php +++ b/scripts/tune_port.php @@ -24,8 +24,7 @@ foreach (dbFetchRows("SELECT `device_id`,`hostname` FROM `devices` WHERE `hostna echo "Found hostname " . $device['hostname'].".......\n"; foreach (dbFetchRows("SELECT `ifIndex`,`ifName`,`ifSpeed` FROM `ports` WHERE `ifName` LIKE ? AND `device_id` = ?", array('%'.$ports.'%',$device['device_id'])) as $port) { echo "Tuning port " . $port['ifName'].".......\n"; - $host_rrd = $config['rrd_dir'].'/'.$device['hostname']; - $rrdfile = $host_rrd.'/port-'.safename($port['ifIndex'].'.rrd'); + $rrdfile = get_port_rrdfile_path ($device['hostname'], $port['port_id']); rrdtool_tune('port',$rrdfile,$port['ifSpeed']); } } diff --git a/sql-schema/095.sql b/sql-schema/095.sql new file mode 100644 index 000000000..f6a4af91e --- /dev/null +++ b/sql-schema/095.sql @@ -0,0 +1,3 @@ +CREATE TABLE IF NOT EXISTS `ports_stp` (`port_stp_id` int(11) NOT NULL,`device_id` int(11) NOT NULL,`port_id` int(11) NOT NULL,`priority` tinyint(3) unsigned NOT NULL,`state` varchar(11) NOT NULL,`enable` varchar(8) NOT NULL,`pathCost` int(10) unsigned NOT NULL,`designatedRoot` varchar(32) NOT NULL,`designatedCost` smallint(5) unsigned NOT NULL,`designatedBridge` varchar(32) NOT NULL,`designatedPort` mediumint(9) NOT NULL,`forwardTransitions` int(10) unsigned NOT NULL) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; +ALTER TABLE `ports_stp` ADD PRIMARY KEY (`port_stp_id`), ADD UNIQUE KEY `device_id` (`device_id`,`port_id`); +ALTER TABLE `ports_stp` MODIFY `port_stp_id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=1; diff --git a/sql-schema/096.sql b/sql-schema/096.sql new file mode 100644 index 000000000..58ae65201 --- /dev/null +++ b/sql-schema/096.sql @@ -0,0 +1,5 @@ +CREATE TABLE IF NOT EXISTS `port_association_mode` (pom_id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, name varchar(12) NOT NULL); +INSERT INTO port_association_mode (pom_id, name) values (1, 'ifIndex'); +INSERT INTO port_association_mode (name) values ('ifName'); +INSERT INTO port_association_mode (name) values ('ifDescr'); +ALTER TABLE devices ADD port_association_mode int(11) NOT NULL DEFAULT 1; diff --git a/sql-schema/098.sql b/sql-schema/098.sql new file mode 100644 index 000000000..f9a25728f --- /dev/null +++ b/sql-schema/098.sql @@ -0,0 +1 @@ +ALTER TABLE `bgpPeers_cbgp` ADD `AcceptedPrefixes_delta` INT NOT NULL ,ADD `AcceptedPrefixes_prev` INT NOT NULL ,ADD `DeniedPrefixes_delta` INT NOT NULL ,ADD `DeniedPrefixes_prev` INT NOT NULL ,ADD `AdvertisedPrefixes_delta` INT NOT NULL ,ADD `AdvertisedPrefixes_prev` INT NOT NULL ,ADD `SuppressedPrefixes_delta` INT NOT NULL ,ADD `SuppressedPrefixes_prev` INT NOT NULL ,ADD `WithdrawnPrefixes_delta` INT NOT NULL ,ADD `WithdrawnPrefixes_prev` INT NOT NULL ; diff --git a/sql-schema/100.sql b/sql-schema/100.sql new file mode 100644 index 000000000..5dfced746 --- /dev/null +++ b/sql-schema/100.sql @@ -0,0 +1,18 @@ +CREATE TABLE IF NOT EXISTS `vrf_lite_cisco` ( `vrf_lite_cisco_id` int(11) NOT NULL AUTO_INCREMENT, `device_id` int(11) NOT NULL, `context_name` varchar(128) CHARACTER SET utf8 collate utf8_general_ci not null ,`intance_name` varchar(128) DEFAULT '', `vrf_name` varchar(128) DEFAULT 'Default', PRIMARY KEY (`vrf_lite_cisco_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +ALTER TABLE `vrf_lite_cisco` ADD INDEX `vrf` (`vrf_name` ASC), ADD INDEX `context` (`context_name` ASC), ADD INDEX `device` (`device_id` ASC), ADD INDEX `mix` (`device_id` ASC, `context_name` ASC, `vrf_name` ASC); +ALTER TABLE ipv4_addresses ADD `context_name` varchar(128) CHARACTER SET utf8 collate utf8_general_ci ; +ALTER TABLE ipv4_networks ADD `context_name` varchar(128) CHARACTER SET utf8 collate utf8_general_ci ; +ALTER TABLE ipv4_mac ADD `context_name` varchar(128) CHARACTER SET utf8 collate utf8_general_ci ; +ALTER TABLE ipv6_addresses ADD `context_name` varchar(128) CHARACTER SET utf8 collate utf8_general_ci ; +ALTER TABLE ipv6_networks ADD `context_name` varchar(128) CHARACTER SET utf8 collate utf8_general_ci ; +ALTER TABLE bgpPeers ADD `context_name` varchar(128) CHARACTER SET utf8 collate utf8_general_ci ; +ALTER TABLE bgpPeers_cbgp ADD `context_name` varchar(128) CHARACTER SET utf8 collate utf8_general_ci ; +ALTER TABLE ospf_areas ADD `context_name` varchar(128) CHARACTER SET utf8 collate utf8_general_ci ; +ALTER TABLE ospf_areas DROP INDEX device_area, ADD UNIQUE KEY `device_area` (`device_id`,`ospfAreaId`,`context_name`); +ALTER TABLE ospf_instances ADD `context_name` varchar(128) CHARACTER SET utf8 collate utf8_general_ci ; +ALTER TABLE ospf_instances DROP INDEX device_id, ADD UNIQUE KEY `device_id` (`device_id`,`ospf_instance_id`,`context_name`); +ALTER TABLE ospf_nbrs ADD `context_name` varchar(128) CHARACTER SET utf8 collate utf8_general_ci ; +ALTER TABLE ospf_nbrs DROP INDEX device_id, ADD UNIQUE KEY `device_id` (`device_id`,`ospf_nbr_id`,`context_name`); +ALTER TABLE ospf_ports ADD `context_name` varchar(128) CHARACTER SET utf8 collate utf8_general_ci ; +ALTER TABLE ospf_ports DROP INDEX device_id, ADD UNIQUE KEY `device_id` (`device_id`,`ospf_port_id`,`context_name`); +ALTER TABLE `vlans` CHANGE COLUMN `vlan_name` `vlan_name` VARCHAR(64) DEFAULT NULL; \ No newline at end of file