mirror of
https://github.com/stylersnico/librenms.git
synced 2026-08-03 00:11:49 +02:00
Merge branch 'master' of https://github.com/librenms/librenms into issue-2770
This commit is contained in:
@@ -82,6 +82,7 @@ LibreNMS contributors:
|
||||
- Adam Winberg <adam.winberg@gmail.com> (wiad)
|
||||
- Maximilian Wilhelm <max@rfc2324.org> (BarbarossaTM)
|
||||
- Jameson Finney <jameson.finney@gmail.com> (JamesonFinney)
|
||||
- John Wells <john.wells@greatworx.com> (jbwiv)
|
||||
|
||||
[1]: http://observium.org/ "Observium web site"
|
||||
Observium was written by:
|
||||
|
||||
+31
-11
@@ -19,7 +19,7 @@ require 'config.php';
|
||||
require 'includes/definitions.inc.php';
|
||||
require 'includes/functions.php';
|
||||
|
||||
$options = getopt('g:f::');
|
||||
$options = getopt('g:p:f::');
|
||||
|
||||
if (isset($options['g']) && $options['g'] >= 0) {
|
||||
$cmd = array_shift($argv);
|
||||
@@ -39,6 +39,22 @@ if (isset($options['f']) && $options['f'] == 0) {
|
||||
$force_add = 1;
|
||||
}
|
||||
|
||||
$port_assoc_mode = $config['default_port_association_mode'];
|
||||
$valid_assoc_modes = get_port_assoc_modes ();
|
||||
if (isset ($options['p'])) {
|
||||
$port_assoc_mode = $options['p'];
|
||||
if (! in_array ($port_assoc_mode, $valid_assoc_modes)) {
|
||||
echo "Invalid port association mode '" . $port_assoc_mode . "'\n";
|
||||
echo 'Valid modes: ' . join (', ', $valid_assoc_modes) . "\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
$cmd = array_shift($argv);
|
||||
array_shift($argv);
|
||||
array_shift($argv);
|
||||
array_unshift($argv, $cmd);
|
||||
}
|
||||
|
||||
if (!empty($argv[1])) {
|
||||
$host = strtolower($argv[1]);
|
||||
$community = $argv[2];
|
||||
@@ -82,7 +98,7 @@ if (!empty($argv[1])) {
|
||||
array_push($config['snmp']['v3'], $v3);
|
||||
}
|
||||
|
||||
$device_id = addHost($host, $snmpver, $port, $transport, 0, $poller_group, $force_add);
|
||||
$device_id = addHost($host, $snmpver, $port, $transport, 0, $poller_group, $force_add, $port_assoc_mode);
|
||||
}
|
||||
else if ($seclevel === 'anp' or $seclevel === 'authNoPriv') {
|
||||
$v3['authlevel'] = 'authNoPriv';
|
||||
@@ -108,7 +124,7 @@ if (!empty($argv[1])) {
|
||||
}
|
||||
|
||||
array_push($config['snmp']['v3'], $v3);
|
||||
$device_id = addHost($host, $snmpver, $port, $transport, 0, $poller_group, $force_add);
|
||||
$device_id = addHost($host, $snmpver, $port, $transport, 0, $poller_group, $force_add, $port_assoc_mode);
|
||||
}
|
||||
else if ($seclevel === 'ap' or $seclevel === 'authPriv') {
|
||||
$v3['authlevel'] = 'authPriv';
|
||||
@@ -138,7 +154,7 @@ if (!empty($argv[1])) {
|
||||
}//end while
|
||||
|
||||
array_push($config['snmp']['v3'], $v3);
|
||||
$device_id = addHost($host, $snmpver, $port, $transport, 0, $poller_group, $force_add);
|
||||
$device_id = addHost($host, $snmpver, $port, $transport, 0, $poller_group, $force_add, $port_assoc_mode);
|
||||
}
|
||||
else {
|
||||
// Error or do nothing ?
|
||||
@@ -164,7 +180,7 @@ if (!empty($argv[1])) {
|
||||
$config['snmp']['community'] = array($community);
|
||||
}
|
||||
|
||||
$device_id = addHost($host, $snmpver, $port, $transport, 0, $poller_group, $force_add);
|
||||
$device_id = addHost($host, $snmpver, $port, $transport, 0, $poller_group, $force_add, $port_assoc_mode);
|
||||
}//end if
|
||||
|
||||
if ($snmpver) {
|
||||
@@ -180,7 +196,7 @@ if (!empty($argv[1])) {
|
||||
|
||||
while (!$device_id && count($snmpversions)) {
|
||||
$snmpver = array_shift($snmpversions);
|
||||
$device_id = addHost($host, $snmpver, $port, $transport, 0, $poller_group, $force_add);
|
||||
$device_id = addHost($host, $snmpver, $port, $transport, 0, $poller_group, $force_add, $port_assoc_mode);
|
||||
}
|
||||
|
||||
if ($device_id) {
|
||||
@@ -193,14 +209,18 @@ if (!empty($argv[1])) {
|
||||
print $console_color->convert(
|
||||
"\n".$config['project_name_version'].' Add Host Tool
|
||||
|
||||
Usage (SNMPv1/2c): ./addhost.php [-g <poller group>] [-f] <%Whostname%n> [community] [v1|v2c] [port] ['.implode('|', $config['snmp']['transports']).']
|
||||
Usage (SNMPv3) : Config Defaults : ./addhost.php [-g <poller group>] [-f]<%Whostname%n> any v3 [user] [port] ['.implode('|', $config['snmp']['transports']).']
|
||||
No Auth, No Priv : ./addhost.php [-g <poller group>] [-f]<%Whostname%n> nanp v3 [user] [port] ['.implode('|', $config['snmp']['transports']).']
|
||||
Auth, No Priv : ./addhost.php [-g <poller group>] [-f]<%Whostname%n> anp v3 <user> <password> [md5|sha] [port] ['.implode('|', $config['snmp']['transports']).']
|
||||
Auth, Priv : ./addhost.php [-g <poller group>] [-f]<%Whostname%n> ap v3 <user> <password> <enckey> [md5|sha] [aes|dsa] [port] ['.implode('|', $config['snmp']['transports']).']
|
||||
Usage (SNMPv1/2c): ./addhost.php [-g <poller group>] [-f] [-p <port assoc mode>] <%Whostname%n> [community] [v1|v2c] [port] ['.implode('|', $config['snmp']['transports']).']
|
||||
Usage (SNMPv3) : Config Defaults : ./addhost.php [-g <poller group>] [-f] [-p <port assoc mode>] <%Whostname%n> any v3 [user] [port] ['.implode('|', $config['snmp']['transports']).']
|
||||
No Auth, No Priv : ./addhost.php [-g <poller group>] [-f] [-p <port assoc mode>] <%Whostname%n> nanp v3 [user] [port] ['.implode('|', $config['snmp']['transports']).']
|
||||
Auth, No Priv : ./addhost.php [-g <poller group>] [-f] [-p <port assoc mode>] <%Whostname%n> anp v3 <user> <password> [md5|sha] [port] ['.implode('|', $config['snmp']['transports']).']
|
||||
Auth, Priv : ./addhost.php [-g <poller group>] [-f] [-p <port assoc mode>] <%Whostname%n> ap v3 <user> <password> <enckey> [md5|sha] [aes|dsa] [port] ['.implode('|', $config['snmp']['transports']).']
|
||||
|
||||
-g <poller group> allows you to add a device to be pinned to a specific poller when using distributed polling. X can be any number associated with a poller group
|
||||
-f forces the device to be added by skipping the icmp and snmp check against the host.
|
||||
-p <port assoc mode> allow you to set a port association mode for this device. By default ports are associated by \'ifIndex\'.
|
||||
For Linux/Unix based devices \'ifName\' or \'ifDescr\' might be useful for a stable iface mapping.
|
||||
The default for this installation is \'' . $config['default_port_association_mode'] . '\'
|
||||
Valid port assoc modes are: ' . join (', ', $valid_assoc_modes) . '
|
||||
|
||||
%rRemember to run discovery for the host afterwards.%n
|
||||
'
|
||||
|
||||
+18
@@ -28,6 +28,8 @@
|
||||
require_once 'includes/defaults.inc.php';
|
||||
require_once 'config.php';
|
||||
|
||||
$options = getopt('d::');
|
||||
|
||||
$lock = false;
|
||||
if (file_exists($config['install_dir'].'/.alerts.lock')) {
|
||||
$pids = explode("\n", trim(`ps -e | grep php | awk '{print $1}'`));
|
||||
@@ -48,6 +50,22 @@ require_once $config['install_dir'].'/includes/definitions.inc.php';
|
||||
require_once $config['install_dir'].'/includes/functions.php';
|
||||
require_once $config['install_dir'].'/includes/alerts.inc.php';
|
||||
|
||||
if (isset($options['d'])) {
|
||||
echo "DEBUG!\n";
|
||||
$debug = true;
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
ini_set('log_errors', 1);
|
||||
ini_set('error_reporting', 1);
|
||||
}
|
||||
else {
|
||||
$debug = false;
|
||||
// ini_set('display_errors', 0);
|
||||
ini_set('display_startup_errors', 0);
|
||||
ini_set('log_errors', 0);
|
||||
// ini_set('error_reporting', 0);
|
||||
}
|
||||
|
||||
if (!defined('TEST') && $config['alert']['disable'] != 'true') {
|
||||
echo 'Start: '.date('r')."\r\n";
|
||||
echo "RunFollowUp():\r\n";
|
||||
|
||||
@@ -49,3 +49,6 @@ $config['poller-wrapper']['alerter'] = FALSE;
|
||||
|
||||
# Uncomment to submit callback stats via proxy
|
||||
#$config['callback_proxy'] = "hostname:port";
|
||||
|
||||
# Set default port association mode for new devices (default: ifIndex)
|
||||
#$config['default_port_association_mode'] = 'ifIndex';
|
||||
|
||||
+6
-2
@@ -23,7 +23,7 @@ require 'includes/discovery/functions.inc.php';
|
||||
$start = microtime(true);
|
||||
$runtime_stats = array();
|
||||
$sqlparams = array();
|
||||
$options = getopt('h:m:i:n:d::a::q',array('os:','type:'));
|
||||
$options = getopt('h:m:i:n:d::v::a::q',array('os:','type:'));
|
||||
|
||||
if (!isset($options['q'])) {
|
||||
echo $config['project_name_version']." Discovery\n";
|
||||
@@ -82,8 +82,11 @@ if (isset($options['i']) && $options['i'] && isset($options['n'])) {
|
||||
$doing = $options['n'].'/'.$options['i'];
|
||||
}
|
||||
|
||||
if (isset($options['d'])) {
|
||||
if (isset($options['d']) || isset($options['v'])) {
|
||||
echo "DEBUG!\n";
|
||||
if (isset($options['v'])) {
|
||||
$vdebug = true;
|
||||
}
|
||||
$debug = true;
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
@@ -111,6 +114,7 @@ if (!$where) {
|
||||
echo "\n";
|
||||
echo "Debugging and testing options:\n";
|
||||
echo "-d Enable debugging output\n";
|
||||
echo "-v Enable verbose debugging output\n";
|
||||
echo "-m Specify single module to be run\n";
|
||||
echo "\n";
|
||||
echo "Invalid arguments!\n";
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -6,7 +6,7 @@ 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.
|
||||
read through the [Bootstrap website](http://getbootstrap.com/css/#grid) to learn more about how to keep things responsive.
|
||||
|
||||
### Navigation bar
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ Now you have two configured remotes:
|
||||
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
|
||||
|
||||
@@ -399,8 +399,8 @@ $config['alert']['transports']['clickatell']['to'][] = '+1234567892';
|
||||
|
||||
## <a name="transports-playsms">PlaySMS</a>
|
||||
|
||||
PlaySMS is an OpenSource SMS-Gateway that can be used via their HTTP-API using a Username and WebService-Token.
|
||||
Please consult PlaySMS's documentation regarding number formating.
|
||||
PlaySMS is an open source SMS-Gateway that can be used via their HTTP-API using a Username and WebService-Token.
|
||||
Please consult PlaySMS's documentation regarding number formatting.
|
||||
Here an example using 3 numbers, any amount of numbers is supported:
|
||||
|
||||
~~
|
||||
@@ -529,7 +529,7 @@ And in the Rule:
|
||||
This Example-macro is a Boolean-macro, it applies a form of filter to the set of results defined by the rule.
|
||||
All macros that are not unary should return Boolean.
|
||||
|
||||
You can only apply _Equal_ or _Not-Equal_ Operations on Bollean-macros where `True` is represented by `"1"` and `False` by `"0"`.
|
||||
You can only apply _Equal_ or _Not-Equal_ Operations on Boolean-macros where `True` is represented by `"1"` and `False` by `"0"`.
|
||||
|
||||
|
||||
## <a name="macros-device">Device</a> (Boolean)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
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']`.
|
||||
Usually the poller's name is equal to the machine's hostname, if you want to change it set `$config['distributed_poller_name']`.
|
||||
One can also specify a comma seperated string of poller groups in $config['distributed_poller_group']. The poller will then poll devices from any of the groups listed. If new devices get added from the poller they will be assigned to the first poller group in the list unless the group is specified when adding the device.
|
||||
One can also specify a comma separated string of poller groups in $config['distributed_poller_group']. The poller will then poll devices from any of the groups listed. If new devices get added from the poller they will be assigned to the first poller group in the list unless the group is specified when adding the device.
|
||||
|
||||
## Configuration
|
||||
```php
|
||||
@@ -28,8 +28,7 @@ $config['distributed_poller_memcached_port'] = '11211';
|
||||
```
|
||||
|
||||
## Example Setup
|
||||
Below is an example setup based on a real deployment which at the time of writing covers over 2,500 devices and 50,000 ports. The setup is running within an Openstack environment with some commodity ha
|
||||
rdware for remote pollers. Here's a diagram of how you can scale LibreNMS out:
|
||||
Below is an example setup based on a real deployment which at the time of writing covers over 2,500 devices and 50,000 ports. The setup is running within an OpenStack environment with some commodity hardware for remote pollers. Here's a diagram of how you can scale LibreNMS out:
|
||||
|
||||

|
||||
|
||||
@@ -53,7 +52,7 @@ 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
|
||||
1.5 or greater then add this config to your pollers:
|
||||
@@ -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:
|
||||
|
||||
@@ -51,7 +51,7 @@ Attribute | Type | Description
|
||||
`$this->external` | `Array` | Contains loaded extra `commands`.
|
||||
`$this->nick` | `String` | Bot's `nick` on the IRC.
|
||||
`$this->pass` | `String` | IRC-Server's passphrase.
|
||||
`$this->port` | `Int` | IRC-Sever's port-number.
|
||||
`$this->port` | `Int` | IRC-Server's port-number.
|
||||
`$this->server` | `String` | IRC-Server's hostname.
|
||||
`$this->ssl` | `Boolean` | SSL-Flag.
|
||||
`$this->tick` | `Int` | Interval to check buffers in microseconds.
|
||||
|
||||
@@ -48,7 +48,7 @@ Command | Description
|
||||
`.port <hostname> <ifname>` | Prints Port-related information from `ifname` on given `hostname`.
|
||||
`.quit` | Disconnect from IRC and exit.
|
||||
`.reload` | Reload configuration.
|
||||
`.status <type>` | Prints status informations for given `type`. Type can be `devices`, `services`, `ports`. Shorthands are: `dev`,`srv`,`prt`
|
||||
`.status <type>` | Prints status information for given `type`. Type can be `devices`, `services`, `ports`. Shorthands are: `dev`,`srv`,`prt`
|
||||
`.version` | Prints `$this->config['project_name_version']`.
|
||||
|
||||
( __/!\__ All commands are case-_insensitive_ but their arguments are case-_sensitive_)
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ Either remove mac or xdp depending on which you want.
|
||||
A global map will be drawn from the information in the database, it is worth noting that this could lead to a large network map.
|
||||
Network maps for individual devices are available showing the relationship with other devices.
|
||||
|
||||
One can also specicify the parameters to be used for drawing and 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'] = '{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
This documentation will hopefully give you a basis for how to write a plugin for LibreNMS.
|
||||
|
||||
A test plugin is available on GitHib: https://github.com/laf/Test
|
||||
A test plugin is available on GitHub: https://github.com/laf/Test
|
||||
|
||||
Plugins need to be installed into html/plugins
|
||||
|
||||
@@ -45,7 +45,7 @@ PluginName.inc.php - This file is the main included file when browsing to the pl
|
||||
|
||||
### System Hooks ###
|
||||
|
||||
System hooks are called as functions within your plugin class, so for example to create a menu entry within the PLugin dropdown you would do:
|
||||
System hooks are called as functions within your plugin class, so for example to create a menu entry within the Plugin dropdown you would do:
|
||||
|
||||
```
|
||||
public function menu() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Configuring interface descriptions for parsing.
|
||||
|
||||
LibreNMS includes the ability to parse your interface descriptions for set information to diplay and segment in the WebUI.
|
||||
LibreNMS includes the ability to parse your interface descriptions for set information to display and segment in the WebUI.
|
||||
|
||||
The following information is used from interface descriptions:
|
||||
|
||||
@@ -57,7 +57,7 @@ description Cust: Customer A (This customer is gold)
|
||||
[]
|
||||
|
||||
i.e:
|
||||
description Cust: Customer A [100Mbs]
|
||||
description Cust: Customer A [100Mbps]
|
||||
|
||||
You can use any of these additional options like:
|
||||
|
||||
@@ -66,10 +66,10 @@ description Cust: Customer A {ID4321} [1Gbps]
|
||||
|
||||
This information is then held within the ports table within the database, as an example:
|
||||
|
||||
description Core: Nas bond [1Gbps]
|
||||
description Core: NAS bond [1Gbps]
|
||||
```sh
|
||||
port_descr_type: core
|
||||
port_descr_descr: Nas bond
|
||||
port_descr_descr: NAS bond
|
||||
port_descr_circuit: NULL
|
||||
port_descr_speed: 1Gbps
|
||||
port_descr_notes: NULL
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Proxmox graphing
|
||||
It is possible to create graphs of the Proxmox **VMs** that run on your monitored machines. Currently, only trafficgraphs are created. One for each interface on each VM. Possibly, IO grahps will be added later on.
|
||||
It is possible to create graphs of the Proxmox **VMs** that run on your monitored machines. Currently, only traffic graphs are created. One for each interface on each VM. Possibly, IO graphs will be added later on.
|
||||
|
||||
The ultimate goal is to be able to create traffic bills for VMs, no matter on which physical machine that VM runs.
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -9,7 +9,7 @@ To enable this you can do so in three ways!
|
||||
- For the actual device, Edit Device -> Misc
|
||||
- For each port, Edit Device -> Port Settings
|
||||
|
||||
Now when a port interface speed changes (this can happen because of a physical change or just because the device has mis-reported) the max value is set. If you don't want to wait until
|
||||
Now when a port interface speed changes (this can happen because of a physical change or just because the device has misreported) the max value is set. If you don't want to wait until
|
||||
a port speed changes then you can run the included script:
|
||||
|
||||
script/tune_port.php -h <hostname> -p <ifName>
|
||||
|
||||
@@ -28,14 +28,14 @@ The underlying HMAC-SHA1 remains the same for both types, security advantages or
|
||||
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.
|
||||
RFC4226 suggests a resynchronization attempt in case the passcode mismatches, providing the attacker a range of up to +/- 3 Minutes to create passcodes.
|
||||
|
||||
|
||||
## <a name="hotp">Counterbased One-Time-Password (TOTP)</a>
|
||||
|
||||
This type uses an internal counter that needs to be in sync with the server's counter to successfully authenticate the passcodes.
|
||||
The main advantage over timebased OTP is the attacker doesn't only need to know the Secretkey but also the server's Counter in order to create valid passcodes.
|
||||
RFC4226 suggests a resynchronization attempt in case the passcode mismatches, providing the attacker a range of upto +4 increments from the actual counter to create passcodes.
|
||||
RFC4226 suggests a resynchronization attempt in case the passcode mismatches, providing the attacker a range of up to +4 increments from the actual counter to create passcodes.
|
||||
|
||||
# <a name="config">Configuration</a>
|
||||
|
||||
|
||||
@@ -209,7 +209,7 @@ sub vcl_backend_response {
|
||||
# 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.
|
||||
|
||||
|
||||
+12
-12
@@ -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)
|
||||
@@ -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
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -28,11 +28,11 @@ LibreNMS ships with the following software components:
|
||||
|
||||
- Code for UBNT Devices
|
||||
Mark Gibbons <mgibbons@oemcomp.com>
|
||||
Initial code base submited via PR721
|
||||
Initial code base submitted via PR721
|
||||
|
||||
- Jquery LazyLoad
|
||||
http://www.appelsiini.net/projects/lazyload
|
||||
Mika Tuupola <tuupola@appelsiini.net> (@tuupola on github)
|
||||
Mika Tuupola <tuupola@appelsiini.net> (@tuupola on GitHub)
|
||||
MIT License
|
||||
|
||||
- influxdb-php
|
||||
|
||||
@@ -327,8 +327,8 @@ Create the cronjob
|
||||
|
||||
### Daily Updates ###
|
||||
|
||||
LibreNMS performs daily updates by default. At 00:15 system time every day, a `git pull --no-edit --quiet` is performed. You can override this default by edit
|
||||
ing your `config.php` file. Remove the comment (the `#` mark) on the line:
|
||||
LibreNMS performs daily updates by default. At 00:15 system time every day, a `git pull --no-edit --quiet` is performed. You can override this default by editing
|
||||
your `config.php` file. Remove the comment (the `#` mark) on the line:
|
||||
|
||||
#$config['update'] = 0;
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ If you would like to alter any of these then please add your config option to `c
|
||||
```php
|
||||
$config['install_dir'] = "/opt/librenms";
|
||||
```
|
||||
Set the installation directory (defaults to /opt/librenms), if you clone the github branch to another location ensure you alter this.
|
||||
Set the installation directory (defaults to /opt/librenms), if you clone the GitHub branch to another location ensure you alter this.
|
||||
|
||||
```php
|
||||
$config['temp_dir'] = "/tmp";
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -130,7 +130,7 @@ $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.
|
||||
|
||||
|
||||
+1
-1
@@ -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;
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2015 Daniel Preussker, QuxLabs UG <preussker@quxlabs.com>
|
||||
/* Copyright (C) 2015-2016 Daniel Preussker, QuxLabs UG <preussker@quxlabs.com>
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
@@ -16,7 +16,7 @@
|
||||
/**
|
||||
* Generic Graph Widget
|
||||
* @author Daniel Preussker
|
||||
* @copyright 2015 Daniel Preussker, QuxLabs UG
|
||||
* @copyright 2015-2016 Daniel Preussker, QuxLabs UG
|
||||
* @license GPL
|
||||
* @package LibreNMS
|
||||
* @subpackage Widgets
|
||||
@@ -25,6 +25,14 @@
|
||||
if( defined('show_settings') || empty($widget_settings) ) {
|
||||
$common_output[] = '
|
||||
<form class="form" onsubmit="widget_settings(this); return false;">
|
||||
<div class="form-group">
|
||||
<div class="col-sm-2">
|
||||
<label for="title" class="control-label">Title: </label>
|
||||
</div>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" name="title" placeholder="Automatic Title" value="'.htmlspecialchars($widget_settings['title']).'">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-2">
|
||||
<label for="graph_type" class="control-label">Graph: </label>
|
||||
@@ -365,12 +373,13 @@ $(function() {
|
||||
</script>';
|
||||
}
|
||||
else {
|
||||
$widget_settings['title'] = "";
|
||||
$type = explode('_',$widget_settings['graph_type'],2);
|
||||
$type = array_shift($type);
|
||||
$widget_settings['graph_'.$type] = json_decode($widget_settings['graph_'.$type],true)?:$widget_settings['graph_'.$type];
|
||||
if ($type == 'device') {
|
||||
$widget_settings['title'] = $widget_settings['graph_device']['name']." / ".$widget_settings['graph_type'];
|
||||
if (empty($widget_settings['title'])) {
|
||||
$widget_settings['title'] = $widget_settings['graph_device']['name']." / ".$widget_settings['graph_type'];
|
||||
}
|
||||
$param = 'device='.$widget_settings['graph_device']['device_id'];
|
||||
}
|
||||
elseif ($type == 'application') {
|
||||
@@ -394,27 +403,31 @@ else {
|
||||
$type_where .= " $or `port_descr_type` = ?";
|
||||
$or = 'OR';
|
||||
$type_param[] = $type;
|
||||
$type_where .= ') ';
|
||||
$type_where .= ') ';
|
||||
foreach (dbFetchRows("SELECT port_id FROM `ports` WHERE $type_where ORDER BY ifAlias", $type_param) as $port) {
|
||||
$tmp[] = $port['port_id'];
|
||||
}
|
||||
$param = 'id='.implode(',',$tmp);
|
||||
$widget_settings['graph_type']= 'multiport_bits_separate';
|
||||
$widget_settings['title'] = 'Overall '.ucfirst($type).' Bits ('.$widget_settings['graph_range'].')';
|
||||
$param = 'id='.implode(',',$tmp);
|
||||
$widget_settings['graph_type'] = 'multiport_bits_separate';
|
||||
if (empty($widget_settings['title'])) {
|
||||
$widget_settings['title'] = 'Overall '.ucfirst($type).' Bits ('.$widget_settings['graph_range'].')';
|
||||
}
|
||||
}
|
||||
elseif ($type == 'custom') {
|
||||
foreach (dbFetchRows("SELECT port_id FROM `ports` WHERE `port_descr_type` = ? ORDER BY ifAlias", array($widget_settings['graph_custom'])) as $port) {
|
||||
$tmp[] = $port['port_id'];
|
||||
}
|
||||
$param = 'id='.implode(',',$tmp);
|
||||
$widget_settings['graph_type']= 'multiport_bits_separate';
|
||||
$widget_settings['title'] = 'Overall '.ucfirst(htmlspecialchars($widget_settings['graph_custom'])).' Bits ('.$widget_settings['graph_range'].')';
|
||||
$param = 'id='.implode(',',$tmp);
|
||||
$widget_settings['graph_type'] = 'multiport_bits_separate';
|
||||
if (empty($widget_settings['title'])) {
|
||||
$widget_settings['title'] = 'Overall '.ucfirst(htmlspecialchars($widget_settings['graph_custom'])).' Bits ('.$widget_settings['graph_range'].')';
|
||||
}
|
||||
}
|
||||
else {
|
||||
$param = 'id='.$widget_settings['graph_'.$type][$type.'_id'];
|
||||
$param = 'id='.$widget_settings['graph_'.$type][$type.'_id'];
|
||||
}
|
||||
if (empty($widget_settings['title'])) {
|
||||
$widget_settings['title'] = $widget_settings['graph_'.$type]['hostname']." / ".$widget_settings['graph_'.$type]['name']." / ".$widget_settings['graph_type'];
|
||||
$widget_settings['title'] = $widget_settings['graph_'.$type]['hostname']." / ".$widget_settings['graph_'.$type]['name']." / ".$widget_settings['graph_type'];
|
||||
}
|
||||
$common_output[] = '<img class="minigraph-image" width="'.$widget_dimensions['x'].'" height="'.$widget_dimensions['y'].'" src="graph.php?'.$param.'&from='.$config['time'][$widget_settings['graph_range']].'&to='.$config['time']['now'].'&width='.$widget_dimensions['x'].'&height='.$widget_dimensions['y'].'&type='.$widget_settings['graph_type'].'&legend='.($widget_settings['graph_legend'] == 1 ? 'yes' : 'no').'&absolute=1"/>';
|
||||
$common_output[] = '<img class="minigraph-image" width="'.$widget_dimensions['x'].'" height="'.$widget_dimensions['y'].'" src="graph.php?'.$param.'&from='.$config['time'][$widget_settings['graph_range']].'&to='.$config['time']['now'].'&width='.$widget_dimensions['x'].'&height='.$widget_dimensions['y'].'&type='.$widget_settings['graph_type'].'&legend='.($widget_settings['graph_legend'] == 1 ? 'yes' : 'no').'&absolute=1"/>';
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
$common_output[] = '
|
||||
<div class="table-responsive">
|
||||
<table id="stp-ports" class="table table-condensed table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-column-id="port_id">Port</th>
|
||||
<th data-column-id="priority">Priority</th>
|
||||
<th data-column-id="state">State</th>
|
||||
<th data-column-id="enable">Enable</th>
|
||||
<th data-column-id="pathCost">Path cost</th>
|
||||
<th data-column-id="designatedRoot">Designated root</th>
|
||||
<th data-column-id="designatedCost">Designated cost</th>
|
||||
<th data-column-id="designatedBridge">Designated bridge</th>
|
||||
<th data-column-id="designatedPort">Designated port</th>
|
||||
<th data-column-id="forwardTransitions">Forward transitions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
var grid = $("#stp-ports").bootgrid( {
|
||||
ajax: true,
|
||||
templates: {search: ""},
|
||||
post: function ()
|
||||
{
|
||||
return {
|
||||
id: "stp-ports",
|
||||
device_id: ' . $device['device_id'] . ',
|
||||
};
|
||||
},
|
||||
url: "ajax_table.php"
|
||||
});
|
||||
|
||||
</script>
|
||||
';
|
||||
@@ -21,11 +21,20 @@ if ($device['disabled'] == '1') {
|
||||
$type = strtolower($device['os']);
|
||||
|
||||
$image = getImage($device);
|
||||
$host_id = dbFetchCell("SELECT `device_id` FROM `vminfo` WHERE `vmwVmDisplayName` = ? OR `vmwVmDisplayName` = ?", array($device['hostname'],$device['hostname'].'.'.$config['mydomain']));
|
||||
|
||||
echo '
|
||||
<tr bgcolor="'.$device_colour.'" class="alert '.$class.'">
|
||||
<td width="40" align=center valign=middle style="padding: 21px;"><span class="device_icon">'.$image.'</span></td>
|
||||
<td valign=middle style="padding: 0 15px;"><span style="font-size: 20px;">'.generate_device_link($device).'</span>
|
||||
<td><span class="device_icon">'.$image.'</span></td>
|
||||
<td>';
|
||||
if ($host_id > 0) {
|
||||
echo '
|
||||
<a href="'.generate_url(array('page'=>'device','device'=>$host_id)).'"><i class="fa fa-server fa-fw fa-lg"></i></a>
|
||||
';
|
||||
}
|
||||
|
||||
echo '
|
||||
<span style="font-size: 20px;">'.generate_device_link($device).'</span>
|
||||
<br />'.generate_link($device['location'], array('page' => 'devices', 'location' => $device['location'])).'</td>
|
||||
<td>';
|
||||
|
||||
|
||||
@@ -4,8 +4,9 @@
|
||||
$i = 0;
|
||||
|
||||
foreach ($ports as $port) {
|
||||
if (is_file($config['rrd_dir'].'/'.$port['hostname'].'/port-'.safename($port['ifIndex'].'.rrd'))) {
|
||||
$rrd_list[$i]['filename'] = $config['rrd_dir'].'/'.$port['hostname'].'/port-'.safename($port['ifIndex'].'.rrd');
|
||||
$rrd_file = get_port_rrdfile_path ($port['hostname'], $port['port_id']);
|
||||
if (is_file($rrd_file)) {
|
||||
$rrd_list[$i]['filename'] = $rrd_file;
|
||||
$rrd_list[$i]['descr'] = $port['ifDescr'];
|
||||
$i++;
|
||||
}
|
||||
|
||||
@@ -10,8 +10,8 @@ if (!is_array($config['customers_descr'])) {
|
||||
$descr_type = "'".implode("', '", $config['customers_descr'])."'";
|
||||
|
||||
foreach (dbFetchRows('SELECT * FROM `ports` AS I, `devices` AS D WHERE `port_descr_type` IN (?) AND `port_descr_descr` = ? AND D.device_id = I.device_id', array(array($descr_type), $vars['id'])) as $port) {
|
||||
if (is_file($config['rrd_dir'].'/'.$port['hostname'].'/port-'.safename($port['ifIndex'].'.rrd'))) {
|
||||
$rrd_filename = $config['rrd_dir'].'/'.$port['hostname'].'/port-'.safename($port['ifIndex'].'.rrd');
|
||||
$rrd_filename = get_port_rrdfile_path ($port['hostname'], $port['port_id']); // FIXME: Unification OK?
|
||||
if (is_file($rrd_filename)) {
|
||||
$rrd_list[$i]['filename'] = $rrd_filename;
|
||||
$rrd_list[$i]['descr'] = $port['hostname'].'-'.$port['ifDescr'];
|
||||
$rrd_list[$i]['descr_in'] = shorthost($port['hostname']);
|
||||
@@ -20,7 +20,6 @@ foreach (dbFetchRows('SELECT * FROM `ports` AS I, `devices` AS D WHERE `port_des
|
||||
}
|
||||
}
|
||||
|
||||
// echo($config['rrd_dir'] . "/" . $port['hostname'] . "/port-" . safename($port['ifIndex'] . ".rrd"));
|
||||
$units = 'bps';
|
||||
$total_units = 'B';
|
||||
$colours_in = 'greens';
|
||||
|
||||
@@ -22,7 +22,7 @@ foreach (dbFetchRows('SELECT * FROM `ports` WHERE `device_id` = ?', array($devic
|
||||
}
|
||||
}
|
||||
|
||||
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/port-'.safename($port['ifIndex'].'.rrd');
|
||||
$rrd_filename = get_port_rrdfile_path ($device['hostname'], $port['port_id']);
|
||||
if ($ignore != 1 && is_file($rrd_filename)) {
|
||||
$port = ifLabel($port);
|
||||
// Fix Labels! ARGH. This needs to be in the bloody database!
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS
|
||||
* LibreNMS per-module poller performance
|
||||
*
|
||||
* Copyright (c) 2016 Mike Rostermund <mike@kollegienet.dk>
|
||||
* Copyright (c) 2016 Paul D. Gear <paul@librenms.org>
|
||||
*
|
||||
* 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
|
||||
@@ -11,28 +13,28 @@
|
||||
*/
|
||||
|
||||
$scale_min = '0';
|
||||
$colour_scheme = 'mixed';
|
||||
$attribs = get_dev_attribs($device['device_id']);
|
||||
ksort($config['poller_modules']);
|
||||
|
||||
require 'includes/graphs/common.inc.php';
|
||||
|
||||
$colour_iter = 0;
|
||||
$rrd_options .= " 'COMMENT:Seconds Current Minimum Maximum Average\\n'";
|
||||
$count = 0;
|
||||
foreach ($config['poller_modules'] as $module => $module_status) {
|
||||
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/poller-'.$module.'-perf.rrd';
|
||||
$rrd_filename = rrd_name($device['hostname'], array('poller-perf', $module));
|
||||
if ($attribs['poll_'.$module] || ( $module_status && !isset($attribs['poll_'.$module]))) {
|
||||
if (is_file($rrd_filename)) {
|
||||
if (!$config['graph_colours'][$colour_scheme][$colour_iter]) {
|
||||
$colour_iter = 0;
|
||||
}
|
||||
$colour = $config['graph_colours'][$colour_scheme][$colour_iter];
|
||||
$colour_iter++;
|
||||
|
||||
$rrd_options .= ' DEF:'.$module.'='.$rrd_filename.':'.$module.':AVERAGE';
|
||||
$rrd_options .= ' LINE1.25:'.$module.'#'.$colour.':"'.str_pad($module, 18," ").'"';
|
||||
$rrd_options .= ' GPRINT:'.$module.':LAST:%6.2lf GPRINT:'.$module.':AVERAGE:%7.2lf';
|
||||
$rrd_options .= " GPRINT:".$module.":MAX:%7.2lf 'GPRINT:".$module.":AVERAGE:%7.2lf\\n'";
|
||||
$ds['ds'] = 'poller';
|
||||
$ds['descr'] = $module;
|
||||
$ds['filename'] = $rrd_filename;
|
||||
$rrd_list[] = $ds;
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$unit_text = "Seconds";
|
||||
$simple_rrd = false;
|
||||
$nototal = false;
|
||||
$text_orig = true;
|
||||
$colours = 'manycolours';
|
||||
require "includes/graphs/generic_multi_simplex_seperated.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;
|
||||
|
||||
@@ -24,8 +24,9 @@ foreach ($devices as $device) {
|
||||
}
|
||||
}
|
||||
|
||||
if (is_file($config['rrd_dir'].'/'.$device['hostname'].'/port-'.safename($int['ifIndex'].'.rrd')) && $ignore != 1) {
|
||||
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/port-'.safename($int['ifIndex'].'.rrd');
|
||||
$rrd_file = get_port_rrdfile_path ($device['hostname'], $int['port_id']);
|
||||
if (is_file($rrd_file) && $ignore != 1) {
|
||||
$rrd_filename = $rrd_file; // FIXME: Can this be unified without side-effects?
|
||||
$rrd_list[$i]['filename'] = $rrd_filename;
|
||||
$rrd_list[$i]['descr'] = $port['label'];
|
||||
$rrd_list[$i]['descr_in'] = $device['hostname'];
|
||||
|
||||
@@ -8,9 +8,10 @@ foreach (explode(',', $vars['id']) as $ifid) {
|
||||
$ifid = str_replace('!', '', $ifid);
|
||||
}
|
||||
|
||||
$int = dbFetchRow('SELECT `ifIndex`, `hostname` FROM `ports` AS I, devices as D WHERE I.port_id = ? AND I.device_id = D.device_id', array($ifid));
|
||||
if (is_file($config['rrd_dir'].'/'.$int['hostname'].'/port-'.safename($int['ifIndex'].'.rrd'))) {
|
||||
$rrd_filenames[$i] = $config['rrd_dir'].'/'.$int['hostname'].'/port-'.safename($int['ifIndex'].'.rrd');
|
||||
$int = dbFetchRow('SELECT `hostname` FROM `ports` AS I, devices as D WHERE I.port_id = ? AND I.device_id = D.device_id', array($ifid));
|
||||
$rrd_file = get_port_rrdfile_path ($int['hostname'], $ifid);
|
||||
if (is_file($rrd_file)) {
|
||||
$rrd_filenames[$i] = $rrd_file;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,10 +13,11 @@ if ($height < '99') {
|
||||
$i = 1;
|
||||
|
||||
foreach (explode(',', $_GET['id']) as $ifid) {
|
||||
$int = dbFetchRow('SELECT `ifIndex`, `hostname` FROM `ports` AS I, devices as D WHERE I.port_id = ? AND I.device_id = D.device_id', array($ifid));
|
||||
if (is_file($config['rrd_dir'].'/'.$int['hostname'].'/port-'.$int['ifIndex'].'.rrd')) {
|
||||
$rrd_options .= ' DEF:inoctets'.$i.'='.$config['rrd_dir'].'/'.$int['hostname'].'/port-'.$int['ifIndex'].'.rrd:INOCTETS:AVERAGE';
|
||||
$rrd_options .= ' DEF:outoctets'.$i.'='.$config['rrd_dir'].'/'.$int['hostname'].'/port-'.$int['ifIndex'].'.rrd:OUTOCTETS:AVERAGE';
|
||||
$int = dbFetchRow('SELECT `hostname` FROM `ports` AS I, devices as D WHERE I.port_id = ? AND I.device_id = D.device_id', array($ifid));
|
||||
$rrd_file = get_port_rrdfile_path ($int['hostname'], $ifid);
|
||||
if (is_file($rrd_file)) {
|
||||
$rrd_options .= ' DEF:inoctets'.$i.'='.$rrd_file.':INOCTETS:AVERAGE';
|
||||
$rrd_options .= ' DEF:outoctets'.$i.'='.$rrd_file.':OUTOCTETS:AVERAGE';
|
||||
$in_thing .= $seperator.'inoctets'.$i.',UN,0,'.'inoctets'.$i.',IF';
|
||||
$out_thing .= $seperator.'outoctets'.$i.',UN,0,'.'outoctets'.$i.',IF';
|
||||
$pluses .= $plus;
|
||||
@@ -30,10 +31,11 @@ unset($seperator);
|
||||
unset($plus);
|
||||
|
||||
foreach (explode(',', $_GET['idb']) as $ifid) {
|
||||
$int = dbFetchRow('SELECT `ifIndex`, `hostname` FROM `ports` AS I, devices as D WHERE I.port_id = ? AND I.device_id = D.device_id', array($ifid));
|
||||
if (is_file($config['rrd_dir'].'/'.$int['hostname'].'/port-'.$int['ifIndex'].'.rrd')) {
|
||||
$rrd_options .= ' DEF:inoctetsb'.$i.'='.$config['rrd_dir'].'/'.$int['hostname'].'/port-'.$int['ifIndex'].'.rrd:INOCTETS:AVERAGE';
|
||||
$rrd_options .= ' DEF:outoctetsb'.$i.'='.$config['rrd_dir'].'/'.$int['hostname'].'/port-'.$int['ifIndex'].'.rrd:OUTOCTETS:AVERAGE';
|
||||
$int = dbFetchRow('SELECT `hostname` FROM `ports` AS I, devices as D WHERE I.port_id = ? AND I.device_id = D.device_id', array($ifid));
|
||||
$rrd_file = get_port_rrdfile_path ($int['hostname'], $ifid);
|
||||
if (is_file($rrd_file)) {
|
||||
$rrd_options .= ' DEF:inoctetsb'.$i.'='.$rrd_file.':INOCTETS:AVERAGE';
|
||||
$rrd_options .= ' DEF:outoctetsb'.$i.'='.$rrd_file.':OUTOCTETS:AVERAGE';
|
||||
$in_thingb .= $seperator.'inoctetsb'.$i.',UN,0,'.'inoctetsb'.$i.',IF';
|
||||
$out_thingb .= $seperator.'outoctetsb'.$i.',UN,0,'.'outoctetsb'.$i.',IF';
|
||||
$plusesb .= $plus;
|
||||
|
||||
@@ -4,9 +4,10 @@ $i = 0;
|
||||
|
||||
foreach (explode(',', $vars['id']) as $ifid) {
|
||||
$port = dbFetchRow('SELECT * FROM `ports` AS I, devices as D WHERE I.port_id = ? AND I.device_id = D.device_id', array($ifid));
|
||||
if (is_file($config['rrd_dir'].'/'.$port['hostname'].'/port-'.safename($port['ifIndex'].'.rrd'))) {
|
||||
$rrd_file = get_port_rrdfile_path ($port['hostname'], $ifid);
|
||||
if (is_file($rrd_file)) {
|
||||
$port = ifLabel($port);
|
||||
$rrd_list[$i]['filename'] = $config['rrd_dir'].'/'.$port['hostname'].'/port-'.safename($port['ifIndex'].'.rrd');
|
||||
$rrd_list[$i]['filename'] = $rrd_file;
|
||||
$rrd_list[$i]['descr'] = $port['hostname'].' '.$port['ifDescr'];
|
||||
$rrd_list[$i]['descr_in'] = $port['hostname'];
|
||||
$rrd_list[$i]['descr_out'] = makeshortif($port['label']);
|
||||
|
||||
@@ -14,8 +14,9 @@ if ($height < '99') {
|
||||
$i = 1;
|
||||
|
||||
foreach (explode(',', $_GET['id']) as $ifid) {
|
||||
$int = dbFetchRow('SELECT `ifIndex`, `hostname` FROM `ports` AS I, devices as D WHERE I.port_id = ? AND I.device_id = D.device_id', array($ifid));
|
||||
if (is_file($config['rrd_dir'].'/'.$int['hostname'].'/port-'.$int['ifIndex'].'.rrd')) {
|
||||
$int = dbFetchRow('SELECT `hostname` FROM `ports` AS I, devices as D WHERE I.port_id = ? AND I.device_id = D.device_id', array($ifid));
|
||||
$rrd_file = get_port_rrdfile_path ($int['hostname'], $ifid);
|
||||
if (is_file($rrd_file)) {
|
||||
if (strstr($inverse, 'a')) {
|
||||
$in = 'OUT';
|
||||
$out = 'IN';
|
||||
@@ -25,8 +26,8 @@ foreach (explode(',', $_GET['id']) as $ifid) {
|
||||
$out = 'OUT';
|
||||
}
|
||||
|
||||
$rrd_options .= ' DEF:inoctets'.$i.'='.$config['rrd_dir'].'/'.$int['hostname'].'/port-'.$int['ifIndex'].'.rrd:'.$in.'OCTETS:AVERAGE';
|
||||
$rrd_options .= ' DEF:outoctets'.$i.'='.$config['rrd_dir'].'/'.$int['hostname'].'/port-'.$int['ifIndex'].'.rrd:'.$out.'OCTETS:AVERAGE';
|
||||
$rrd_options .= ' DEF:inoctets'.$i.'='.$rrd_file.':'.$in.'OCTETS:AVERAGE';
|
||||
$rrd_options .= ' DEF:outoctets'.$i.'='.$rrd_file.':'.$out.'OCTETS:AVERAGE';
|
||||
$in_thing .= $seperator.'inoctets'.$i.',UN,0,'.'inoctets'.$i.',IF';
|
||||
$out_thing .= $seperator.'outoctets'.$i.',UN,0,'.'outoctets'.$i.',IF';
|
||||
$pluses .= $plus;
|
||||
@@ -40,8 +41,9 @@ unset($seperator);
|
||||
unset($plus);
|
||||
|
||||
foreach (explode(',', $_GET['idb']) as $ifid) {
|
||||
$int = dbFetchRow('SELECT `ifIndex`, `hostname` FROM `ports` AS I, devices as D WHERE I.port_id = ? AND I.device_id = D.device_id', array($ifid));
|
||||
if (is_file($config['rrd_dir'].'/'.$int['hostname'].'/port-'.$int['ifIndex'].'.rrd')) {
|
||||
$int = dbFetchRow('SELECT `hostname` FROM `ports` AS I, devices as D WHERE I.port_id = ? AND I.device_id = D.device_id', array($ifid));
|
||||
$rrd_file = get_port_rrdfile_path ($int['hostname'], $ifid);
|
||||
if (is_file($rrd_file)) {
|
||||
if (strstr($inverse, 'b')) {
|
||||
$in = 'OUT';
|
||||
$out = 'IN';
|
||||
@@ -51,8 +53,8 @@ foreach (explode(',', $_GET['idb']) as $ifid) {
|
||||
$out = 'OUT';
|
||||
}
|
||||
|
||||
$rrd_options .= ' DEF:inoctetsb'.$i.'='.$config['rrd_dir'].'/'.$int['hostname'].'/port-'.$int['ifIndex'].'.rrd:'.$in.'OCTETS:AVERAGE';
|
||||
$rrd_options .= ' DEF:outoctetsb'.$i.'='.$config['rrd_dir'].'/'.$int['hostname'].'/port-'.$int['ifIndex'].'.rrd:'.$out.'OCTETS:AVERAGE';
|
||||
$rrd_options .= ' DEF:inoctetsb'.$i.'='.$rrd_file.':'.$in.'OCTETS:AVERAGE';
|
||||
$rrd_options .= ' DEF:outoctetsb'.$i.'='.$rrd_file.':'.$out.'OCTETS:AVERAGE';
|
||||
$in_thingb .= $seperator.'inoctetsb'.$i.',UN,0,'.'inoctetsb'.$i.',IF';
|
||||
$out_thingb .= $seperator.'outoctetsb'.$i.',UN,0,'.'outoctetsb'.$i.',IF';
|
||||
$plusesb .= $plus;
|
||||
@@ -66,8 +68,9 @@ unset($seperator);
|
||||
unset($plus);
|
||||
|
||||
foreach (explode(',', $_GET['idc']) as $ifid) {
|
||||
$int = dbFetchRow('SELECT `ifIndex`, `hostname` FROM `ports` AS I, devices as D WHERE I.port_id = ? AND I.device_id = D.device_id', array($ifid));
|
||||
if (is_file($config['rrd_dir'].'/'.$int['hostname'].'/port-'.$int['ifIndex'].'.rrd')) {
|
||||
$int = dbFetchRow('SELECT `hostname` FROM `ports` AS I, devices as D WHERE I.port_id = ? AND I.device_id = D.device_id', array($ifid));
|
||||
$rrd_file = get_port_rrdfile_path ($int['hostname'], $ifid);
|
||||
if (is_file($rrd_file)) {
|
||||
if (strstr($inverse, 'c')) {
|
||||
$in = 'OUT';
|
||||
$out = 'IN';
|
||||
@@ -77,8 +80,8 @@ foreach (explode(',', $_GET['idc']) as $ifid) {
|
||||
$out = 'OUT';
|
||||
}
|
||||
|
||||
$rrd_options .= ' DEF:inoctetsc'.$i.'='.$config['rrd_dir'].'/'.$int['hostname'].'/port-'.$int['ifIndex'].'.rrd:'.$in.'OCTETS:AVERAGE';
|
||||
$rrd_options .= ' DEF:outoctetsc'.$i.'='.$config['rrd_dir'].'/'.$int['hostname'].'/port-'.$int['ifIndex'].'.rrd:'.$out.'OCTETS:AVERAGE';
|
||||
$rrd_options .= ' DEF:inoctetsc'.$i.'='.$rrd_file.':'.$in.'OCTETS:AVERAGE';
|
||||
$rrd_options .= ' DEF:outoctetsc'.$i.'='.$rrd_file.':'.$out.'OCTETS:AVERAGE';
|
||||
$in_thingc .= $seperator.'inoctetsc'.$i.',UN,0,'.'inoctetsc'.$i.',IF';
|
||||
$out_thingc .= $seperator.'outoctetsc'.$i.',UN,0,'.'outoctetsc'.$i.',IF';
|
||||
$plusesc .= $plus;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/port-'.safename($port['ifIndex'].'-adsl.rrd');
|
||||
$rrd_filename = get_port_rrdfile_path ($device['hostname'], $port['port_id'], 'adsl');
|
||||
|
||||
$rrd_list[0]['filename'] = $rrd_filename;
|
||||
$rrd_list[0]['descr'] = 'Downstream';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/port-'.safename($port['ifIndex'].'-adsl.rrd');
|
||||
$rrd_filename = get_port_rrdfile_path ($device['hostname'], $port['port_id'], 'adsl');
|
||||
|
||||
$rrd_list[0]['filename'] = $rrd_filename;
|
||||
$rrd_list[0]['descr'] = 'Downstream';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/port-'.safename($port['ifIndex'].'-adsl.rrd');
|
||||
$rrd_filename = get_port_rrdfile_path ($device['hostname'], $port['port_id'], 'adsl');
|
||||
|
||||
$rrd_list[0]['filename'] = $rrd_filename;
|
||||
$rrd_list[0]['descr'] = 'Downstream';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/port-'.safename($port['ifIndex'].'-adsl.rrd');
|
||||
$rrd_filename = get_port_rrdfile_path ($device['hostname'], $port['port_id'], 'adsl');
|
||||
|
||||
$rrd_list[0]['filename'] = $rrd_filename;
|
||||
$rrd_list[0]['descr'] = 'Downstream';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/port-'.safename($port['ifIndex'].'-adsl.rrd');
|
||||
$rrd_filename = get_port_rrdfile_path ($device['hostname'], $port['port_id'], 'adsl');
|
||||
|
||||
$rrd_list[0]['filename'] = $rrd_filename;
|
||||
$rrd_list[0]['descr'] = 'Downstream';
|
||||
|
||||
@@ -13,5 +13,5 @@ if (is_numeric($vars['id']) && ($auth || port_permitted($vars['id']))) {
|
||||
|
||||
$auth = true;
|
||||
|
||||
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/port-'.safename($port['ifIndex'].'.rrd');
|
||||
$rrd_filename = get_port_rrdfile_path ($device['hostname'], $port['port_id']);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS module to display Cisco Class-Based QoS Details
|
||||
*
|
||||
* Copyright (c) 2015 Aaron Daniels <aaron@daniels.id.au>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
require_once "../includes/component.php";
|
||||
$component = new component();
|
||||
$options['filter']['type'] = array('=','Cisco-CBQOS');
|
||||
$components = $component->getComponents($device['device_id'],$options);
|
||||
|
||||
// We only care about our device id.
|
||||
$components = $components[$device['device_id']];
|
||||
|
||||
// Determine a policy to show.
|
||||
if (!isset($vars['policy'])) {
|
||||
foreach ($components as $id => $array) {
|
||||
if ( ($array['qos-type'] == 1) && ($array['ifindex'] == $port['ifIndex']) && ($array['parent'] == 0) ) {
|
||||
// Found the first policy
|
||||
$vars['policy'] = $id;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
include "includes/graphs/common.inc.php";
|
||||
$rrd_options .= " -l 0 -E ";
|
||||
$rrd_options .= " COMMENT:'Class-Map Now Avg Max\\n'";
|
||||
$rrd_additions = "";
|
||||
|
||||
$count = 0;
|
||||
foreach ($components as $id => $array) {
|
||||
if ( ($array['qos-type'] == 2) && ($array['parent'] == $components[$vars['policy']]['sp-obj']) && ($array['sp-id'] == $components[$vars['policy']]['sp-id'])) {
|
||||
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename("port-".$array['ifindex']."-cbqos-".$array['sp-id']."-".$array['sp-obj'].".rrd");
|
||||
|
||||
if (file_exists($rrd_filename)) {
|
||||
// Stack the area on the second and subsequent DS's
|
||||
$stack = "";
|
||||
if ($count != 0) {
|
||||
$stack = ":STACK ";
|
||||
}
|
||||
|
||||
// Grab a color from the array.
|
||||
if ( isset($config['graph_colours']['mixed'][$count]) ) {
|
||||
$color = $config['graph_colours']['mixed'][$count];
|
||||
}
|
||||
else {
|
||||
$color = $config['graph_colours']['oranges'][$count-7];
|
||||
}
|
||||
|
||||
$rrd_additions .= " DEF:DS" . $count . "=" . $rrd_filename . ":bufferdrops:AVERAGE ";
|
||||
$rrd_additions .= " CDEF:MOD" . $count . "=DS" . $count . ",8,* ";
|
||||
$rrd_additions .= " AREA:MOD" . $count . "#" . $color . ":'" . str_pad(substr($components[$id]['label'],0,15),15) . "'" . $stack;
|
||||
$rrd_additions .= " GPRINT:MOD" . $count . ":LAST:%6.2lf%s ";
|
||||
$rrd_additions .= " GPRINT:MOD" . $count . ":AVERAGE:%6.2lf%s ";
|
||||
$rrd_additions .= " GPRINT:MOD" . $count . ":MAX:%6.2lf%s\\\l ";
|
||||
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($rrd_additions == "") {
|
||||
// We didn't add any data points.
|
||||
}
|
||||
else {
|
||||
$rrd_options .= $rrd_additions;
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS module to display Cisco Class-Based QoS Details
|
||||
*
|
||||
* Copyright (c) 2015 Aaron Daniels <aaron@daniels.id.au>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
require_once "../includes/component.php";
|
||||
$component = new component();
|
||||
$options['filter']['type'] = array('=','Cisco-CBQOS');
|
||||
$components = $component->getComponents($device['device_id'],$options);
|
||||
|
||||
// We only care about our device id.
|
||||
$components = $components[$device['device_id']];
|
||||
|
||||
// Determine a policy to show.
|
||||
if (!isset($vars['policy'])) {
|
||||
foreach ($components as $id => $array) {
|
||||
if ( ($array['qos-type'] == 1) && ($array['ifindex'] == $port['ifIndex']) && ($array['parent'] == 0) ) {
|
||||
// Found the first policy
|
||||
$vars['policy'] = $id;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
include "includes/graphs/common.inc.php";
|
||||
$rrd_options .= " -l 0 -E ";
|
||||
$rrd_options .= " COMMENT:'Class-Map Now Avg Max\\n'";
|
||||
$rrd_additions = "";
|
||||
|
||||
$count = 0;
|
||||
foreach ($components as $id => $array) {
|
||||
if ( ($array['qos-type'] == 2) && ($array['parent'] == $components[$vars['policy']]['sp-obj']) && ($array['sp-id'] == $components[$vars['policy']]['sp-id'])) {
|
||||
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename("port-".$array['ifindex']."-cbqos-".$array['sp-id']."-".$array['sp-obj'].".rrd");
|
||||
|
||||
if (file_exists($rrd_filename)) {
|
||||
// Stack the area on the second and subsequent DS's
|
||||
$stack = "";
|
||||
if ($count != 0) {
|
||||
$stack = ":STACK ";
|
||||
}
|
||||
|
||||
// Grab a color from the array.
|
||||
if ( isset($config['graph_colours']['mixed'][$count]) ) {
|
||||
$color = $config['graph_colours']['mixed'][$count];
|
||||
}
|
||||
else {
|
||||
$color = $config['graph_colours']['oranges'][$count-7];
|
||||
}
|
||||
|
||||
$rrd_additions .= " DEF:DS" . $count . "=" . $rrd_filename . ":qosdrops:AVERAGE ";
|
||||
$rrd_additions .= " CDEF:MOD" . $count . "=DS" . $count . ",8,* ";
|
||||
$rrd_additions .= " AREA:MOD" . $count . "#" . $color . ":'" . str_pad(substr($components[$id]['label'],0,15),15) . "'" . $stack;
|
||||
$rrd_additions .= " GPRINT:MOD" . $count . ":LAST:%6.2lf%s ";
|
||||
$rrd_additions .= " GPRINT:MOD" . $count . ":AVERAGE:%6.2lf%s ";
|
||||
$rrd_additions .= " GPRINT:MOD" . $count . ":MAX:%6.2lf%s\\\l ";
|
||||
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($rrd_additions == "") {
|
||||
// We didn't add any data points.
|
||||
}
|
||||
else {
|
||||
$rrd_options .= $rrd_additions;
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS module to display Cisco Class-Based QoS Details
|
||||
*
|
||||
* Copyright (c) 2015 Aaron Daniels <aaron@daniels.id.au>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
require_once "../includes/component.php";
|
||||
$component = new component();
|
||||
$options['filter']['type'] = array('=','Cisco-CBQOS');
|
||||
$components = $component->getComponents($device['device_id'],$options);
|
||||
|
||||
// We only care about our device id.
|
||||
$components = $components[$device['device_id']];
|
||||
|
||||
// Determine a policy to show.
|
||||
if (!isset($vars['policy'])) {
|
||||
foreach ($components as $id => $array) {
|
||||
if ( ($array['qos-type'] == 1) && ($array['ifindex'] == $port['ifIndex']) && ($array['parent'] == 0) ) {
|
||||
// Found the first policy
|
||||
$vars['policy'] = $id;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
include "includes/graphs/common.inc.php";
|
||||
$rrd_options .= " -l 0 -E ";
|
||||
$rrd_options .= " COMMENT:'Class-Map Now Avg Max\\n'";
|
||||
$rrd_additions = "";
|
||||
|
||||
$count = 0;
|
||||
foreach ($components as $id => $array) {
|
||||
if ( ($array['qos-type'] == 2) && ($array['parent'] == $components[$vars['policy']]['sp-obj']) && ($array['sp-id'] == $components[$vars['policy']]['sp-id'])) {
|
||||
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename("port-".$array['ifindex']."-cbqos-".$array['sp-id']."-".$array['sp-obj'].".rrd");
|
||||
|
||||
if (file_exists($rrd_filename)) {
|
||||
// Stack the area on the second and subsequent DS's
|
||||
$stack = "";
|
||||
if ($count != 0) {
|
||||
$stack = ":STACK ";
|
||||
}
|
||||
|
||||
// Grab a color from the array.
|
||||
if ( isset($config['graph_colours']['mixed'][$count]) ) {
|
||||
$color = $config['graph_colours']['mixed'][$count];
|
||||
}
|
||||
else {
|
||||
$color = $config['graph_colours']['oranges'][$count-7];
|
||||
}
|
||||
|
||||
$rrd_additions .= " DEF:DS" . $count . "=" . $rrd_filename . ":postbits:AVERAGE ";
|
||||
$rrd_additions .= " CDEF:MOD" . $count . "=DS" . $count . ",8,* ";
|
||||
$rrd_additions .= " AREA:MOD" . $count . "#" . $color . ":'" . str_pad(substr($components[$id]['label'],0,15),15) . "'" . $stack;
|
||||
$rrd_additions .= " GPRINT:MOD" . $count . ":LAST:%6.2lf%s ";
|
||||
$rrd_additions .= " GPRINT:MOD" . $count . ":AVERAGE:%6.2lf%s ";
|
||||
$rrd_additions .= " GPRINT:MOD" . $count . ":MAX:%6.2lf%s\\\l ";
|
||||
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($rrd_additions == "") {
|
||||
// We didn't add any data points.
|
||||
}
|
||||
else {
|
||||
$rrd_options .= $rrd_additions;
|
||||
}
|
||||
@@ -18,7 +18,7 @@ $oids = array(
|
||||
);
|
||||
|
||||
$i = 0;
|
||||
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename('port-'.$port['ifIndex'].'-dot3.rrd');
|
||||
$rrd_filename = get_port_rrdfile_path ($device['hostname'], $port['port_id'], 'dot3');
|
||||
|
||||
if (is_file($rrd_filename)) {
|
||||
foreach ($oids as $oid) {
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
<?php
|
||||
|
||||
$rrd_file = get_port_rrdfile_path ($device['hostname'], $port['port_id']);
|
||||
|
||||
// FIXME uhh..
|
||||
if (1) {
|
||||
// $rrd_list[1]['filename'] = $config['rrd_dir'] . "/" . $device['hostname'] . "/port-" . safename($port['ifIndex'] . ".rrd");
|
||||
// $rrd_list[1]['filename'] = $rrd_file;
|
||||
// $rrd_list[1]['descr'] = $int['ifDescr'];
|
||||
// $rrd_list[1]['ds_in'] = "INNUCASTPKTS";
|
||||
// $rrd_list[1]['ds_out'] = "OUTNUCASTPKTS";
|
||||
// $rrd_list[1]['descr'] = "NonUnicast";
|
||||
// $rrd_list[1]['colour_area_in'] = "BB77BB";
|
||||
// $rrd_list[1]['colour_area_out'] = "FFDD88";
|
||||
$rrd_list[2]['filename'] = $config['rrd_dir'].'/'.$device['hostname'].'/port-'.safename($port['ifIndex'].'.rrd');
|
||||
$rrd_list[2]['filename'] = $rrd_file;
|
||||
$rrd_list[2]['descr'] = $int['ifDescr'];
|
||||
$rrd_list[2]['ds_in'] = 'INBROADCASTPKTS';
|
||||
$rrd_list[2]['ds_out'] = 'OUTBROADCASTPKTS';
|
||||
@@ -17,7 +19,7 @@ if (1) {
|
||||
$rrd_list[2]['colour_area_in'] = 'aa37BB';
|
||||
$rrd_list[2]['colour_area_out'] = 'ee9D88';
|
||||
|
||||
$rrd_list[4]['filename'] = $config['rrd_dir'].'/'.$device['hostname'].'/port-'.safename($port['ifIndex'].'.rrd');
|
||||
$rrd_list[4]['filename'] = $rrd_file;
|
||||
$rrd_list[4]['descr'] = $int['ifDescr'];
|
||||
$rrd_list[4]['ds_in'] = 'INMULTICASTPKTS';
|
||||
$rrd_list[4]['ds_out'] = 'OUTMULTICASTPKTS';
|
||||
@@ -36,8 +38,8 @@ if (1) {
|
||||
|
||||
include 'includes/graphs/generic_multi_seperated.inc.php';
|
||||
}
|
||||
else if (is_file($config['rrd_dir'].'/'.$device['hostname'].'/'.safename($port['ifIndex'].'.rrd'))) {
|
||||
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename($port['ifIndex'].'.rrd');
|
||||
else if (is_file($rrd_file)) {
|
||||
$rrd_filename = $rrd_file;
|
||||
|
||||
$ds_in = 'INNUCASTPKTS';
|
||||
$ds_out = 'OUTNUCASTPKTS';
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
// Generate a list of ports and then call the multi_bits grapher to generate from the list
|
||||
$i = 0;
|
||||
foreach (dbFetchRows('SELECT * FROM `ports` WHERE `device_id` = ? AND `pagpGroupIfIndex` = ?', array($port['device_id'], $port['ifIndex'])) as $int) {
|
||||
if (is_file($config['rrd_dir'].'/'.$hostname.'/port-'.safename($int['ifIndex'].'.rrd'))) {
|
||||
$rrd_list[$i]['filename'] = $config['rrd_dir'].'/'.$hostname.'/port-'.safename($int['ifIndex'].'.rrd');
|
||||
$rrd_file = get_port_rrdfile_path ($hostname, int['port_id']);
|
||||
if (is_file($rrd_file)) {
|
||||
$rrd_list[$i]['filename'] = $rrd_file;
|
||||
$rrd_list[$i]['descr'] = $int['ifDescr'];
|
||||
$i++;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ if (isset($_POST['create-default'])) {
|
||||
);
|
||||
$default_rules[] = array(
|
||||
'device_id' => '-1',
|
||||
'rule' => '%macros.port_usage_perc >= "80"',
|
||||
'rule' => '%macros.port_usage_perc >= "80" && %macros.port_up = "1" && %macros.port = "1"',
|
||||
'severity' => 'critical',
|
||||
'extra' => '{"mute":false,"count":"-1","delay":"300"}',
|
||||
'disabled' => 0,
|
||||
@@ -61,7 +61,7 @@ if (isset($_POST['create-default'])) {
|
||||
);
|
||||
$default_rules[] = array(
|
||||
'device_id' => '-1',
|
||||
'rule' => '%sensors.sensor_current > %sensors.sensor_limit',
|
||||
'rule' => '%sensors.sensor_current > %sensors.sensor_limit && %sensors.sensor_alert = "1"',
|
||||
'severity' => 'critical',
|
||||
'extra' => '{"mute":false,"count":"-1","delay":"300"}',
|
||||
'disabled' => 0,
|
||||
@@ -69,7 +69,7 @@ if (isset($_POST['create-default'])) {
|
||||
);
|
||||
$default_rules[] = array(
|
||||
'device_id' => '-1',
|
||||
'rule' => '%sensors.sensor_current < %sensors.sensor_limit_low',
|
||||
'rule' => '%sensors.sensor_current < %sensors.sensor_limit_low && %sensors.sensor_alert = "1"',
|
||||
'severity' => 'critical',
|
||||
'extra' => '{"mute":false,"count":"-1","delay":"300"}',
|
||||
'disabled' => 0,
|
||||
|
||||
@@ -338,10 +338,10 @@ echo '</td></tr>';
|
||||
|
||||
// If we're showing graphs, generate the graph and print the img tags
|
||||
if ($graph_type == 'etherlike') {
|
||||
$graph_file = $config['rrd_dir'].'/'.$device['hostname'].'/port-'.safename($port['ifIndex']).'-dot3.rrd';
|
||||
$graph_file = get_port_rrdfile_path ($device['hostname'], $if_id, 'dot3');
|
||||
}
|
||||
else {
|
||||
$graph_file = $config['rrd_dir'].'/'.$device['hostname'].'/port-'.safename($port['ifIndex']).'.rrd';
|
||||
$graph_file = get_port_rrdfile_path ($device['hostname'], $if_id);
|
||||
}
|
||||
|
||||
if ($graph_type && is_file($graph_file)) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
echo '<table class="table table-condensed table-striped table-hover">';
|
||||
$stp_raw = dbFetchRow('SELECT * FROM `stp` WHERE `device_id` = ?', array($device['device_id']));
|
||||
$stp = array (
|
||||
'Root bridge' => ($stp_raw['rootBridge'] == 1) ? 'Yes' : 'No',
|
||||
@@ -22,8 +23,9 @@ $stp = array (
|
||||
foreach (array_keys($stp) as $key) {
|
||||
echo "
|
||||
<tr>
|
||||
<td width=280 class=list-large>$key</td>
|
||||
<td class=box-desc>$stp[$key]</td>
|
||||
<td>$key</td>
|
||||
<td>$stp[$key]</td>
|
||||
</tr>
|
||||
";
|
||||
}
|
||||
echo '</table>';
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
$device_id = mres($_POST['device_id']);
|
||||
|
||||
$param[] = $device_id;
|
||||
|
||||
$sql = " FROM `ports_stp` `ps` JOIN `ports` `p` ON `ps`.`port_id`=`p`.`port_id` WHERE `ps`.`device_id` = ?";
|
||||
|
||||
$count_sql = "SELECT COUNT(*) $sql";
|
||||
$total = dbFetchCell($count_sql, $param);
|
||||
if (empty($total)) {
|
||||
$total = 0;
|
||||
}
|
||||
|
||||
if (!isset($sort) || empty($sort)) {
|
||||
$sort = 'port_id DESC';
|
||||
}
|
||||
|
||||
$sql .= " ORDER BY ps.$sort";
|
||||
|
||||
if (isset($current)) {
|
||||
$limit_low = (($current * $rowCount) - ($rowCount));
|
||||
$limit_high = $rowCount;
|
||||
}
|
||||
|
||||
if ($rowCount != -1) {
|
||||
$sql .= " LIMIT $limit_low,$limit_high";
|
||||
}
|
||||
|
||||
$sql = "SELECT `ps`.*, `p`.* $sql";
|
||||
|
||||
foreach (dbFetchRows($sql, array($device_id)) as $stp_ports_db) {
|
||||
|
||||
$bridge_device = dbFetchRow("SELECT `devices`.*, `stp`.`device_id`, `stp`.`bridgeAddress` FROM `devices` JOIN `stp` ON `devices`.`device_id`=`stp`.`device_id` WHERE `stp`.`bridgeAddress` = ?", array($stp_ports_db['designatedBridge']));
|
||||
$root_device = dbFetchRow("SELECT `devices`.*, `stp`.`device_id`, `stp`.`bridgeAddress` FROM `devices` JOIN `stp` ON `devices`.`device_id`=`stp`.`device_id` WHERE `stp`.`bridgeAddress` = ?", array($stp_ports_db['designatedRoot']));
|
||||
|
||||
$response[] = array (
|
||||
'port_id' => generate_port_link($stp_ports_db, $stp_ports_db['ifName'])."<br>".$stp_ports_db['ifAlias'],
|
||||
'priority' => $stp_ports_db['priority'],
|
||||
'state' => $stp_ports_db['state'],
|
||||
'enable' => $stp_ports_db['enable'],
|
||||
'pathCost' => $stp_ports_db['pathCost'],
|
||||
'designatedRoot' => generate_device_link($root_device, $root_device['hostname'])."<br>".$stp_ports_db['designatedRoot'],
|
||||
'designatedCost' => $stp_ports_db['designatedCost'],
|
||||
'designatedBridge' => generate_device_link($bridge_device, $bridge_device['hostname'])."<br>".$stp_ports_db['designatedBridge'],
|
||||
'designatedPort' => $stp_ports_db['designatedPort'],
|
||||
'forwardTransitions' => $stp_ports_db['forwardTransitions']
|
||||
);
|
||||
}
|
||||
|
||||
$output = array(
|
||||
'current' => $current,
|
||||
'rowCount' => $rowCount,
|
||||
'rows' => $response,
|
||||
'total' => $total,
|
||||
);
|
||||
echo _json_encode($output);
|
||||
@@ -65,7 +65,8 @@ if ($_POST['hostname']) {
|
||||
$force_add = 0;
|
||||
}
|
||||
|
||||
$result = addHost($hostname, $snmpver, $port, $transport, 0, $poller_group, $force_add);
|
||||
$port_assoc_mode = $_POST['port_assoc_mode'];
|
||||
$result = addHost($hostname, $snmpver, $port, $transport, 0, $poller_group, $force_add, $port_assoc_mode);
|
||||
if ($result) {
|
||||
print_message("Device added ($result)");
|
||||
}
|
||||
@@ -120,6 +121,24 @@ foreach ($config['snmp']['transports'] as $transport) {
|
||||
|
||||
echo '>'.$transport.'</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="port_association_mode" class="col-sm-3 control-label">Port Association Mode</label>
|
||||
<div class="col-sm-3">
|
||||
<select name="port_assoc_mode" id="port_assoc_mode" class="form-control input-sm">
|
||||
<?php
|
||||
|
||||
|
||||
foreach (get_port_assoc_modes() as $mode) {
|
||||
$selected = "";
|
||||
if ($mode == $config['default_port_association_mode'])
|
||||
$selected = "selected";
|
||||
|
||||
echo " <option value=\"$mode\" $selected>$mode</option>\n";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@@ -13,7 +13,14 @@ else {
|
||||
}
|
||||
|
||||
foreach (dbFetchRows('SELECT * FROM `services` AS S, `devices` AS D WHERE S.device_id = D.device_id ORDER BY hostname') as $device) {
|
||||
$servicesform .= "<option value='".$device['service_id']."'>".$device['service_id'].'.'.$device['hostname'].' - '.$device['service_type'].'</option>';
|
||||
$service_description = '';
|
||||
|
||||
if (!empty($device['service_desc'])) {
|
||||
$service_description = ' - ' . substr($device['service_desc'], 0, 30);
|
||||
}
|
||||
|
||||
$servicesform .= "<option value='".$device['service_id']."'>".$device['hostname'].' - '.$device['service_type'].$service_description.'</option>';
|
||||
|
||||
}
|
||||
|
||||
if ($updated) {
|
||||
@@ -26,7 +33,7 @@ else {
|
||||
<input type=hidden name='delsrv' value='yes'>
|
||||
<div class='well well-lg'>
|
||||
<div class='form-group'>
|
||||
<label for='service' class='col-sm-2 control-label'>Device - Service</label>
|
||||
<label for='service' class='col-sm-2 control-label'>Device - Service - Description</label>
|
||||
<div class='col-sm-5'>
|
||||
<select name='service' id='service' class='form-control input-sm'>
|
||||
$servicesform
|
||||
|
||||
@@ -9,6 +9,7 @@ if ($_POST['editing']) {
|
||||
$timeout = mres($_POST['timeout']);
|
||||
$retries = mres($_POST['retries']);
|
||||
$poller_group = mres($_POST['poller_group']);
|
||||
$port_assoc_mode = mres($_POST['port_assoc_mode']);
|
||||
$v3 = array(
|
||||
'authlevel' => mres($_POST['authlevel']),
|
||||
'authname' => mres($_POST['authname']),
|
||||
@@ -25,6 +26,7 @@ if ($_POST['editing']) {
|
||||
'port' => $port,
|
||||
'transport' => $transport,
|
||||
'poller_group' => $poller_group,
|
||||
'port_association_mode' => $port_assoc_mode,
|
||||
);
|
||||
|
||||
if ($_POST['timeout']) {
|
||||
@@ -43,7 +45,7 @@ if ($_POST['editing']) {
|
||||
|
||||
$update = array_merge($update, $v3);
|
||||
|
||||
$device_tmp = deviceArray($device['hostname'], $community, $snmpver, $port, $transport, $v3);
|
||||
$device_tmp = deviceArray($device['hostname'], $community, $snmpver, $port, $transport, $v3, $port_assoc_mode);
|
||||
if (isSNMPable($device_tmp)) {
|
||||
$rows_updated = dbUpdate($update, 'devices', '`device_id` = ?', array($device['device_id']));
|
||||
|
||||
@@ -116,6 +118,25 @@ echo " </select>
|
||||
<input id='retries' name='retries' class='form-control input-sm' value='".($device['timeout'] ? $device['retries'] : '')."' placeholder='retries' />
|
||||
</div>
|
||||
</div>
|
||||
<div class='form-group'>
|
||||
<label for='port_assoc_mode' class='col-sm-2 control-label'>Port Association Mode</label>
|
||||
<div class='col-sm-1'>
|
||||
<select name='port_assoc_mode' id='port_assoc_mode' class='form-control input-sm'>
|
||||
";
|
||||
|
||||
foreach (get_port_assoc_modes() as $pam) {
|
||||
$pam_id = get_port_assoc_mode_id ($pam);
|
||||
echo " <option value='$pam_id'";
|
||||
|
||||
if ($pam_id == $device['port_association_mode'])
|
||||
echo " selected='selected'";
|
||||
|
||||
echo ">$pam</option>\n";
|
||||
}
|
||||
|
||||
echo " </select>
|
||||
</div>
|
||||
</div>
|
||||
<div id='snmpv1_2'>
|
||||
<div class='form-group'>
|
||||
<label class='col-sm-3 control-label text-left'><h4><strong>SNMPv1/v2c Configuration</strong></h4></label>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
$sensors = dbFetchRows('SELECT * FROM `sensors` WHERE `sensor_class` = ? AND device_id = ? ORDER BY `poller_type`, `sensor_index`', array($sensor_class, $device['device_id']));
|
||||
$sensors = dbFetchRows('SELECT * FROM `sensors` WHERE `sensor_class` = ? AND device_id = ? ORDER BY `poller_type`, `sensor_oid`, `sensor_index`', array($sensor_class, $device['device_id']));
|
||||
|
||||
if (count($sensors)) {
|
||||
echo '<div class="container-fluid ">
|
||||
|
||||
@@ -87,6 +87,12 @@ if (dbFetchCell("SELECT COUNT(*) FROM `ports_vlans` WHERE `port_id` = '".$port['
|
||||
$menu_options['vlans'] = 'VLANs';
|
||||
}
|
||||
|
||||
// Are there any CBQoS rrd's for this ifIndex?
|
||||
$cbqos = glob($config['rrd_dir'].'/'.$device['hostname'].'/port-'.$port['ifIndex'].'-cbqos-*.rrd');
|
||||
if (!empty($cbqos)) {
|
||||
$menu_options['cbqos'] = 'CBQoS';
|
||||
}
|
||||
|
||||
$sep = '';
|
||||
foreach ($menu_options as $option => $text) {
|
||||
echo $sep;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
if (file_exists($config['rrd_dir'].'/'.$device['hostname'].'/port-'.$port['ifIndex'].'-adsl.rrd')) {
|
||||
if (file_exists(get_port_rrdfile_path ($device['hostname'], $port['port_id'], 'adsl'))) {
|
||||
$iid = $id;
|
||||
echo '<div class=graphhead>ADSL Line Speed</div>';
|
||||
$graph_type = 'port_adsl_speed';
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS module to display Cisco Class-Based QoS Details
|
||||
*
|
||||
* Copyright (c) 2015 Aaron Daniels <aaron@daniels.id.au>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
function find_child($components,$parent,$level) {
|
||||
global $vars;
|
||||
|
||||
foreach($components as $id => $array) {
|
||||
if ($array['qos-type'] == 3) {
|
||||
continue;
|
||||
}
|
||||
if (($array['parent'] == $components[$parent]['sp-obj']) && ($array['sp-id'] == $components[$parent]['sp-id'])) {
|
||||
echo "<ul>";
|
||||
echo "<li>";
|
||||
if ($array['qos-type'] == 1) {
|
||||
// Its a policy, we need to make it a link.
|
||||
echo('<a href="' . generate_url($vars, array('policy' => $id)) . '">' . $array['label'] . '</a>');
|
||||
}
|
||||
else {
|
||||
// No policy, no link
|
||||
echo $array['label'];
|
||||
}
|
||||
if (isset($array['match'])) {
|
||||
echo ' ('.$array['match'].')';
|
||||
}
|
||||
|
||||
find_child($components,$id,$level+1);
|
||||
|
||||
echo "</li>";
|
||||
echo "</ul>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$rrdarr = glob($config['rrd_dir'].'/'.$device['hostname'].'/port-'.$port['ifIndex'].'-cbqos-*.rrd');
|
||||
if (!empty($rrdarr)) {
|
||||
require_once "../includes/component.php";
|
||||
$component = new component();
|
||||
$options['filter']['type'] = array('=','Cisco-CBQOS');
|
||||
$components = $component->getComponents($device['device_id'],$options);
|
||||
|
||||
// We only care about our device id.
|
||||
$components = $components[$device['device_id']];
|
||||
|
||||
if (!isset($vars['policy'])) {
|
||||
// not set, find the first parent and use it.
|
||||
foreach ($components as $id => $array) {
|
||||
if ( ($array['qos-type'] == 1) && ($array['ifindex'] == $port['ifIndex']) && ($array['parent'] == 0) ) {
|
||||
// Found the first policy
|
||||
$vars['policy'] = $id;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
echo "\n\n";
|
||||
|
||||
// Display the ingress policy at the top of the page.
|
||||
echo "<div class='col-md-6'><ul class='mktree' id='ingress'>";
|
||||
echo '<div><strong><i class="fa fa-sign-in"></i> Ingress Policy:</strong></div>';
|
||||
$found = false;
|
||||
foreach ($components as $id => $array) {
|
||||
if ( ($array['qos-type'] == 1) && ($array['ifindex'] == $port['ifIndex']) && ($array['direction'] == 1) && ($array['parent'] == 0) ) {
|
||||
echo "<li class='liOpen'>";
|
||||
echo('<a href="' . generate_url($vars, array('policy' => $id)) . '">' . $array['label'] . '</a>');
|
||||
find_child($components,$id,1);
|
||||
echo "</li>";
|
||||
$found = true;
|
||||
}
|
||||
}
|
||||
if (!$found) {
|
||||
// No Ingress policies
|
||||
echo '<div><i>No Policies</i></div>';
|
||||
}
|
||||
echo '</ul></div>';
|
||||
|
||||
// Display the egress policy at the top of the page.
|
||||
echo "<div class='col-md-6'><ul class='mktree' id='egress'>";
|
||||
echo '<div><strong><i class="fa fa-sign-out"></i> Egress Policy:</strong></div>';
|
||||
$found = false;
|
||||
foreach ($components as $id => $array) {
|
||||
if ( ($array['qos-type'] == 1) && ($array['ifindex'] == $port['ifIndex']) && ($array['direction'] == 2) && ($array['parent'] == 0) ) {
|
||||
echo "<li class='liOpen'>";
|
||||
echo('<a href="' . generate_url($vars, array('policy' => $id)) . '">' . $array['label'] . '</a>');
|
||||
find_child($components,$id,1);
|
||||
echo "</li>";
|
||||
$found = true;
|
||||
}
|
||||
}
|
||||
if (!$found) {
|
||||
// No Egress policies
|
||||
echo '<div><i>No Policies</i></div>';
|
||||
}
|
||||
echo "</ul></div>\n\n";
|
||||
|
||||
// Let's make sure the policy we are trying to access actually exists.
|
||||
foreach ($components as $id => $array) {
|
||||
if ( ($array['qos-type'] == 1) && ($array['ifindex'] == $port['ifIndex']) && ($id == $vars['policy']) ) {
|
||||
// The policy exists.
|
||||
|
||||
echo "<div class='col-md-12'> </div>\n\n";
|
||||
|
||||
// Display each graph row.
|
||||
echo "<div class='col-md-12'>";
|
||||
echo "<div class='graphhead'>Traffic by CBQoS Class - ".$components[$vars['policy']]['label']."</div>";
|
||||
$graph_array['policy'] = $vars['policy'];
|
||||
$graph_type = 'port_cbqos_traffic';
|
||||
include 'includes/print-interface-graphs.inc.php';
|
||||
|
||||
echo "<div class='graphhead'>QoS Drops by CBQoS Class - ".$components[$vars['policy']]['label']."</div>";
|
||||
$graph_array['policy'] = $vars['policy'];
|
||||
$graph_type = 'port_cbqos_bufferdrops';
|
||||
include 'includes/print-interface-graphs.inc.php';
|
||||
|
||||
echo "<div class='graphhead'>Buffer Drops by CBQoS Class - ".$components[$vars['policy']]['label']."</div>";
|
||||
$graph_array['policy'] = $vars['policy'];
|
||||
$graph_type = 'port_cbqos_qosdrops';
|
||||
include 'includes/print-interface-graphs.inc.php';
|
||||
echo "</div>\n\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
if (file_exists($config['rrd_dir'].'/'.$device['hostname'].'/port-'.$port['ifIndex'].'.rrd')) {
|
||||
if (file_exists(get_port_rrdfile_path ($device['hostname'], $port['port_id']))) {
|
||||
$iid = $id;
|
||||
echo '<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
@@ -41,7 +41,7 @@ if (file_exists($config['rrd_dir'].'/'.$device['hostname'].'/port-'.$port['ifInd
|
||||
include 'includes/print-interface-graphs.inc.php';
|
||||
echo '</div></div>';
|
||||
|
||||
if (is_file($config['rrd_dir'].'/'.$device['hostname'].'/port-'.$port['ifIndex'].'-dot3.rrd')) {
|
||||
if (is_file(get_port_rrdfile_path ($device['hostname'], $port['port_id'], 'dot3'))) {
|
||||
echo '<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Ethernet Errors</h3>
|
||||
|
||||
@@ -15,7 +15,7 @@ if (!$vars['view']) {
|
||||
}
|
||||
|
||||
$menu_options['basic'] = 'Basic';
|
||||
// $menu_options['details'] = 'Details';
|
||||
$menu_options['ports'] = 'Ports';
|
||||
$sep = '';
|
||||
foreach ($menu_options as $option => $text) {
|
||||
echo $sep;
|
||||
@@ -35,16 +35,13 @@ unset($sep);
|
||||
|
||||
print_optionbar_end();
|
||||
|
||||
echo '<table border="0" cellspacing="0" cellpadding="5" width="100%">';
|
||||
|
||||
$i = '1';
|
||||
|
||||
foreach (dbFetchRows("SELECT * FROM `stp` WHERE `device_id` = ? ORDER BY 'stp_id'", array($device['device_id'])) as $stp) {
|
||||
if ($vars['view'] == 'basic') {
|
||||
include 'includes/print-stp.inc.php';
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
echo '</table>';
|
||||
if ($vars['view'] == 'ports') {
|
||||
include 'includes/common/stp-ports.inc.php';
|
||||
echo implode('',$common_output);
|
||||
}
|
||||
|
||||
$pagetitle[] = 'STP';
|
||||
|
||||
@@ -13,7 +13,13 @@ else {
|
||||
}
|
||||
|
||||
foreach (dbFetchRows('SELECT * FROM `services` AS S, `devices` AS D WHERE S.device_id = D.device_id ORDER BY hostname') as $device) {
|
||||
$servicesform .= "<option value='".$device['service_id']."'>".$device['hostname'].' - '.$device['service_type'].'</option>';
|
||||
$service_description = '';
|
||||
|
||||
if (!empty($device['service_desc'])) {
|
||||
$service_description = ' - ' . substr($device['service_desc'], 0, 30);
|
||||
}
|
||||
|
||||
$servicesform .= "<option value='".$device['service_id']."'>".$device['hostname'].' - '.$device['service_type'].$service_description.'</option>';
|
||||
}
|
||||
|
||||
if ($updated) {
|
||||
@@ -30,7 +36,7 @@ else {
|
||||
<input type=hidden name='delsrv' value='yes'>
|
||||
<div class='well well-lg'>
|
||||
<div class='form-group'>
|
||||
<label for='service' class='col-sm-2 control-label'>Device - Service</label>
|
||||
<label for='service' class='col-sm-2 control-label'>Device - Service - Description</label>
|
||||
<div class='col-sm-5'>
|
||||
<select name='service' id='service' class='form-control input-sm'>
|
||||
$servicesform
|
||||
|
||||
@@ -94,7 +94,7 @@ if ($if_list) {
|
||||
|
||||
echo '<br />';
|
||||
|
||||
if (file_exists($config['rrd_dir'].'/'.$port['hostname'].'/port-'.$port['ifIndex'].'.rrd')) {
|
||||
if (file_exists(get_port_rrdfile_path ($port['hostname'], $port['port_id']))) {
|
||||
$graph_type = 'port_bits';
|
||||
|
||||
include 'includes/print-interface-graphs.inc.php';
|
||||
|
||||
+180
-3
@@ -33,9 +33,25 @@ function format_number_short($number, $sf) {
|
||||
}
|
||||
|
||||
function external_exec($command) {
|
||||
d_echo($command."\n");
|
||||
global $debug,$vdebug;
|
||||
if ($debug && !$vdebug) {
|
||||
$debug_command = preg_replace('/-c [\S]+/','-c COMMUNITY',$command);
|
||||
$debug_command = preg_replace('/(udp|udp6|tcp|tcp6):(.*):([\d]+)/','\1:HOSTNAME:\3',$debug_command);
|
||||
d_echo($debug_command);
|
||||
}
|
||||
elseif ($vdebug) {
|
||||
d_echo($command."\n");
|
||||
}
|
||||
|
||||
$output = shell_exec($command);
|
||||
d_echo($output."\n");
|
||||
|
||||
if ($debug && !$vdebug) {
|
||||
$debug_output = preg_replace('/(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/', '*', $output);
|
||||
d_echo("$debug_output\n");
|
||||
}
|
||||
elseif ($vdebug) {
|
||||
d_echo($output."\n");
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
@@ -98,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) {
|
||||
@@ -127,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;
|
||||
|
||||
@@ -1077,3 +1102,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;
|
||||
}
|
||||
|
||||
@@ -710,6 +710,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
|
||||
@@ -742,6 +743,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;
|
||||
@@ -853,3 +855,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';
|
||||
|
||||
@@ -1178,6 +1178,14 @@ $config['os'][$os]['type'] = 'printer';
|
||||
$config['os'][$os]['over'][0]['graph'] = 'device_toner';
|
||||
$config['os'][$os]['over'][0]['text'] = 'Toner';
|
||||
|
||||
$os ='lexmarkprinter';
|
||||
$config['os'][$os]['group'] = 'printer';
|
||||
$config['os'][$os]['text'] = 'Lexmark Printer';
|
||||
$config['os'][$os]['type'] = 'printer';
|
||||
$config['os'][$os]['icon'] = 'lexmark';
|
||||
$config['os'][$os]['over'][0]['graph'] = 'device_toner';
|
||||
$config['os'][$os]['over'][0]['text'] = 'Toner';
|
||||
|
||||
$os = '3com';
|
||||
$config['os'][$os]['text'] = '3Com';
|
||||
$config['os'][$os]['over'][0]['graph'] = 'device_bits';
|
||||
@@ -1428,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';
|
||||
|
||||
@@ -0,0 +1,184 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS module to capture Cisco Class-Based QoS Details
|
||||
*
|
||||
* Copyright (c) 2015 Aaron Daniels <aaron@daniels.id.au>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
if ($device['os_group'] == 'cisco') {
|
||||
|
||||
$module = 'Cisco-CBQOS';
|
||||
echo $module.': ';
|
||||
|
||||
require_once 'includes/component.php';
|
||||
$component = new component();
|
||||
$components = $component->getComponents($device['device_id'],array('type'=>$module));
|
||||
|
||||
// We only care about our device id.
|
||||
$components = $components[$device['device_id']];
|
||||
|
||||
|
||||
// Begin our master array, all other values will be processed into this array.
|
||||
$tblCBQOS = array();
|
||||
|
||||
// Let's gather some data..
|
||||
$tblcbQosServicePolicy = snmpwalk_array_num($device, '.1.3.6.1.4.1.9.9.166.1.1');
|
||||
$tblcbQosObjects = snmpwalk_array_num($device, '.1.3.6.1.4.1.9.9.166.1.5', 2);
|
||||
$tblcbQosPolicyMapCfg = snmpwalk_array_num($device, '.1.3.6.1.4.1.9.9.166.1.6');
|
||||
$tblcbQosClassMapCfg = snmpwalk_array_num($device, '.1.3.6.1.4.1.9.9.166.1.7');
|
||||
$tblcbQosMatchStmtCfg = snmpwalk_array_num($device, '.1.3.6.1.4.1.9.9.166.1.8');
|
||||
|
||||
/*
|
||||
* False == no object found - this is not an error, there is no QOS configured
|
||||
* null == timeout or something else that caused an error, there may be QOS configured but we couldn't get it.
|
||||
*/
|
||||
if ( is_null($tblcbQosServicePolicy) || is_null($tblcbQosObjects) || is_null($tblcbQosPolicyMapCfg) || is_null($tblcbQosClassMapCfg) || is_null($tblcbQosMatchStmtCfg) ) {
|
||||
// We have to error here or we will end up deleting all our QoS components.
|
||||
echo "Error\n";
|
||||
}
|
||||
else {
|
||||
// No Error, lets process things.
|
||||
d_echo("QoS Objects Found:\n");
|
||||
|
||||
foreach ($tblcbQosObjects['1.3.6.1.4.1.9.9.166.1.5.1.1.2'] as $spid => $array) {
|
||||
|
||||
foreach ($array as $spobj => $index) {
|
||||
$result = array();
|
||||
|
||||
// Produce a unique reproducible index for this entry.
|
||||
$result['UID'] = hash('crc32', $spid."-".$spobj);
|
||||
|
||||
// Now that we have a valid identifiers, lets add some more data
|
||||
$result['sp-id'] = $spid;
|
||||
$result['sp-obj'] = $spobj;
|
||||
|
||||
// Add the Type, Policy-map, Class-map, etc.
|
||||
$type = $tblcbQosObjects['1.3.6.1.4.1.9.9.166.1.5.1.1.3'][$spid][$spobj];
|
||||
$result['qos-type'] = $type;
|
||||
|
||||
// Add the Parent, this lets us work out our hierarchy for display later.
|
||||
$result['parent'] = $tblcbQosObjects['1.3.6.1.4.1.9.9.166.1.5.1.1.4'][$spid][$spobj];
|
||||
$result['direction'] = $tblcbQosServicePolicy['1.3.6.1.4.1.9.9.166.1.1.1.1.3'][$spid];
|
||||
$result['ifindex'] = $tblcbQosServicePolicy['1.3.6.1.4.1.9.9.166.1.1.1.1.4'][$spid];
|
||||
|
||||
// Gather different data depending on the type.
|
||||
switch ($type) {
|
||||
case 1:
|
||||
// Policy-map, get data from that table.
|
||||
d_echo("\nIndex: ".$index."\n");
|
||||
d_echo(" UID: ".$result['UID']."\n");
|
||||
d_echo(" SPID.SPOBJ: ".$result['sp-id'].".".$result['sp-obj']."\n");
|
||||
d_echo(" If-Index: ".$result['ifindex']."\n");
|
||||
d_echo(" Type: 1 - Policy-Map\n");
|
||||
$result['label'] = $tblcbQosPolicyMapCfg['1.3.6.1.4.1.9.9.166.1.6.1.1.1'][$index];
|
||||
if ($tblcbQosPolicyMapCfg['1.3.6.1.4.1.9.9.166.1.6.1.1.2'][$index] != "") {
|
||||
$result['label'] .= " - ".$tblcbQosPolicyMapCfg['1.3.6.1.4.1.9.9.166.1.6.1.1.2'][$index];
|
||||
}
|
||||
d_echo(" Label: ".$result['label']."\n");
|
||||
break;
|
||||
case 2:
|
||||
// Class-map, get data from that table.
|
||||
d_echo("\nIndex: ".$index."\n");
|
||||
d_echo(" UID: ".$result['UID']."\n");
|
||||
d_echo(" SPID.SPOBJ: ".$result['sp-id'].".".$result['sp-obj']."\n");
|
||||
d_echo(" If-Index: ".$result['ifindex']."\n");
|
||||
d_echo(" Type: 2 - Class-Map\n");
|
||||
$result['label'] = $tblcbQosClassMapCfg['1.3.6.1.4.1.9.9.166.1.7.1.1.1'][$index];
|
||||
if($tblcbQosClassMapCfg['1.3.6.1.4.1.9.9.166.1.7.1.1.2'][$index] != "") {
|
||||
$result['label'] .= " - ".$tblcbQosClassMapCfg['1.3.6.1.4.1.9.9.166.1.7.1.1.2'][$index];
|
||||
}
|
||||
d_echo(" Label: ".$result['label']."\n");
|
||||
if ($tblcbQosClassMapCfg['1.3.6.1.4.1.9.9.166.1.7.1.1.3'][$index] == 2) {
|
||||
$result['map-type'] = 'Match-All';
|
||||
}
|
||||
elseif ($tblcbQosClassMapCfg['1.3.6.1.4.1.9.9.166.1.7.1.1.3'][$index] == 3) {
|
||||
$result['map-type'] = 'Match-Any';
|
||||
}
|
||||
else {
|
||||
$result['map-type'] = 'None';
|
||||
}
|
||||
|
||||
// Find a child, this will be a type 3
|
||||
foreach ($tblcbQosObjects['1.3.6.1.4.1.9.9.166.1.5.1.1.4'][$spid] as $id => $value) {
|
||||
if ($value == $result['sp-obj']) {
|
||||
// We have our child, import the match
|
||||
if ($tblcbQosObjects['1.3.6.1.4.1.9.9.166.1.5.1.1.3'][$spid][$id] == 3) {
|
||||
$result['match'] = $result['map-type'].": ".$tblcbQosMatchStmtCfg['1.3.6.1.4.1.9.9.166.1.8.1.1.1'][$tblcbQosObjects['1.3.6.1.4.1.9.9.166.1.5.1.1.2'][$spid][$id]];
|
||||
d_echo(" Match: ".$result['match']."\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
continue 2;
|
||||
}
|
||||
|
||||
$tblCBQOS[] = $result;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Ok, we have our 2 array's (Components and SNMP) now we need
|
||||
* to compare and see what needs to be added/updated.
|
||||
*
|
||||
* Let's loop over the SNMP data to see if we need to ADD or UPDATE any components.
|
||||
*/
|
||||
foreach ($tblCBQOS as $key => $array) {
|
||||
$component_key = false;
|
||||
|
||||
// Loop over our components to determine if the component exists, or we need to add it.
|
||||
foreach ($components as $compid => $child) {
|
||||
if ($child['UID'] === $array['UID']) {
|
||||
$component_key = $compid;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$component_key) {
|
||||
// The component doesn't exist, we need to ADD it - ADD.
|
||||
$new_component = $component->createComponent($device['device_id'],$module);
|
||||
$component_key = key($new_component);
|
||||
$components[$component_key] = array_merge($new_component[$component_key], $array);
|
||||
echo "+";
|
||||
}
|
||||
else {
|
||||
// The component does exist, merge the details in - UPDATE.
|
||||
$components[$component_key] = array_merge($components[$component_key], $array);
|
||||
echo ".";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Loop over the Component data to see if we need to DELETE any components.
|
||||
*/
|
||||
foreach ($components as $key => $array) {
|
||||
// Guilty until proven innocent
|
||||
$found = false;
|
||||
|
||||
foreach ($tblCBQOS as $k => $v) {
|
||||
if ($array['UID'] == $v['UID']) {
|
||||
// Yay, we found it...
|
||||
$found = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($found === false) {
|
||||
// The component has not been found. we should delete it.
|
||||
echo "-";
|
||||
$component->deleteComponent($key);
|
||||
}
|
||||
}
|
||||
|
||||
// Write the Components back to the DB.
|
||||
$component->setComponentPrefs($device['device_id'],$components);
|
||||
echo "\n";
|
||||
|
||||
} // End if not error
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS
|
||||
*
|
||||
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
if (!$os) {
|
||||
if (strstr($sysObjectId, '.1.3.6.1.4.1.534.6.6.7')) {
|
||||
$os = 'eatonpdu';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
if (!$os) {
|
||||
if (strstr($sysDescr, 'Lexmark ')) {
|
||||
$os = 'lexmarkprinter';
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS
|
||||
*
|
||||
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
if ($device['os'] == 'eatonpdu') {
|
||||
$data = snmpwalk_cache_multi_oid($device, 'outletCurrent', array(), 'EATON-EPDU-MIB');
|
||||
$descr = snmpwalk_cache_multi_oid($device, 'outletName', array(), 'EATON-EPDU-MIB');
|
||||
if (is_array($data)) {
|
||||
$cur_oid = '.1.3.6.1.4.1.534.6.6.7.6.4.1.3.';
|
||||
foreach ($data as $index => $entry) {
|
||||
$i++;
|
||||
discover_sensor($valid['sensor'], 'current', $device, $cur_oid.$index, $i, 'eatonpdu', $descr[$index]['outletName'], '1000', '1', null, null, null, null, $data[$index]['outletCurrent'], 'snmp', $index);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,8 +15,10 @@ if ($device['os_group'] == 'cisco') {
|
||||
if (is_array($temp)) {
|
||||
$cur_oid = '.1.3.6.1.4.1.9.9.13.1.3.1.3.';
|
||||
foreach ($temp as $index => $entry) {
|
||||
$descr = ucwords($temp[$index]['ciscoEnvMonTemperatureStatusDescr']);
|
||||
discover_sensor($valid['sensor'], 'temperature', $device, $cur_oid.$index, $index, 'cisco', $descr, '1', '1', null, null, $temp[$index]['ciscoEnvMonTemperatureThreshold'], null, $temp[$index]['ciscoEnvMonTemperatureStatusValue'], 'snmp', $index);
|
||||
if ($temp[$index]['ciscoEnvMonTemperatureState'] != 'notPresent') {
|
||||
$descr = ucwords($temp[$index]['ciscoEnvMonTemperatureStatusDescr']);
|
||||
discover_sensor($valid['sensor'], 'temperature', $device, $cur_oid.$index, $index, 'cisco', $descr, '1', '1', null, null, $temp[$index]['ciscoEnvMonTemperatureThreshold'], null, $temp[$index]['ciscoEnvMonTemperatureStatusValue'], 'snmp', $index);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,7 +112,72 @@ if ($stpprotocol == 'ieee8021d' || $stpprotocol == 'unknown') {
|
||||
log_event('STP removed', $device, 'stp');
|
||||
echo '-';
|
||||
}
|
||||
|
||||
// STP port related stuff
|
||||
foreach ($stp_raw as $port => $value){
|
||||
if ($port) { // $stp_raw[0] ist not port related so we skip this one
|
||||
$stp_port = array(
|
||||
'priority' => $stp_raw[$port]['dot1dStpPortPriority'],
|
||||
'state' => $stp_raw[$port]['dot1dStpPortState'],
|
||||
'enable' => $stp_raw[$port]['dot1dStpPortEnable'],
|
||||
'pathCost' => $stp_raw[$port]['dot1dStpPortPathCost'],
|
||||
'designatedCost' => $stp_raw[$port]['dot1dStpPortDesignatedCost'],
|
||||
'designatedPort' => $stp_raw[$port]['dot1dStpPortDesignatedPort'],
|
||||
'forwardTransitions' => $stp_raw[$port]['dot1dStpPortForwardTransitions']
|
||||
);
|
||||
|
||||
// set device binding
|
||||
$stp_port['device_id'] = $device['device_id'];
|
||||
|
||||
// set port binding
|
||||
$stp_port['port_id'] = dbFetchCell('SELECT port_id FROM `ports` WHERE `device_id` = ? AND `ifIndex` = ?', array($device['device_id'], $stp_raw[$port]['dot1dStpPort']));
|
||||
|
||||
$dr = str_replace(array(' ', ':', '-'), '', strtolower($stp_raw[$port]['dot1dStpPortDesignatedRoot']));
|
||||
$dr = substr($dr, -12); //remove first two octets
|
||||
$stp_port['designatedRoot'] = $dr;
|
||||
|
||||
$db = str_replace(array(' ', ':', '-'), '', strtolower($stp_raw[$port]['dot1dStpPortDesignatedBridge']));
|
||||
$db = substr($db, -12); //remove first two octets
|
||||
$stp_port['designatedBridge'] = $db;
|
||||
|
||||
if ($device['os'] == 'pbn') {
|
||||
// It seems that PBN guys don't care about ieee 802.1d :-(
|
||||
// So try to find the right port with some crazy conversations
|
||||
$dp_value = dechex($stp_port['priority']);
|
||||
$dp_value = $dp_value.'00';
|
||||
$dp_value = hexdec($dp_value);
|
||||
if ($stp_raw[$port]['dot1dStpPortDesignatedPort']) {
|
||||
$dp = $stp_raw[$port]['dot1dStpPortDesignatedPort'] - $dp_value;
|
||||
$stp_port['designatedPort'] = $dp;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Port saved in format priority+port (ieee 802.1d-1998: clause 8.5.5.1)
|
||||
$dp = substr($stp_raw[$port]['dot1dStpPortDesignatedPort'], -2); //discard the first octet (priority part)
|
||||
$stp_port['designatedPort'] = hexdec($dp);
|
||||
}
|
||||
|
||||
d_echo($stp_port);
|
||||
|
||||
// Write to db
|
||||
if (!dbFetchCell('SELECT 1 FROM `ports_stp` WHERE `device_id` = ? AND `port_id` = ?', array($device['device_id'], $stp_port['port_id']))) {
|
||||
dbInsert($stp_port,'ports_stp');
|
||||
echo '+';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Delete STP ports from db if absent in SNMP query
|
||||
$stp_port_db = dbFetchRows('SELECT * FROM `ports_stp` WHERE `device_id` = ?', array($device['device_id']));
|
||||
//d_echo($stp_port_db);
|
||||
foreach($stp_port_db as $port => $value){
|
||||
$if_index = dbFetchCell('SELECT `ifIndex` FROM `ports` WHERE `device_id` = ? AND `port_id` = ?', array($device['device_id'], $value['port_id']));
|
||||
if ($if_index != $stp_raw[$if_index]['dot1dStpPort']){
|
||||
dbDelete('ports_stp', '`device_id` = ? AND `port_id` = ?', array($device['device_id'], $value['port_id']));
|
||||
echo '-';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unset($stp_raw, $stp, $stp_db);
|
||||
unset($stp_raw, $stp, $stp_db, $stp_port, $stp_port_db);
|
||||
echo "\n";
|
||||
|
||||
+25
-10
@@ -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);
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS module to capture Cisco Class-Based QoS Details
|
||||
*
|
||||
* Copyright (c) 2015 Aaron Daniels <aaron@daniels.id.au>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
if ($device['os_group'] == "cisco") {
|
||||
|
||||
$module = 'Cisco-CBQOS';
|
||||
|
||||
require_once 'includes/component.php';
|
||||
$component = new component();
|
||||
$options['filter']['type'] = array('=',$module);
|
||||
$options['filter']['disabled'] = array('=',0);
|
||||
$options['filter']['ignore'] = array('=',0);
|
||||
$components = $component->getComponents($device['device_id'],$options);
|
||||
|
||||
// We only care about our device id.
|
||||
$components = $components[$device['device_id']];
|
||||
|
||||
// Only collect SNMP data if we have enabled components
|
||||
if (count($components > 0)) {
|
||||
// Let's gather the stats..
|
||||
$tblcbQosClassMapStats = snmpwalk_array_num($device, '.1.3.6.1.4.1.9.9.166.1.15.1.1', 2);
|
||||
|
||||
// Loop through the components and extract the data.
|
||||
foreach ($components as $key => $array) {
|
||||
$type = $array['qos-type'];
|
||||
|
||||
// Get data from the class table.
|
||||
if ($type == 2) {
|
||||
// Let's make sure the rrd is setup for this class.
|
||||
$filename = "port-".$array['ifindex']."-cbqos-".$array['sp-id']."-".$array['sp-obj'].".rrd";
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename ($filename);
|
||||
|
||||
if (!file_exists ($rrd_filename)) {
|
||||
rrdtool_create ($rrd_filename, " DS:postbits:COUNTER:600:0:U DS:bufferdrops:COUNTER:600:0:U DS:qosdrops:COUNTER:600:0:U" . $config['rrd_rra']);
|
||||
}
|
||||
|
||||
// Let's print some debugging info.
|
||||
d_echo("\n\nComponent: ".$key."\n");
|
||||
d_echo(" Class-Map: ".$array['label']."\n");
|
||||
d_echo(" SPID.SPOBJ: ".$array['sp-id'].".".$array['sp-obj']."\n");
|
||||
d_echo(" PostBytes: 1.3.6.1.4.1.9.9.166.1.15.1.1.10.".$array['sp-id'].".".$array['sp-obj']." = ".$tblcbQosClassMapStats['1.3.6.1.4.1.9.9.166.1.15.1.1.10'][$array['sp-id']][$array['sp-obj']]."\n");
|
||||
d_echo(" BufferDrops: 1.3.6.1.4.1.9.9.166.1.15.1.1.21.".$array['sp-id'].".".$array['sp-obj']." = ".$tblcbQosClassMapStats['1.3.6.1.4.1.9.9.166.1.15.1.1.21'][$array['sp-id']][$array['sp-obj']]."\n");
|
||||
d_echo(" QOSDrops: 1.3.6.1.4.1.9.9.166.1.15.1.1.17.".$array['sp-id'].".".$array['sp-obj']." = ".$tblcbQosClassMapStats['1.3.6.1.4.1.9.9.166.1.15.1.1.17'][$array['sp-id']][$array['sp-obj']]."\n");
|
||||
|
||||
$rrd['postbytes'] = $tblcbQosClassMapStats['1.3.6.1.4.1.9.9.166.1.15.1.1.10'][$array['sp-id']][$array['sp-obj']];
|
||||
$rrd['bufferdrops'] = $tblcbQosClassMapStats['1.3.6.1.4.1.9.9.166.1.15.1.1.21'][$array['sp-id']][$array['sp-obj']];
|
||||
$rrd['qosdrops'] = $tblcbQosClassMapStats['1.3.6.1.4.1.9.9.166.1.15.1.1.17'][$array['sp-id']][$array['sp-obj']];
|
||||
|
||||
// Update rrd
|
||||
rrdtool_update ($rrd_filename, $rrd);
|
||||
|
||||
// Clean-up after yourself!
|
||||
unset($filename, $rrd_filename);
|
||||
}
|
||||
} // End foreach components
|
||||
|
||||
echo $module." ";
|
||||
} // end if count components
|
||||
|
||||
// Clean-up after yourself!
|
||||
unset($type, $components, $component, $options, $module);
|
||||
}
|
||||
@@ -225,19 +225,27 @@ function poll_device($device, $options) {
|
||||
else {
|
||||
foreach ($config['poller_modules'] as $module => $module_status) {
|
||||
if ($attribs['poll_'.$module] || ( $module_status && !isset($attribs['poll_'.$module]))) {
|
||||
// TODO per-module polling stats
|
||||
$module_start = microtime(true);
|
||||
include 'includes/polling/'.$module.'.inc.php';
|
||||
$module_time = microtime(true) - $module_start;
|
||||
echo "Runtime for polling module '$module': $module_time\n";
|
||||
|
||||
// save per-module poller stats
|
||||
$tags = array(
|
||||
'rrd_def' => 'DS:'.$module.':GAUGE:600:0:U',
|
||||
'module' => $module,
|
||||
'rrd_def' => 'DS:poller:GAUGE:600:0:U',
|
||||
'rrd_name' => array('poller-perf', $module),
|
||||
);
|
||||
$fields = array(
|
||||
$module => $module_time,
|
||||
'poller' => $module_time,
|
||||
);
|
||||
data_update($device, 'poller-'.$module.'-perf', $tags, $fields);
|
||||
data_update($device, 'poller-perf', $tags, $fields);
|
||||
|
||||
// remove old rrd
|
||||
$oldrrd = rrd_name($device['hostname'], array('poller', $module, 'perf'));
|
||||
if (is_file($oldrrd)) {
|
||||
unlink($oldrrd);
|
||||
}
|
||||
}
|
||||
else if (isset($attribs['poll_'.$module]) && $attribs['poll_'.$module] == '0') {
|
||||
echo "Module [ $module ] disabled on host.\n";
|
||||
@@ -280,6 +288,7 @@ function poll_device($device, $options) {
|
||||
if (!empty($device_time)) {
|
||||
$tags = array(
|
||||
'rrd_def' => 'DS:poller:GAUGE:600:0:U',
|
||||
'module' => 'ALL',
|
||||
);
|
||||
$fields = array(
|
||||
'poller' => $device_time,
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS
|
||||
*
|
||||
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
$hardware = trim(snmp_get($device, 'partNumber.0', '-Ovq', 'EATON-EPDU-MIB'), '"');
|
||||
$version = trim(snmp_get($device, 'firmwareVersion.0', '-Ovq', 'EATON-EPDU-MIB'), '"');
|
||||
$serial = trim(snmp_get($device, 'serialNumber.0', '-Ovq', 'EATON-EPDU-MIB'), '"');
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
preg_match('/^Lexmark ([a-zA-Z0-9]+) version/', $poll_device['sysDescr'], $result);
|
||||
$hardware = $result[1];
|
||||
@@ -39,11 +39,11 @@
|
||||
// adslAturPerfESs.1 = 0 seconds
|
||||
// adslAturPerfValidIntervals.1 = 0
|
||||
// adslAturPerfInvalidIntervals.1 = 0
|
||||
if (isset($port_stats[$port['ifIndex']]['adslLineCoding'])) {
|
||||
if (isset($port_stats[$port_id]['adslLineCoding'])) {
|
||||
// Check to make sure Port data is cached.
|
||||
$this_port = &$port_stats[$port['ifIndex']];
|
||||
$this_port = &$port_stats[$port_id];
|
||||
|
||||
$rrdfile = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename('port-'.$port['ifIndex'].'-adsl.rrd');
|
||||
$rrdfile = get_port_rrdfile_path ($device['hostname'], $port_id, 'adsl');
|
||||
|
||||
$rrd_create = ' --step 300';
|
||||
$rrd_create .= ' DS:AtucCurrSnrMgn:GAUGE:600:0:635';
|
||||
@@ -130,8 +130,8 @@ if (isset($port_stats[$port['ifIndex']]['adslLineCoding'])) {
|
||||
$this_port[$oid] = ($this_port[$oid] / 10);
|
||||
}
|
||||
|
||||
if (dbFetchCell('SELECT COUNT(*) FROM `ports_adsl` WHERE `port_id` = ?', array($port['port_id'])) == '0') {
|
||||
dbInsert(array('port_id' => $port['port_id']), 'ports_adsl');
|
||||
if (dbFetchCell('SELECT COUNT(*) FROM `ports_adsl` WHERE `port_id` = ?', array($port_id)) == '0') {
|
||||
dbInsert(array('port_id' => $port_id), 'ports_adsl');
|
||||
}
|
||||
|
||||
$port['adsl_update'] = array('port_adsl_updated' => array('NOW()'));
|
||||
@@ -141,7 +141,7 @@ if (isset($port_stats[$port['ifIndex']]['adslLineCoding'])) {
|
||||
$port['adsl_update'][$oid] = $data;
|
||||
}
|
||||
|
||||
dbUpdate($port['adsl_update'], 'ports_adsl', '`port_id` = ?', array($port['port_id']));
|
||||
dbUpdate($port['adsl_update'], 'ports_adsl', '`port_id` = ?', array($port_id));
|
||||
|
||||
if ($this_port['adslAtucCurrSnrMgn'] > '1280') {
|
||||
$this_port['adslAtucCurrSnrMgn'] = 'U';
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
<?php
|
||||
|
||||
if ($port_stats[$port['ifIndex']] &&
|
||||
if ($port_stats[$port_id] &&
|
||||
$port['ifType'] == 'ethernetCsmacd' &&
|
||||
isset($port_stats[$port['ifIndex']]['dot3StatsIndex'])) {
|
||||
isset($port_stats[$port_id]['dot3StatsIndex'])) {
|
||||
// Check to make sure Port data is cached.
|
||||
$this_port = &$port_stats[$port[ifIndex]];
|
||||
$this_port = &$port_stats[$port_id];
|
||||
|
||||
// TODO: remove legacy check?
|
||||
$old_rrdfile = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename('etherlike-'.$port['ifIndex'].'.rrd');
|
||||
$rrdfile = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename('port-'.$port['ifIndex'].'-dot3.rrd');
|
||||
$rrd_file = get_port_rrdfile_path ($device['hostname'], $port_id, 'dot3');
|
||||
|
||||
$rrd_create = $config['rrd_rra'];
|
||||
|
||||
|
||||
@@ -35,14 +35,13 @@ $peth_oids = array(
|
||||
'pethMainPseConsumptionPower',
|
||||
);
|
||||
|
||||
if ($port_stats[$port['ifIndex']]
|
||||
if ($port_stats[$port_id]
|
||||
&& $port['ifType'] == 'ethernetCsmacd'
|
||||
&& isset($port_stats[$port['ifIndex']]['dot3StatsIndex'])) {
|
||||
&& isset($port_stats[$port_id]['dot3StatsIndex'])) {
|
||||
// Check to make sure Port data is cached.
|
||||
$this_port = &$port_stats[$port['ifIndex']];
|
||||
|
||||
$rrdfile = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename('port-'.$port['ifIndex'].'-poe.rrd');
|
||||
$this_port = &$port_stats[$port_id];
|
||||
|
||||
$rrdfile = get_port_rrdfile_path ($device['hostname'], $port_id, 'poe');
|
||||
if (!file_exists($rrdfile)) {
|
||||
$rrd_create .= $config['rrd_rra'];
|
||||
|
||||
|
||||
@@ -191,50 +191,91 @@ $polled = time();
|
||||
// End Building SNMP Cache Array
|
||||
d_echo($port_stats);
|
||||
|
||||
// Build array of ports in the database
|
||||
// FIXME -- this stuff is a little messy, looping the array to make an array just seems wrong. :>
|
||||
// -- i can make it a function, so that you don't know what it's doing.
|
||||
// -- $ports = adamasMagicFunction($ports_db); ?
|
||||
// select * doesn't do what we want if multiple tables have the same column name -- last one wins :/
|
||||
$ports_db = dbFetchRows('SELECT *, `ports_statistics`.`port_id` AS `ports_statistics_port_id`, `ports`.`port_id` AS `port_id` FROM `ports` LEFT OUTER JOIN `ports_statistics` ON `ports`.`port_id` = `ports_statistics`.`port_id` WHERE `ports`.`device_id` = ?', array($device['device_id']));
|
||||
// By default libreNMS uses the ifIndex to associate ports on devices with ports discoverd/polled
|
||||
// before and stored in the database. On Linux boxes this is a problem as ifIndexes may be
|
||||
// unstable between reboots or (re)configuration of tunnel interfaces (think: GRE/OpenVPN/Tinc/...)
|
||||
// The port association configuration allows to choose between association via ifIndex, ifName,
|
||||
// or maybe other means in the future. The default port association mode still is ifIndex for
|
||||
// compatibility reasons.
|
||||
$port_association_mode = $config['default_port_association_mode'];
|
||||
if ($device['port_association_mode'])
|
||||
$port_association_mode = get_port_assoc_mode_name ($device['port_association_mode']);
|
||||
|
||||
foreach ($ports_db as $port) {
|
||||
$ports[$port['ifIndex']] = $port;
|
||||
// Query known ports and mapping table in order of discovery to make sure
|
||||
// the latest discoverd/polled port is in the mapping tables.
|
||||
$ports_mapped = get_ports_mapped ($device['device_id'], true);
|
||||
$ports = $ports_mapped['ports'];
|
||||
|
||||
//
|
||||
// Rename any old RRD files still named after the previous ifIndex based naming schema.
|
||||
foreach ($ports_mapped['maps']['ifIndex'] as $ifIndex => $port_id) {
|
||||
foreach (array ('', 'adsl', 'dot3') as $suffix) {
|
||||
$suffix_tmp = '';
|
||||
if ($suffix)
|
||||
$suffix_tmp = "-$suffix";
|
||||
|
||||
$old_rrd_path = trim ($config['rrd_dir']) . '/' . $device['hostname'] . "/port-$ifIndex$suffix_tmp.rrd";
|
||||
$new_rrd_path = get_port_rrdfile_path ($device['hostname'], $port_id, $suffix);
|
||||
|
||||
if (is_file ($old_rrd_path)) {
|
||||
rename ($old_rrd_path, $new_rrd_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// New interface detection
|
||||
foreach ($port_stats as $ifIndex => $port) {
|
||||
// Store ifIndex in port entry and prefetch ifName as we'll need it multiple times
|
||||
$port['ifIndex'] = $ifIndex;
|
||||
$ifName = $port['ifName'];
|
||||
|
||||
// Get port_id according to port_association_mode used for this device
|
||||
$port_id = get_port_id ($ports_mapped, $port, $port_association_mode);
|
||||
|
||||
if (is_port_valid($port, $device)) {
|
||||
echo 'valid';
|
||||
if (!is_array($ports[$port['ifIndex']])) {
|
||||
$port_id = dbInsert(array('device_id' => $device['device_id'], 'ifIndex' => $ifIndex), 'ports');
|
||||
|
||||
// Port newly discovered?
|
||||
if (! $ports[$port_id]) {
|
||||
$port_id = dbInsert(array('device_id' => $device['device_id'], 'ifIndex' => $ifIndex, 'ifName' => $ifName), 'ports');
|
||||
dbInsert(array('port_id' => $port_id), 'ports_statistics');
|
||||
$ports[$port['ifIndex']] = dbFetchRow('SELECT * FROM `ports` WHERE `port_id` = ?', array($port_id));
|
||||
echo 'Adding: '.$port['ifName'].'('.$ifIndex.')('.$ports[$port['ifIndex']]['port_id'].')';
|
||||
$ports[$port_id] = dbFetchRow('SELECT * FROM `ports` WHERE `port_id` = ?', array($port_id));
|
||||
echo 'Adding: '.$ifName.'('.$ifIndex.')('.$port_id.')';
|
||||
// print_r($ports);
|
||||
}
|
||||
else if ($ports[$ifIndex]['deleted'] == '1') {
|
||||
dbUpdate(array('deleted' => '0'), 'ports', '`port_id` = ?', array($ports[$ifIndex]['port_id']));
|
||||
$ports[$ifIndex]['deleted'] = '0';
|
||||
}
|
||||
if ($ports[$ifIndex]['ports_statistics_port_id'] === null) {
|
||||
// in case the port was created before we created the table
|
||||
dbInsert(array('port_id' => $ports[$ifIndex]['port_id']), 'ports_statistics');
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($ports[$port['ifIndex']]['deleted'] != '1') {
|
||||
dbUpdate(array('deleted' => '1'), 'ports', '`port_id` = ?', array($ports[$ifIndex]['port_id']));
|
||||
$ports[$ifIndex]['deleted'] = '1';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// End New interface detection
|
||||
// Port re-discovered after previous deletion?
|
||||
else if ($ports[$port_id]['deleted'] == 1) {
|
||||
dbUpdate(array('deleted' => '0'), 'ports', '`port_id` = ?', array($port_id));
|
||||
$ports[$port_id]['deleted'] = '0';
|
||||
}
|
||||
if ($ports[$port_id]['ports_statistics_port_id'] === null) {
|
||||
// in case the port was created before we created the table
|
||||
dbInsert(array('port_id' => $port_id), 'ports_statistics');
|
||||
}
|
||||
|
||||
// Assure stable mapping
|
||||
$port_stats[$ifIndex]['port_id'] = $port_id;
|
||||
$ports[$port_id]['ifIndex'] = $ifIndex;
|
||||
}
|
||||
|
||||
// Port vanished (mark as deleted)
|
||||
else {
|
||||
if ($ports[$port_id]['deleted'] != '1') {
|
||||
dbUpdate(array('deleted' => '1'), 'ports', '`port_id` = ?', array($port_id));
|
||||
$ports[$port_id]['deleted'] = '1';
|
||||
}
|
||||
}
|
||||
} // End new interface detection
|
||||
|
||||
|
||||
echo "\n";
|
||||
// Loop ports in the DB and update where necessary
|
||||
foreach ($ports as $port) {
|
||||
echo 'Port '.$port['ifDescr'].'('.$port['ifIndex'].') ';
|
||||
$port_id = $port['port_id'];
|
||||
|
||||
echo 'Port ' . $port['ifName'] . ': ' . $port['ifDescr'] . '(' . $port['ifIndex'] . ') ';
|
||||
if ($port_stats[$port['ifIndex']] && $port['disabled'] != '1') {
|
||||
// Check to make sure Port data is cached.
|
||||
$this_port = &$port_stats[$port['ifIndex']];
|
||||
@@ -477,7 +518,7 @@ foreach ($ports as $port) {
|
||||
}
|
||||
|
||||
// Update RRDs
|
||||
$rrdfile = $host_rrd.'/port-'.safename($port['ifIndex'].'.rrd');
|
||||
$rrdfile = get_port_rrdfile_path ($device['hostname'], $port_id);
|
||||
if (!is_file($rrdfile)) {
|
||||
rrdtool_create(
|
||||
$rrdfile,
|
||||
@@ -576,9 +617,9 @@ foreach ($ports as $port) {
|
||||
|
||||
// Update Database
|
||||
if (count($port['update'])) {
|
||||
$updated = dbUpdate($port['update'], 'ports', '`port_id` = ?', array($port['port_id']));
|
||||
$updated = dbUpdate($port['update'], 'ports', '`port_id` = ?', array($port_id));
|
||||
// do we want to do something else with this?
|
||||
$updated += dbUpdate($port['update_extended'], 'ports_statistics', '`port_id` = ?', array($port['port_id']));
|
||||
$updated += dbUpdate($port['update_extended'], 'ports_statistics', '`port_id` = ?', array($port_id));
|
||||
d_echo("$updated updated");
|
||||
}
|
||||
|
||||
@@ -588,7 +629,7 @@ foreach ($ports as $port) {
|
||||
echo 'Port Deleted';
|
||||
// Port missing from SNMP cache.
|
||||
if ($port['deleted'] != '1') {
|
||||
dbUpdate(array('deleted' => '1'), 'ports', '`device_id` = ? AND `ifIndex` = ?', array($device['device_id'], $port['ifIndex']));
|
||||
dbUpdate(array('deleted' => '1'), 'ports', '`device_id` = ? AND `port_id` = ?', array($device['device_id'], $port_id));
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -599,7 +640,7 @@ foreach ($ports as $port) {
|
||||
|
||||
// Clear Per-Port Variables Here
|
||||
unset($this_port);
|
||||
}//end foreach
|
||||
} //end port update
|
||||
|
||||
// Clear Variables Here
|
||||
unset($port_stats);
|
||||
|
||||
@@ -39,6 +39,7 @@ if ($stpprotocol == 'ieee8021d' || $stpprotocol == 'unknown') {
|
||||
|
||||
// read the 802.1D subtree
|
||||
$stp_raw = snmpwalk_cache_oid($device, 'dot1dStp', array(), 'RSTP-MIB');
|
||||
d_echo($stp_raw);
|
||||
$stp = array(
|
||||
'protocolSpecification' => $stp_raw[0]['dot1dStpProtocolSpecification'],
|
||||
'priority' => $stp_raw[0]['dot1dStpPriority'],
|
||||
@@ -121,7 +122,59 @@ if ($stpprotocol == 'ieee8021d' || $stpprotocol == 'unknown') {
|
||||
dbUpdate($stp,'stp','device_id = ?', array($device['device_id']));
|
||||
echo '.';
|
||||
}
|
||||
|
||||
// STP port related stuff
|
||||
foreach ($stp_raw as $port => $value){
|
||||
if ($port) { // $stp_raw[0] ist not port related so we skip this one
|
||||
$stp_port = array(
|
||||
'priority' => $stp_raw[$port]['dot1dStpPortPriority'],
|
||||
'state' => $stp_raw[$port]['dot1dStpPortState'],
|
||||
'enable' => $stp_raw[$port]['dot1dStpPortEnable'],
|
||||
'pathCost' => $stp_raw[$port]['dot1dStpPortPathCost'],
|
||||
'designatedCost' => $stp_raw[$port]['dot1dStpPortDesignatedCost'],
|
||||
'designatedPort' => $stp_raw[$port]['dot1dStpPortDesignatedPort'],
|
||||
'forwardTransitions' => $stp_raw[$port]['dot1dStpPortForwardTransitions']
|
||||
);
|
||||
|
||||
// set device binding
|
||||
$stp_port['device_id'] = $device['device_id'];
|
||||
|
||||
// set port binding
|
||||
$stp_port['port_id'] = dbFetchCell('SELECT port_id FROM `ports` WHERE `device_id` = ? AND `ifIndex` = ?', array($device['device_id'], $stp_raw[$port]['dot1dStpPort']));
|
||||
|
||||
$dr = str_replace(array(' ', ':', '-'), '', strtolower($stp_raw[$port]['dot1dStpPortDesignatedRoot']));
|
||||
$dr = substr($dr, -12); //remove first two octets
|
||||
$stp_port['designatedRoot'] = $dr;
|
||||
|
||||
$db = str_replace(array(' ', ':', '-'), '', strtolower($stp_raw[$port]['dot1dStpPortDesignatedBridge']));
|
||||
$db = substr($db, -12); //remove first two octets
|
||||
$stp_port['designatedBridge'] = $db;
|
||||
|
||||
if ($device['os'] == 'pbn') {
|
||||
// It seems that PBN guys don't care about ieee 802.1d :-(
|
||||
// So try to find the right port with some crazy conversations
|
||||
$dp_value = dechex($stp_port['priority']);
|
||||
$dp_value = $dp_value.'00';
|
||||
$dp_value = hexdec($dp_value);
|
||||
if ($stp_raw[$port]['dot1dStpPortDesignatedPort']) {
|
||||
$dp = $stp_raw[$port]['dot1dStpPortDesignatedPort'] - $dp_value;
|
||||
$stp_port['designatedPort'] = $dp;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Port saved in format priority+port (ieee 802.1d-1998: clause 8.5.5.1)
|
||||
$dp = substr($stp_raw[$port]['dot1dStpPortDesignatedPort'], -2); //discard the first octet (priority part)
|
||||
$stp_port['designatedPort'] = hexdec($dp);
|
||||
}
|
||||
|
||||
//d_echo($stp_port);
|
||||
|
||||
// Update db
|
||||
dbUpdate($stp_port,'ports_stp','`device_id` = ? AND `port_id` = ?', array($device['device_id'], $stp_port['port_id']));
|
||||
echo '.';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unset($stp_raw, $stp, $stp_db);
|
||||
unset($stp_raw, $stp, $stp_db, $stp_port);
|
||||
echo "\n";
|
||||
|
||||
+69
-3
@@ -745,7 +745,7 @@ function snmp_cache_portName($device, $array) {
|
||||
|
||||
|
||||
function snmp_gen_auth(&$device) {
|
||||
global $debug;
|
||||
global $debug, $vdebug;
|
||||
|
||||
$cmd = '';
|
||||
|
||||
@@ -781,11 +781,11 @@ function snmp_gen_auth(&$device) {
|
||||
}
|
||||
else {
|
||||
if ($debug) {
|
||||
print 'DEBUG: '.$device['snmpver']." : Unsupported SNMP Version (wtf have you done ?)\n";
|
||||
print 'DEBUG: '.$device['snmpver']." : Unsupported SNMP Version (shouldn't be possible to get here)\n";
|
||||
}
|
||||
}//end if
|
||||
|
||||
if ($debug) {
|
||||
if ($vdebug) {
|
||||
print "DEBUG: SNMP Auth options = $cmd\n";
|
||||
}
|
||||
|
||||
@@ -1268,4 +1268,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;
|
||||
}
|
||||
|
||||
Executable
+3013
File diff suppressed because it is too large
Load Diff
Executable
+171
@@ -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
|
||||
|
||||
+6
-2
@@ -33,7 +33,7 @@ echo "MySQL: ".$versions['mysql_ver']."\n";
|
||||
echo "RRDTool: ".$versions['rrdtool_ver']."\n";
|
||||
echo "SNMP: ".$versions['netsnmp_ver']."\n";
|
||||
|
||||
$options = getopt('h:m:i:n:r::d::a::f::');
|
||||
$options = getopt('h:m:i:n:r::d::v::a::f::');
|
||||
|
||||
if ($options['h'] == 'odd') {
|
||||
$options['n'] = '1';
|
||||
@@ -83,14 +83,18 @@ if (!$where) {
|
||||
echo "-r Do not create or update RRDs\n";
|
||||
echo "-f Do not insert data into InfluxDB\n";
|
||||
echo "-d Enable debugging output\n";
|
||||
echo "-d Enable verbose debugging output\n";
|
||||
echo "-m Specify module(s) to be run\n";
|
||||
echo "\n";
|
||||
echo "No polling type specified!\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($options['d'])) {
|
||||
if (isset($options['d']) || isset($options['v'])) {
|
||||
echo "DEBUG!\n";
|
||||
if (isset($options['v'])) {
|
||||
$vdebug = true;
|
||||
}
|
||||
$debug = true;
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
|
||||
@@ -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']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -0,0 +1,2 @@
|
||||
DELETE a1 FROM alerts a1, alerts a2 WHERE a1.id < a2.id AND a1.device_id = a2.device_id AND a1.rule_id = a2.rule_id;
|
||||
ALTER TABLE `alerts` ADD UNIQUE `unique_alert`(`device_id`, `rule_id`);
|
||||
Reference in New Issue
Block a user