Fix conflict

This commit is contained in:
laf
2016-07-07 19:11:13 +01:00
218 changed files with 80539 additions and 695 deletions
+4
View File
@@ -107,6 +107,10 @@ LibreNMS contributors:
- Josh Driver <keeperofdakeys@gmail.com> (keeperofdakeys)
- Felix Eckhofer <felix@eckhofer.com> (tribut)
- Vikram Adukia <adukia@dropbox.com> (justmedude)
- Tijmen de Mes <tijmen@ag-projects.com> (tijmenNL)
- Benjamin Busche <benjamin.busche@gmail.com> (optic00)
- Brandon Boudrias <bt.boudrias@gmail.com> (brandune)
- Andy Noyland <andrew@noyland.co.uk> (Zappatron)
[1]: http://observium.org/ "Observium web site"
Observium was written by:
+15 -25
View File
@@ -2,7 +2,11 @@
This document is here to help code standards for contributions towards LibreNMS. The original code base that we forked from had a lack of standards and as such the code base has a variety of different styles. Whilst we don't want to restrict how people write code, these guidelines should mean we have a good standard going forward that makes reading the code easier. All modern day ide's should be able to assist in these guidelines without breaking your usual workflow.
### Indentation
## PHP-FIG PSR-2 Coding Style
All new code should follow the [PHP-FIG PSR-2 standard](http://www.php-fig.org/psr/psr-2/).
Below are a few key items from that specification, please make sure to follow the full spec.
### [Indentation](http://www.php-fig.org/psr/psr-2/#2-4-indenting)
Please use four (4) spaces to indent code rather than a tab. Ensure you increase indentation for nested code blocks.
```php
if ($foo == 5) {
@@ -10,46 +14,32 @@ if ($foo == 5) {
if ($foo == 5) {
```
### Line length
Try to keep the length of a line to about 75-85 characters. This isn't essential but does enable compatibility for all screen sizes but above all enables reading of code easier.
### [Line length](http://www.php-fig.org/psr/psr-2/#1-overview)
Try to keep the length of a line under 80 characters. If you must exceed 80 characters, please keep it under 120 characters. This makes reading the code easier and also enables compatibility for all screen sizes.
### Control structures
A space should be used both before and after the parenthesis and also surrounding the condition operator.
### [Control structures](http://www.php-fig.org/psr/psr-2/#5-control-structures)
A space must be used both before and after the parenthesis and also surrounding the condition operator.
```php
if ($foo == 5) {
```
Rather than
```php
if($foo==5){
```
Don't put blocks of code on a single line as in this example.
```php
if ($foo == 5) { echo 'foo is 5'; }
```
and instead format the code like.
Do not put blocks of code on a single line, do use parenthesis
```php
if ($foo == 5) {
echo 'foo is 5';
}
```
Start else and elsif on new lines, e.g.
else and elseif should start on the same line as ending of the previous code block.
```php
if ($foo == 5) {
echo 'foo is 5';
}
elsif ($foo == 4) {
} elsif ($foo == 4) {
echo 'foo is 4';
}
else {
} else {
echo 'foo is something else';
}
```
This makes diffs much cleaner when moving around blocks of code.
### Including files
@@ -58,10 +48,10 @@ Using parenthesis around file includes isn't required, instead just place the fi
require_once 'includes/snmp.inc.php';
```
### PHP tags
### [PHP tags](http://www.php-fig.org/psr/psr-1/#1-overview)
Ensure you use <?php rather than the shorthand version <?.
```php
<?php
```
The `?>` tag isn't required for included php files. For instance anything in includes/ or html/includes don't need the tag along with config.php. If the php file is standalone then you still need the tag. If you are unsure, add it in :)
The `?>` [must be excluded](http://www.php-fig.org/psr/psr-2/#2-2-files) from all files that only include PHP (no html). For instance anything in includes/ or html/includes don't need the tag along with config.php.
+59
View File
@@ -0,0 +1,59 @@
# Auto discovery support
LibreNMS provides the ability to automatically add devices on your network, we can do this with via
a few methods which will be explained below and also indicate if they are enabled by default.
All discovery methods run when discovery.php runs (every 6 hours by default and within 5 minutes for new devices).
### Discovery methods
#### ARP
Disabled by default.
To enable, switch on globally the `$config['discovery_modules']['discovery-arp'] = 1;` or per device within the Modules section.
#### XDP
Enabled by default.
`$config['autodiscovery']['xdp'] = false;` to disable.
This includes FDP, CDP and LLDP support based on the device type.
#### OSPF
Enabled by default.
`$config['autodiscovery']['ospf'] = false;` to disable.
#### BGP
Enabled by default.
`$config['autodiscovery']['bgp'] = false;` to disable.
This module is invoked from bgp-peers discovery module.
### Including / Excluding subnets to scan
By default the following config is in place to exclude loopback, multicast, etc ranges. You can expand this out by adding more
ranges to config.php
```php
$config['autodiscovery']['nets-exclude'][] = '0.0.0.0/8';
$config['autodiscovery']['nets-exclude'][] = '127.0.0.0/8';
$config['autodiscovery']['nets-exclude'][] = '169.254.0.0/16';
$config['autodiscovery']['nets-exclude'][] = '224.0.0.0/4';
$config['autodiscovery']['nets-exclude'][] = '240.0.0.0/4';
```
You will need to specify your own subnets that you would like to scan for which can be done with:
`$config['nets'][] = '8.8.8.0/24';`
#### Discovering devices by IP
By default we don't add devices by IP address, we look for a reverse dns name to be found and add with that. If this fails
and you would like to still add devices automatically then you will need to set `$config['discovery_by_ip'] = true;`
#### Short hostnames
If your devices only return a short hostname such as lax-fa0-dc01 but the full name should be lax-fa0-dc01.example.com then you can
set `$config['mydomain'] = 'example.com';`
+126 -51
View File
@@ -1,26 +1,22 @@
# Distributed Poller
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.
These machines can be in a different physical location and therefore minimize network latency for devices that are a considerable
distance away or are behind NAT firewalls.
Devices can also be grouped together into a `poller_group` to pin these devices to a single or a group of designated pollers.
Devices can 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.~~
> 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 a requirement that all pollers can access the central memcached to communicate with each other.
It is also required that all pollers can access the central memcached to communicate with each other.
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']`. 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.
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 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.
A standard configuration for a distrinuted poller would look like:
## Configuration
```php
// Distributed Poller-Settings
$config['distributed_poller'] = false;
$config['distributed_poller'] = true;
$config['distributed_poller_name'] = file_get_contents('/proc/sys/kernel/hostname');
$config['distributed_poller_group'] = 0;
$config['distributed_poller_memcached_host'] = 'example.net';
@@ -32,39 +28,28 @@ Below is an example setup based on a real deployment which at the time of writin
![Example Setup](http://docs.librenms.org/img/librenms-distributed-diagram.png)
###Architecture
### Architecture
How you setup the distribution is entirely up to you, you can choose to host the majority of the required services on a single virtual machine or server and then a poller to actually query the devices being monitored all the way through to having a dedicated server for each of the individual roles. Below are notes on what you need to consider both from the software layer but also connectivity.
####Web / API Layer
#### Web / API Layer
This is typically Apache but we have setup guides for both Nginx and Lighttpd which should work perfectly fine. There is nothing unique about the role this service is providing except that if you are adding devices from this layer then the web service will need to be able to connect to the end device via SNMP and perform an ICMP test.
It is advisable to run RRDCached within this setup so that you don't need to share the rrd folder via a remote file share such as NFS. The web service can then generate rrd graphs via RRDCached. If RRDCached isn't an option then you can mount the rrd directory to read the RRD files directly.
We would recommend that you run some form of php caching application such as PHP XCache
#### Database Server
MySQL / MariaDB - At the moment these are the only database servers that are supported, work is being done to ensure MySQL Strict mode is also supported but this should be considered to be incomplete still and therefor disabled.
The MySQL server should be contactable from this layer on port 3306 unless it's changed.
The pollers, web and API layers should all be able to access the database server directly.
####Database Server
MySQL - At the moment this is the only database server that is supported, work is being done to ensure MySQL Strict mode is also supported but this should be considered to be incomplete still.
The pollers, web and API layers should all be able to access the database server directly. It would be possible to configure MySQL multi master but that is outside the scope of this document.
####RRD Storage
#### 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 files ~~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:
#### Memcache
Memcache is required for the distributed pollers to be able to register to a central location and record what devices are polled. Memcache can run from any of the servers so long as it is accessible by all pollers.
```php
$config['rrdtool_version'] = 1.5;
```
####Memcache
Memcache is required for the distributed pollers to be able to register to a central location and record what devices are polled. Memcache can run from any of the kit so long as it is accessible by all pollers.
####Pollers
#### Pollers
Pollers can be installed and run from anywhere, the only requirements are:
They can access the Memcache instance
@@ -77,31 +62,121 @@ This will provide the ability to have a single poller behind a NAT firewall moni
Another benefit to this is that you can provide N+x pollers, i.e if you know that you require three pollers to process all devices within 300 seconds then adding a 4th poller will mean that should any one single poller fail then the remaining three will complete polling in time. You could also use this to take a poller out of service for maintenance, i.e OS updates and software updates.
It is 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.
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 and will slow polling down enough to cause issues with a large number of devices.
####Discovery
#### Discovery
It's not necessary to run discovery services on all pollers. In fact, you should only run one discovery process per poller group. Designate a single poller to run discovery (or a separate server if required).
####Config sample
Memcache:
- This doesn't require any special config. The example setup is running "-m 64 -p 11211 -l <ip>"
RRDCached:
- You will need to tune RRDCached to suite your environment.
- The following is used in this example setup "-l 0:42217 -j /var/lib/rrdcached/journal/ -F -b /opt/librenms/rrd -B -w 1800 -z 900 -p /var/run/rrdcached.pid"
#### Config sample
The following config is taken from a live setup which consists of a Web server, DB server, RRDCached server and 3 pollers.
Web Server:
Running Apache and an install of LibreNMS in /opt/librenms
- config.php
```php
$config['rrdcached'] = "127.0.0.1:42217";
$config['rrd_dir'] = "/opt/librenms/rrd";
$config['rrdcached_dir'] = "";
$config['distributed_poller'] = true;
$config['rrdcached'] = "example.com:42217";
$config['rrdcached_dir'] = ".";
```
For rrdtool 1.5 or greater then you can enable support for rrdcached to create the rrd files:
Database Server:
Running Memcache and MariaDB
- Memcache
```php
$config['rrdtool_version'] = 1.5;
Ubuntu (/etc/memcached.conf)
```conf
-d
-m 64
-p 11211
-u memcache
-l ip.ip.ip.ip
```
$config['rrdcached_dir'] Is only needed if you are using tcp connections for rrd cached and needs only to be set if you want to store rrd files within a sub directory of your rrdcached base directory.
RRDCached Server:
Running RRDCached
- RRDCached
Ubuntu (/etc/default/rrdcached)
```conf
OPTS="-l 0:42217"
OPTS="$OPTS -j /var/lib/rrdcached/journal/ -F"
OPTS="$OPTS -b /opt/librenms/rrd -B"
OPTS="$OPTS -w 1800 -z 900"
```
Poller 1:
Running an install of LibreNMS in /opt/librenms
`config.php`
```php
$config['distributed_poller_name'] = file_get_contents('/etc/hostname');
$config['distributed_poller_group'] = '0';
$config['distributed_poller_memcached_host'] = "example.com";
$config['distributed_poller_memcached_port'] = 11211;
$config['distributed_poller_host'] = "example.com";
$config['distributed_poller_port'] = 11211;
$config['distributed_poller'] = true;
$config['rrdcached'] = "example.com:42217";
$config['rrdcached_dir'] = ".";
$config['update'] = 0;
```
`/etc/cron.d/librenms`
Runs discovery and polling for group 0, daily.sh to deal with notifications and DB cleanup and alerts.
```conf
33 */6 * * * librenms /opt/librenms/discovery.php -h all >> /dev/null 2>&1
*/5 * * * * librenms /opt/librenms/discovery.php -h new >> /dev/null 2>&1
*/5 * * * * librenms /opt/librenms/poller-wrapper.py 24 >> /opt/librenms/logs/wrapper.log
15 0 * * * librenms /opt/librenms/daily.sh >> /dev/null 2>&1
* * * * * librenms /opt/librenms/alerts.php >> /dev/null 2>&1
```
Poller 2:
Running an install of LibreNMS in /opt/librenms
`config.php`
```php
$config['distributed_poller_name'] = file_get_contents('/etc/hostname');
$config['distributed_poller_group'] = '0';
$config['distributed_poller_memcached_host'] = "example.com";
$config['distributed_poller_memcached_port'] = 11211;
$config['distributed_poller_host'] = "example.com";
$config['distributed_poller_port'] = 11211;
$config['distributed_poller'] = true;
$config['rrdcached'] = "example.com:42217";
$config['rrdcached_dir'] = ".";
$config['update'] = 0;
```
`/etc/cron.d/librenms`
Runs billing as well as polling for group 0.
```conf
*/5 * * * * librenms /opt/librenms/poller-wrapper.py 24 >> /opt/librenms/logs/wrapper.log
*/5 * * * * librenms /opt/librenms/poll-billing.php >> /dev/null 2>&1
01 * * * * librenms /opt/librenms/billing-calculate.php >> /dev/null 2>&1
```
Poller 3:
Running an install of LibreNMS in /opt/librenms
`config.php`
```php
$config['distributed_poller_name'] = file_get_contents('/etc/hostname');
$config['distributed_poller_group'] = '2,3';
$config['distributed_poller_memcached_host'] = "example.com";
$config['distributed_poller_memcached_port'] = 11211;
$config['distributed_poller_host'] = "example.com";
$config['distributed_poller_port'] = 11211;
$config['distributed_poller'] = true;
$config['rrdcached'] = "example.com:42217";
$config['rrdcached_dir'] = ".";
$config['update'] = 0;
```
`/etc/cron.d/librenms`
Runs discovery and polling for groups 2 and 3.
```conf
33 */6 * * * librenms /opt/librenms/discovery.php -h all >> /dev/null 2>&1
*/5 * * * * librenms /opt/librenms/discovery.php -h new >> /dev/null 2>&1
*/5 * * * * librenms /opt/librenms/poller-wrapper.py 16 >> /opt/librenms/logs/wrapper.log
```
-26
View File
@@ -2,29 +2,3 @@
#### Please see [The new alerting docs](http://docs.librenms.org/Extensions/Alerting/#transports-email)
> None of these configuration options will work on builds older than the 1st of August 2015.
~~Currently, the email alerts needs to be set up in the config. If you want to enable it, paste this in your config and change it:~~
```php
// Mailer backend Settings
$config['email_backend'] = 'mail'; // Mail backend. Allowed: "mail" (PHP's built-in), "sendmail", "smtp".
$config['email_from'] = NULL; // Mail from. Default: "ProjectName" <projectid@`hostname`>
$config['email_user'] = $config['project_id'];
$config['email_sendmail_path'] = '/usr/sbin/sendmail'; // The location of the sendmail program.
$config['email_smtp_host'] = 'localhost'; // Outgoing SMTP server name.
$config['email_smtp_port'] = 25; // The port to connect.
$config['email_smtp_timeout'] = 10; // SMTP connection timeout in seconds.
$config['email_smtp_secure'] = NULL; // Enable encryption. Use 'tls' or 'ssl'
$config['email_smtp_auth'] = FALSE; // Whether or not to use SMTP authentication.
$config['email_smtp_username'] = NULL; // SMTP username.
$config['email_smtp_password'] = NULL; // Password for SMTP authentication.
// Alerting Settings
$config['alerts']['email']['default'] = '[email protected]'; // Default alert recipient
$config['alerts']['email']['default_only'] = FALSE; // Only use default recipient
$config['alerts']['email']['enable'] = TRUE; // Enable email alerts
$config['alerts']['bgp']['whitelist'] = NULL; // Populate as an array() with ASNs to alert on.
$config['alerts']['port']['ifdown'] = FALSE; // Generate alerts for ports that go down
```
+2 -1
View File
@@ -6,8 +6,9 @@ made to InfluxDB itself then we cannot guarantee that your data will be ok so en
risk!
### Requirements
- InfluxDB 0.94
- InfluxDB >= 0.94
- Grafana
- PHP 5.5 for InfluxDB-PHP
The setup of the above is completely out of scope here and we aren't really able to provide any help with this side
of things.
+44
View File
@@ -3,9 +3,28 @@
#### Bug fixes
- WebUI:
- Rename $ds to $ldap_connection for auth modules (PR3596)
- Fix the display of custom snmp ports (PR3646)
- Fix bugs in Create new / edit alert templates (PR3651)
- Fixed ajax_ calls for use with base_url (PR3661)
- Updated old frontpage to use new services format (PR3691)
- Order alerts by state to indicate which alerts are open (PR3692)
- Fixed maintenance windows showing as lapsed (PR3704)
- Removed duplicated dbInsert from dashboard creation (PR3761)
- Fixed 95th for graphs (PR3762)
- Polling / Discovery:
- Updated Poweralert divisor to 10 for sensors (PR3645)
- Fixed NX-OS version polling (PR3688)
- Fixed STP log spam from Mikrotik device (PR3689)
- Removed " from ZyWall version number (PR3693)
- Updated register_mib to use d_echo (PR3739)
- Fixed invalid SQL for BGP Discovery (PR3742)
- Alerting:
- Unacknowledged alerts will now continue to send alerts (PR3667)
- Misc:
- Fix smokeping path in gen_smokeping (PR3577)
- Fix full include path in includes/polling/functions.inc.php (PR3614)
- Added port_id to tune_port.php query (PR3753)
- Updated port schema to support > 17.1 Gbs for _rate values (PR3754)
#### Improvements
- Added / improved detection for:
@@ -17,18 +36,43 @@
- IBM Bladecenter switches (PR3623)
- HWg support (PR3624)
- IBM IMM (PR3625)
- ServerTech Sentry4 PDUs (PR3659)
- SwOS (PR3662)
- Sophos (R3678, PR3679, PR3736)
- OSX El Capitan (PR3690)
- DNOS (PR3703, PR3730)
- Cisco SB SG200 (PR3705)
- EMC FlareOS (PR3712)
- Enhance Brocade Fabric OS (PR3712)
- Huawei SmartAX (PR3737)
- Polling / Discovery:
- Use lsb_release in distro script (PR3580)
- Allow lmsensors fanspeeds of 0 to be discovered (PR3616)
- Added support for rrdcached application monitoring (PR3627)
- Improve the output of polling/debug to make it easier to see modules (PR3694)
- WebUI:
- Resolve some reported security issues (PR3586) With thanks to https://twitter.com/wireghoul
- Order apps list alphabetically (PR3600)
- Network map improvements (PR3602)
- Added support for varying hostname formats in Oxidized integration (PR3617)
- Added device hw/location on hover in alerts table (PR3621)
- Updated unpolled notification to link directly to those devices (PR3696)
- Added ability to search via IP for Graylog integration (PR3697)
- Optimised network map SQL (PR3715)
- Added support for wildcards in custom graph groups (PR3722)
- Added ability to override ifSpeed for ports (PR3752)
- Added sysName to global search (PR3757)
- Alerting:
- Added ability to use location in alert templates (PR3652)
- Documentation:
- Added docs on Auto discovery (PR3671)
- Updated InfluxDB docs (PR3673)
- Updated distributed polling docs (PR3675)
- Updated FAQs (PR3677)
- Misc:
- Added pivot table for device groups ready for V2 (PR3589)
- Added device_id column to eventlog (PR3682)
- Cleanup sensors and related tables + added constraints (PR3745)
### May 2016
@@ -0,0 +1,158 @@
> NOTE: These instructions assume you are the root user. If you are not, prepend `sudo` to the shell commands (the ones that aren't at `mysql>` prompts) or temporarily become a user with root privileges with `sudo -s` or `sudo -i`.
### DB Server ###
> NOTE: Whilst we are working on ensuring LibreNMS is compatible with MySQL strict mode, for now, please disable this after mysql is installed.
#### Install / Configure MySQL
```bash
yum install mariadb-server mariadb
service mariadb restart
mysql -uroot -p
```
```sql
CREATE DATABASE librenms;
GRANT ALL PRIVILEGES ON librenms.*
TO 'librenms'@'localhost'
IDENTIFIED BY '<password>'
;
FLUSH PRIVILEGES;
exit
```
`vim /etc/my.cnf`
Within the [mysqld] section please add:
```bash
innodb_file_per_table=1
sql-mode=""
```
```service mariadb restart```
### Web Server ###
#### Install / Configure Apache
```bash
yum install epel-release
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum install php70w php70w-cli php70w-gd php70w-mysql php70w-snmp php70w-pear php70w-curl php70w-common php70w-fpm nginx net-snmp mariadb ImageMagick jwhois nmap mtr rrdtool MySQL-python net-snmp-utils cronie php70w-mcrypt fping git
pear install Net_IPv4-1.3.4
pear install Net_IPv6-1.2.2b2
```
In `/etc/php.ini` ensure date.timezone is set to your preferred time zone. See http://php.net/manual/en/timezones.php for a list of supported timezones. Valid examples are: "America/New York", "Australia/Brisbane", "Etc/UTC".
#### Add librenms user
```bash
useradd librenms -d /opt/librenms -M -r
usermod -a -G librenms apache
```
#### Clone repo
```bash
cd /opt
git clone https://github.com/librenms/librenms.git librenms
```
#### Web interface
```bash
cd /opt/librenms
mkdir rrd logs
chmod 775 rrd
vim /etc/httpd/conf.d/librenms.conf
```
Add the following config:
```apache
<VirtualHost *:80>
DocumentRoot /opt/librenms/html/
ServerName librenms.example.com
CustomLog /opt/librenms/logs/access_log combined
ErrorLog /opt/librenms/logs/error_log
AllowEncodedSlashes NoDecode
<Directory "/opt/librenms/html/">
Require all granted
AllowOverride All
Options FollowSymLinks MultiViews
</Directory>
</VirtualHost>
```
> NOTE: If this is the only site you are hosting on this server (it should be :)) then you will need to disable the default site.
`rm -f /etc/httpd/conf.d/welcome.conf`
#### SELinux
```bash
yum install policycoreutils-python
semanage fcontext -a -t httpd_sys_content_t '/opt/librenms/logs(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/opt/librenms/logs(/.*)?'
restorecon -RFvv /opt/librenms/logs/
setsebool -P httpd_can_sendmail=1
```
#### Restart Web server
```bash
service httpd restart
```
#### Web installer
Now head to: http://librenms.example.com/install.php and follow the on-screen instructions.
Once you have completed the web installer steps. Please add the following to `config.php`
`$config['fping'] = "/usr/sbin/fping";`
#### Configure snmpd
```bash
cp /opt/librenms/snmpd.conf.example /etc/snmpd/snmpd.conf
vim /etc/snmpd/snmpd.conf
```
Edit the text which says `RANDOMSTRINGGOESHERE` and set your own community string.
`service snmpd restart`
#### Cron job
`cp librenms.nonroot.cron /etc/cron.d/librenms`
#### Final steps
```bash
chown -R librenms:librenms /opt/librenms
systemctl enable httpd
systemctl enable mariadb
```
Now run validate your install and make sure everything is ok:
```bash
cd /opt/librenms
./validate.php
```
That's it! You now should be able to log in to http://librenms.example.com/. Please note that we have not covered HTTPS setup in this example, so your LibreNMS install is not secure by default. Please do not expose it to the public Internet unless you have configured HTTPS and taken appropriate web server hardening steps.
#### Add first device
We now suggest that you add localhost as your first device from within the WebUI.
#### Closing
We hope you enjoy using LibreNMS. If you do, it would be great if you would consider opting into the stats system we have, please see [this page](http://docs.librenms.org/General/Callback-Stats-and-Privacy/) on what it is and how to enable it.
@@ -0,0 +1,170 @@
> NOTE: These instructions assume you are the root user. If you are not, prepend `sudo` to the shell commands (the ones that aren't at `mysql>` prompts) or temporarily become a user with root privileges with `sudo -s` or `sudo -i`.
### DB Server ###
> NOTE: Whilst we are working on ensuring LibreNMS is compatible with MySQL strict mode, for now, please disable this after mysql is installed.
#### Install / Configure MySQL
```bash
yum install mariadb-server mariadb
service mariadb restart
mysql -uroot -p
```
```sql
CREATE DATABASE librenms;
GRANT ALL PRIVILEGES ON librenms.*
TO 'librenms'@'localhost'
IDENTIFIED BY '<password>'
;
FLUSH PRIVILEGES;
exit
```
`vim /etc/my.cnf`
Within the [mysqld] section please add:
```bash
innodb_file_per_table=1
sql-mode=""
```
```service mariadb restart```
### Web Server ###
#### Install / Configure Nginx
```bash
yum install epel-release
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum install php70w php70w-cli php70w-gd php70w-mysql php70w-snmp php70w-pear php70w-curl php70w-common php70w-fpm nginx net-snmp mariadb ImageMagick jwhois nmap mtr rrdtool MySQL-python net-snmp-utils cronie php70w-mcrypt fping git
pear install Net_IPv4-1.3.4
pear install Net_IPv6-1.2.2b2
```
In `/etc/php.ini` ensure date.timezone is set to your preferred time zone. See http://php.net/manual/en/timezones.php for a list of supported timezones. Valid examples are: "America/New York", "Australia/Brisbane", "Etc/UTC".
```bash
service php7.0-fpm restart
phpenmod mcrypt
```
#### Add librenms user
```bash
useradd librenms -d /opt/librenms -M -r
usermod -a -G librenms apache
```
#### Clone repo
```bash
cd /opt
git clone https://github.com/librenms/librenms.git librenms
```
#### Web interface
```bash
cd /opt/librenms
mkdir rrd logs
chmod 775 rrd
vim /etc/nginx/conf.d/librenms.conf
```
Add the following config:
```nginx
server {
listen 80;
server_name librenms.example.com;
root /opt/librenms/html;
index index.php;
access_log /opt/librenms/logs/access_log;
error_log /opt/librenms/logs/error_log;
location / {
try_files $uri $uri/ @librenms;
}
location ~ \.php {
include fastcgi.conf;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
}
location ~ /\.ht {
deny all;
}
location @librenms {
rewrite api/v0(.*)$ /api_v0.php/$1 last;
rewrite ^(.+)$ /index.php/$1 last;
}
}
```
#### SELinux
```bash
yum install policycoreutils-python
semanage fcontext -a -t httpd_sys_content_t '/opt/librenms/logs(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/opt/librenms/logs(/.*)?'
restorecon -RFvv /opt/librenms/logs/
setsebool -P httpd_can_sendmail=1
```
#### Restart Web server
```bash
service nginx restart
```
#### Web installer
Now head to: http://librenms.example.com/install.php and follow the on-screen instructions.
Once you have completed the web installer steps. Please add the following to `config.php`
`$config['fping'] = "/usr/sbin/fping";`
#### Configure snmpd
```bash
cp /opt/librenms/snmpd.conf.example /etc/snmpd/snmpd.conf
vim /etc/snmpd/snmpd.conf
```
Edit the text which says `RANDOMSTRINGGOESHERE` and set your own community string.
`service snmpd restart`
#### Cron job
`cp librenms.nonroot.cron /etc/cron.d/librenms`
#### Final steps
```bash
chown -R librenms:librenms /opt/librenms
systemctl enable nginx
systemctl enable mariadb
```
Now run validate your install and make sure everything is ok:
```bash
cd /opt/librenms
./validate.php
```
That's it! You now should be able to log in to http://librenms.example.com/. Please note that we have not covered HTTPS setup in this example, so your LibreNMS install is not secure by default. Please do not expose it to the public Internet unless you have configured HTTPS and taken appropriate web server hardening steps.
#### Add first device
We now suggest that you add localhost as your first device from within the WebUI.
#### Closing
We hope you enjoy using LibreNMS. If you do, it would be great if you would consider opting into the stats system we have, please see [this page](http://docs.librenms.org/General/Callback-Stats-and-Privacy/) on what it is and how to enable it.
@@ -0,0 +1,140 @@
> NOTE: These instructions assume you are the root user. If you are not, prepend `sudo` to the shell commands (the ones that aren't at `mysql>` prompts) or temporarily become a user with root privileges with `sudo -s` or `sudo -i`.
### DB Server ###
> NOTE: Whilst we are working on ensuring LibreNMS is compatible with MySQL strict mode, for now, please disable this after mysql is installed.
#### Install / Configure MySQL
```bash
apt-get install mariadb-server mariadb-client
service mariadb restart
mysql -uroot -p
```
```sql
CREATE DATABASE librenms;
GRANT ALL PRIVILEGES ON librenms.*
TO 'librenms'@'localhost'
IDENTIFIED BY '<password>'
;
FLUSH PRIVILEGES;
exit
```
`vim /etc/mysql/mariadb.conf.d/50-server.cnf`
Within the [mysqld] section please add:
```bash
innodb_file_per_table=1
sql-mode=""
```
```service mariadb restart```
### Web Server ###
#### Install / Configure Apache
`apt-get install libapache2-mod-php7.0 php7.0-cli php7.0-mysql php7.0-gd php7.0-snmp php-pear php7.0-curl snmp graphviz php7.0-mcrypt php7.0-json apache2 fping imagemagick whois mtr-tiny nmap python-mysqldb snmpd php-net-ipv4 php-net-ipv6 rrdtool git`
In `/etc/php/7.0/apache2/php.ini` and `/etc/php/7.0/cli/php.ini`, ensure date.timezone is set to your preferred time zone. See http://php.net/manual/en/timezones.php for a list of supported timezones. Valid examples are: "America/New York", "Australia/Brisbane", "Etc/UTC".
```bash
a2enmod php7.0
a2dismod mpm_event
a2enmod mpm_prefork
phpenmod mcrypt
```
#### Add librenms user
```bash
useradd librenms -d /opt/librenms -M -r
usermod -a -G librenms www-data
```
#### Clone repo
```bash
cd /opt
git clone https://github.com/librenms/librenms.git librenms
```
#### Web interface
```bash
cd /opt/librenms
mkdir rrd logs
chmod 775 rrd
vim /etc/apache2/sites-available/librenms.conf
```
Add the following config:
```apache
<VirtualHost *:80>
DocumentRoot /opt/librenms/html/
ServerName librenms.example.com
CustomLog /opt/librenms/logs/access_log combined
ErrorLog /opt/librenms/logs/error_log
AllowEncodedSlashes NoDecode
<Directory "/opt/librenms/html/">
Require all granted
AllowOverride All
Options FollowSymLinks MultiViews
</Directory>
</VirtualHost>
```
```bash
a2ensite librenms.conf
a2enmod rewrite
service apache2 restart
```
> NOTE: If this is the only site you are hosting on this server (it should be :)) then you will need to disable the default site.
`a2dissite 000-default`
#### Web installer
Now head to: http://librenms.example.com/install.php and follow the on-screen instructions.
#### Configure snmpd
```bash
cp /opt/librenms/snmpd.conf.example /etc/snmpd.conf
vim /etc/snmpd.conf
```
Edit the text which says `RANDOMSTRINGGOESHERE` and set your own community string.
`service snmpd restart`
#### Cron job
`cp librenms.nonroot.cron /etc/cron.d/librenms`
#### Final steps
```bash
chown -R librenms:librenms /opt/librenms
```
Now run validate your install and make sure everything is ok:
```bash
cd /opt/librenms
./validate.php
```
That's it! You now should be able to log in to http://librenms.example.com/. Please note that we have not covered HTTPS setup in this example, so your LibreNMS install is not secure by default. Please do not expose it to the public Internet unless you have configured HTTPS and taken appropriate web server hardening steps.
#### Add first device
We now suggest that you add localhost as your first device from within the WebUI.
#### Closing
We hope you enjoy using LibreNMS. If you do, it would be great if you would consider opting into the stats system we have, please see [this page](http://docs.librenms.org/General/Callback-Stats-and-Privacy/) on what it is and how to enable it.
@@ -0,0 +1,143 @@
> NOTE: These instructions assume you are the root user. If you are not, prepend `sudo` to the shell commands (the ones that aren't at `mysql>` prompts) or temporarily become a user with root privileges with `sudo -s` or `sudo -i`.
### DB Server ###
> NOTE: Whilst we are working on ensuring LibreNMS is compatible with MySQL strict mode, for now, please disable this after mysql is installed.
#### Install / Configure MySQL
```bash
apt-get install mariadb-server mariadb-client
service mariadb restart
mysql -uroot -p
```
```sql
CREATE DATABASE librenms;
GRANT ALL PRIVILEGES ON librenms.*
TO 'librenms'@'localhost'
IDENTIFIED BY '<password>'
;
FLUSH PRIVILEGES;
exit
```
`vim /etc/mysql/mariadb.conf.d/50-server.cnf`
Within the [mysqld] section please add:
```bash
innodb_file_per_table=1
sql-mode=""
```
```service mariadb restart```
### Web Server ###
#### Install / Configure Nginx
`apt-get install php7.0-cli php7.0-mysql php7.0-gd php7.0-snmp php-pear php7.0-curl php7.0-fpm snmp graphviz php7.0-mcrypt php7.0-json nginx-full fping imagemagick whois mtr-tiny nmap python-mysqldb snmpd php-net-ipv4 php-net-ipv6 rrdtool git`
In `/etc/php/7.0/fpm/php.ini` and `/etc/php/7.0/cli/php.ini`, ensure date.timezone is set to your preferred time zone. See http://php.net/manual/en/timezones.php for a list of supported timezones. Valid examples are: "America/New York", "Australia/Brisbane", "Etc/UTC".
```bash
service php7.0-fpm restart
phpenmod mcrypt
```
#### Add librenms user
```bash
useradd librenms -d /opt/librenms -M -r
usermod -a -G librenms www-data
```
#### Clone repo
```bash
cd /opt
git clone https://github.com/librenms/librenms.git librenms
```
#### Web interface
```bash
cd /opt/librenms
mkdir rrd logs
chmod 775 rrd
vim /etc/nginx/conf.d/librenms.conf
```
Add the following config:
```nginx
server {
listen 80;
server_name librenms.example.com;
root /opt/librenms/html;
index index.php;
access_log /opt/librenms/logs/access_log;
error_log /opt/librenms/logs/error_log;
location / {
try_files $uri $uri/ @librenms;
}
location ~ \.php {
include fastcgi.conf;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
}
location ~ /\.ht {
deny all;
}
location @librenms {
rewrite api/v0(.*)$ /api_v0.php/$1 last;
rewrite ^(.+)$ /index.php/$1 last;
}
}
```
```bash
service nginx restart
```
#### Web installer
Now head to: http://librenms.example.com/install.php and follow the on-screen instructions.
#### Configure snmpd
```bash
cp /opt/librenms/snmpd.conf.example /etc/snmpd.conf
vim /etc/snmpd.conf
```
Edit the text which says `RANDOMSTRINGGOESHERE` and set your own community string.
`service snmpd restart`
#### Cron job
`cp librenms.nonroot.cron /etc/cron.d/librenms`
#### Final steps
```bash
chown -R librenms:librenms /opt/librenms
```
Now run validate your install and make sure everything is ok:
```bash
cd /opt/librenms
./validate.php
```
That's it! You now should be able to log in to http://librenms.example.com/. Please note that we have not covered HTTPS setup in this example, so your LibreNMS install is not secure by default. Please do not expose it to the public Internet unless you have configured HTTPS and taken appropriate web server hardening steps.
#### Add first device
We now suggest that you add localhost as your first device from within the WebUI.
#### Closing
We hope you enjoy using LibreNMS. If you do, it would be great if you would consider opting into the stats system we have, please see [this page](http://docs.librenms.org/General/Callback-Stats-and-Privacy/) on what it is and how to enable it.
+29
View File
@@ -0,0 +1,29 @@
# Installing LibreNMS
We have some pre-built VirtualBox images you can use to get started:
[Ubuntu 16.04](http://docs.librenms.org/Installation/Ubuntu-image/)
[CentOS 7](http://docs.librenms.org/Installation/CentOS-image/)
If you want to install yourself then we have some new documentation which should make it easy.
> Please note the following docs are new and may not be 100% complate, please provide feedback on your experience.
[Ubuntu 16.04 Apache](http://docs.librenms.org/Installation/Installation-Ubuntu-1604-Apache/)
[Ubuntu 16.04 Nginx](http://docs.librenms.org/Installation/Installation-Ubuntu-1604-Nginx/)
[RHEL / CentOS 7 Apache](http://docs.librenms.org/Installation/Installation-CentOS-7-Apache/)
[RHEL / CentOS 7 Nginx](http://docs.librenms.org/Installation/Installation-CentOS-7-Nginx/)
If the above are missing or incomplete then you can try our old docs below.
[Debian/Ubuntu](http://docs.librenms.org/Installation/Installation-(Debian-Ubuntu)/)
[RHEL/CentOS](http://docs.librenms.org/Installation/Installation-(RHEL-CentOS)/
[Debian/Ubuntu Lighttpd](http://docs.librenms.org/Installation/Installation-Lighttpd-(Debian-Ubuntu)/)
[Debian/Ubuntu Nginx](http://docs.librenms.org/Installation/Installation-Nginx-(Debian-Ubuntu)/)
+4 -4
View File
@@ -161,10 +161,10 @@ $config['show_services'] = 0; # Enable Services on menu
$config['int_customers'] = 1; # Enable Customer Port Parsing
$config['summary_errors'] = 0; # Show Errored ports in summary boxes on the dashboard
$config['customers_descr'] = 'cust'; // The description to look for in ifDescr. Can be an array as well array('cust','cid');
$config['transit_descr'] = ""; // Add custom transit descriptions (can be an array)
$config['peering_descr'] = ""; // Add custom peering descriptions (can be an array)
$config['core_descr'] = ""; // Add custom core descriptions (can be an array)
$config['custom_descr'] = ""; // Add custom interface descriptions (can be an array)
$config['transit_descr'] = 'transit'; // Add custom transit descriptions (can be an array)
$config['peering_descr'] = 'peering'; // Add custom peering descriptions (can be an array)
$config['core_descr'] = 'core'; // Add custom core descriptions (can be an array)
$config['custom_descr'] = ''; // Add custom interface descriptions (can be an array)
$config['int_transit'] = 1; # Enable Transit Types
$config['int_peering'] = 1; # Enable Peering Types
$config['int_core'] = 1; # Enable Core Port Types
+22 -7
View File
@@ -13,7 +13,9 @@
- [How do I debug the poller process?](#faq12)
- [Why do I get a lot apache or rrdtool zombies in my process list?](#faq14)
- [Why do I see traffic spikes in my graphs?](#faq15)
- [Why do I see gaps in my graphs?](#faq17)
- [How do I change the IP / hostname of a device?](#faq16)
- [Things aren't working correctly?](#faq18)
### Developing
- [How do I add support for a new OS?](#faq8)
@@ -24,9 +26,7 @@
This is currently well documented within the doc folder of the installation files.
For Debian / Ubuntu installs follow [Debian / Ubuntu](http://docs.librenms.org/Installation/Installation-(Debian-Ubuntu))
For RedHat / CentOS installs follow [RedHat / CentOS](http://docs.librenms.org/Installation/Installation-(RHEL-CentOS))
Please see the following [doc](http://docs.librenms.org/Installation/Installing-LibreNMS/)
#### <a name="faq2"> How do I add a device?</a>
@@ -72,10 +72,7 @@ If the page you are trying to load has a substantial amount of data in it then i
#### <a name="faq10"> Why do I not see any graphs?</a>
This is usually due to there being blank spaces outside of the `<?php ?>` php tags within config.php. Remove these and retry.
It's also worth removing the final `?>` at the end of config.php as this is not required.
Another reason why it might not be working is if you disabled functions needed by LibreNMS, which include `allow_url_fopen`
and `exec,passthru,shell_exec,escapeshellarg,escapeshellcmd,proc_close,proc_open,popen`.
The easiest way to check if all is well is to run `./validate.php` as root from within your install directory. This should give you info on why things aren't working.
#### <a name="faq7"> How do I debug pages not loading correctly?</a>
@@ -105,6 +102,16 @@ Before this all rrd files were set to 100G max values, now you can enable suppor
rrdtool tune will change the max value when the interface speed is detected as being changed (min value will be set for anything 10M or over) or when you run the included script (scripts/tune_port.php).
#### <a name="faq17"> Why do I see gaps in my graphs?</a>
This is most commonly due to the poller not being able to complete it's run within 300 seconds. Check which devices are causing this by going to /poll-log/ within the Web interface.
When you find the device(s) which are taking the longest you can then look at the Polling module graph under Graphs -> Poller -> Poller Modules Performance. Take a look at what modules are taking the longest and disabled un used modules.
If you poll a large number of devices / ports then it's recommended to run a local recurisve dns server such as pdns-recursor.
Running RRDCached is also highly advised in larger installs but has benefits no matter the size.
#### <a name="faq16"> How do I change the IP / hostname of a device?</a>
There is a host rename tool called renamehost.php in your librenms root directory. When renaming you are also changing the device's IP / hostname address for monitoring.
@@ -113,6 +120,14 @@ Usage:
./renamehost.php <old hostname> <new hostname>
```
#### <a name="faq18"> Things aren't working correctly?</a>
Run `./validate.php` as root from within your install.
Re-run `./validate.php` once you've resolved any issues raised.
You have an odd issue - we'd suggest you join our irc channel to discuss.
#### <a name="faq8"> How do I add support for a new OS?</a>
The easiest way to show you how to do that is to link to an existing pull request that has been merged in on [GitHub](https://github.com/librenms/librenms/pull/352/files)
+1 -1
View File
@@ -50,7 +50,7 @@ if (isset($_REQUEST['search'])) {
else if ($_REQUEST['type'] == 'device') {
// Device search
if (is_admin() === true || is_read() === true) {
$results = dbFetchRows("SELECT * FROM `devices` WHERE `hostname` LIKE '%".$search."%' OR `location` LIKE '%".$search."%' ORDER BY hostname LIMIT ".$limit);
$results = dbFetchRows("SELECT * FROM `devices` WHERE `hostname` LIKE '%".$search."%' OR `location` LIKE '%".$search."%' OR `sysName` LIKE '%".$search."%' ORDER BY hostname LIMIT ".$limit);
}
else {
$results = dbFetchRows("SELECT * FROM `devices` AS `D`, `devices_perms` AS `P` WHERE `P`.`user_id` = ? AND `P`.`device_id` = `D`.`device_id` AND (`hostname` LIKE '%".$search."%' OR `location` LIKE '%".$search."%') ORDER BY hostname LIMIT ".$limit, array($_SESSION['user_id']));
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

+1 -10
View File
@@ -495,19 +495,10 @@ function get_graph_by_portgroup() {
$vars['width'] = $_GET['width'] ?: 1075;
$vars['height'] = $_GET['height'] ?: 300;
$auth = '1';
$type_where = ' (';
$or = '';
$type_param = array();
foreach (explode(',', $group) as $type) {
$type_where .= " $or `port_descr_type` = ?";
$or = 'OR';
$type_param[] = $type;
}
$type_where .= ') ';
$ports = get_ports_from_type(explode(',', $group));
$if_list = '';
$seperator = '';
$ports = dbFetchRows("SELECT * FROM `ports` as I, `devices` AS D WHERE $type_where AND I.device_id = D.device_id ORDER BY I.ifAlias", $type_param);
foreach ($ports as $port) {
$if_list .= $seperator.$port['port_id'];
$seperator = ',';
@@ -295,7 +295,9 @@ function get_dn($samaccountname) {
}
function get_cn($dn) {
$dn = str_replace('\\,','~C0mmA~',$dn);
preg_match('/[^,]*/', $dn, $matches, PREG_OFFSET_CAPTURE, 3);
$matches[0][0] = str_replace('~C0mmA~',',',$matches[0][0]);
return $matches[0][0];
}
+8 -1
View File
@@ -180,7 +180,7 @@ else {
<th data-column-id="details" data-sortable="false">&nbsp;</th>
<th data-column-id="hostname">Hostname</th>
<th data-column-id="timestamp">Timestamp</th>
<th data-column-id="severity">Severity</th>
<th data-column-id="severity" data-formatter="severity">Severity</th>
<th data-column-id="ack" data-formatter="ack" data-sortable="false">Acknowledge</th>';
if (is_numeric($proc)) {
if ($proc) { $common_output[] = '<th data-column-id="proc" data-formatter="proc" data-sortable="false">Procedure</th>'; }
@@ -231,6 +231,13 @@ var alerts_grid = $("#alerts_'.$unique_id.'").bootgrid({
},
"proc": function(column,row) {
return "<button type=\'button\' class=\'btn command-open-proc\' data-alert_id=\'"+row.alert_id+"\' name=\'open-proc\' id=\'open-proc\'>Open</button>";
},
"severity": function(column,row) {
var eventColor = "info";
if (row.severity.match (/critical/)) { eventColor = "danger"; }
else if (row.severity.match (/warning/)) { eventColor = "warning"; }
else if (row.severity.match (/ok/)) { eventColor = "success"; }
return "<h4><span class=\'label label-" + eventColor + " threeqtr-width\'>" + row.severity + "</span></h4>";
}
},
templates: {
+17 -27
View File
@@ -74,6 +74,7 @@ if( defined('show_settings') || empty($widget_settings) ) {
<option value="peering"'.($widget_settings['graph_type'] == 'peering' ? ' selected' : '').'>&nbsp;&nbsp;&nbsp;Peering</option>
<option value="core"'.($widget_settings['graph_type'] == 'core' ? ' selected' : '').'>&nbsp;&nbsp;&nbsp;Core</option>
<option value="custom"'.($widget_settings['graph_type'] == 'custom' ? ' selected' : '').'>&nbsp;&nbsp;&nbsp;Custom Descr</option>
<option value="manual"'.($widget_settings['graph_type'] == 'manual' ? ' selected' : '').'>&nbsp;&nbsp;&nbsp;Manual Descr</option>
<option disabled></option>
<option value="bill_bits"'.($widget_settings['graph_type'] == 'bill_bits' ? ' selected' : '').'>Bill</option>
</select>
@@ -150,6 +151,14 @@ if( defined('show_settings') || empty($widget_settings) ) {
$common_output[] = ' </select>
</div>
</div>
<div class="form-group input_'.$unique_id.'" id="input_'.$unique_id.'_manual">
<div class="col-sm-2">
<label for="graph_manual" class="control-label">Manual Port-Desc: </label>
</div>
<div class="col-sm-10">
<input type="text" class="form-control input_'.$unique_id.'_manual" name="graph_manual" placeholder="Descr String" value="'.htmlspecialchars($widget_settings['graph_manual']).'">';
$common_output[] = ' </div>
</div>
<div class="form-group input_'.$unique_id.'" id="input_'.$unique_id.'_bill">
<div class="col-sm-2">
<label for="graph_bill" class="control-label">Bill: </label>
@@ -393,39 +402,20 @@ else {
elseif ($type == 'munin') {
$param = 'device='.$widget_settings['graph_'.$type]['device_id'].'&plugin='.$widget_settings['graph_'.$type]['name'];
}
elseif ($type == 'transit' || $type == 'peering' || $type == 'core') {
$type_where = ' (';
if (is_array($config[$type.'_descr']) === false) {
$config[$type.'_descr'] = array($config[$type.'_descr']);
elseif ($type == 'transit' || $type == 'peering' || $type == 'core' || $type == 'custom' || $type == 'manual') {
if ( $type == 'custom' || $type == 'manual') {
$type = $widget_settings['graph_'.$type];
$type = explode(',', $type);
}
foreach ($config[$type.'_descr'] as $additional_type) {
if (!empty($additional_type)) {
$type_where .= " $or `port_descr_type` = ?";
$or = 'OR';
$type_param[] = $additional_type;
}
}
$type_where .= " $or `port_descr_type` = ?";
$or = 'OR';
$type_param[] = $type;
$type_where .= ') ';
foreach (dbFetchRows("SELECT port_id FROM `ports` WHERE $type_where ORDER BY ifAlias", $type_param) as $port) {
$ports = get_ports_from_type($type);
foreach ($ports as $port) {
$tmp[] = $port['port_id'];
}
$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';
if (empty($widget_settings['title'])) {
$widget_settings['title'] = 'Overall '.ucfirst(htmlspecialchars($widget_settings['graph_custom'])).' Bits ('.$widget_settings['graph_range'].')';
$widget_settings['title'] = 'Overall '.ucfirst(htmlspecialchars($type)).' Bits ('.$widget_settings['graph_range'].')';
}
}
else {
+1 -1
View File
@@ -116,7 +116,7 @@ $tmp_output .= '
range: "' . mres($_POST['range']) . '"
};
},
url: "/ajax_table.php",
url: "ajax_table.php",
});
</script>
+5 -3
View File
@@ -19,19 +19,21 @@ if (!is_numeric($alert_id)) {
echo 'ERROR: No alert selected';
exit;
}
else if (!is_numeric($state)) {
elseif (!is_numeric($state)) {
echo 'ERROR: No state passed';
exit;
}
else {
if ($state == 2) {
$state = dbFetchCell('SELECT alerted FROM alerts WHERE id = ?', array($alert_id));
$open = 1;
}
else if ($state >= 1) {
elseif ($state >= 1) {
$state = 2;
$open = 1;
}
if (dbUpdate(array('state' => $state), 'alerts', 'id=?', array($alert_id)) >= 0) {
if (dbUpdate(array('state' => $state, 'open' => $open), 'alerts', 'id=?', array($alert_id)) >= 0) {
echo 'Alert acknowledged status changed.';
exit;
}
+2 -2
View File
@@ -20,8 +20,6 @@ $device_id = mres($_POST['device_id']);
$ifName = mres($_POST['ifName']);
$port_id = mres($_POST['port_id']);
logfile($descr . ','. $device_id . ','. $ifName. ','. $port_id);
if (!empty($ifName) && is_numeric($port_id)) {
// We have ifName and port id so update ifAlias
if (empty($descr)) {
@@ -32,9 +30,11 @@ if (!empty($ifName) && is_numeric($port_id)) {
$device = device_by_id_cache($device_id);
if ($descr === 'repoll') {
del_dev_attrib($device, 'ifName:'.$ifName);
log_event("$ifName Port ifAlias cleared manually", $device, 'interface', $port_id);
}
else {
set_dev_attrib($device, 'ifName:'.$ifName, 1);
log_event("$ifName Port ifAlias set manually: $descr", $device, 'interface', $port_id);
}
$status = 'ok';
}
@@ -0,0 +1,60 @@
<?php
/*
* LibreNMS
*
* Copyright (c) 2014 Neil Lathwood <https://github.com/laf/ http://www.lathwood.co.uk/fa>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
header('Content-type: application/json');
$status = 'error';
$speed = mres($_POST['speed']);
$device_id = mres($_POST['device_id']);
$ifName = mres($_POST['ifName']);
$port_id = mres($_POST['port_id']);
if (!empty($ifName) && is_numeric($port_id) && is_numeric($port_id)) {
// We have ifName and port id so update ifAlias
if (empty($speed)) {
$speed = array('NULL');
$high_speed = array('NULL');
// Set to 999999 so we avoid using ifDescr on port poll
}
else {
$high_speed = $speed / 1000000;
}
if (dbUpdate(array('ifSpeed'=>$speed, 'ifHighSpeed'=>$high_speed), 'ports', '`port_id`=?', array($port_id)) > 0) {
$device = device_by_id_cache($device_id);
if (is_array($speed)) {
del_dev_attrib($device, 'ifSpeed:'.$ifName);
log_event("$ifName Port speed cleared manually", $device, 'interface', $port_id);
}
else {
set_dev_attrib($device, 'ifSpeed:'.$ifName, 1);
log_event("$ifName Port speed set manually: $speed", $device, 'interface', $port_id);
$port_tune = get_dev_attrib($device, 'ifName_tune:'.$ifName);
$device_tune = get_dev_attrib($device,'override_rrdtool_tune');
if ($port_tune == "true" ||
($device_tune == "true" && $port_tune != 'false') ||
($config['rrdtool_tune'] == "true" && $port_tune != 'false' && $device_tune != 'false')) {
$rrdfile = get_port_rrdfile_path ($device['hostname'], $port_id);
rrdtool_tune('port',$rrdfile,$speed);
}
}
$status = 'ok';
}
else {
$status = 'na';
}
}
$response = array(
'status' => $status,
);
echo _json_encode($response);
+55 -8
View File
@@ -892,14 +892,6 @@ function generate_ap_url($ap, $vars=array()) {
}//end generate_ap_url()
function report_this($message) {
global $config;
return '<h2>'.$message.' Please <a href="'.$config['project_issues'].'">report this</a> to the '.$config['project_name'].' developers.</h2>';
}//end report_this()
function report_this_text($message) {
global $config;
return $message.'\nPlease report this to the '.$config['project_name'].' developers at '.$config['project_issues'].'\n';
@@ -1283,3 +1275,58 @@ function get_ripe_api_whois_data_json($ripe_data_param, $ripe_query_param) {
return json_decode(file_get_contents($ripe_whois_url) , true);
}//end get_ripe_api_whois_data_json()
/**
* Return the rows from 'ports' for all ports of a certain type as parsed by port_descr_parser.
* One or an array of strings can be provided as an argument; if an array is passed, all ports matching
* any of the types in the array are returned.
* @param $types mixed String or strings matching 'port_descr_type's.
* @return array Rows from the ports table for matching ports.
*/
function get_ports_from_type($given_types) {
global $config;
# Make the arg an array if it isn't, so subsequent steps only have to handle arrays.
if(!is_array($given_types)) {
$given_types = array($given_types);
}
# Check the config for a '_descr' entry for each argument. This is how a 'custom_descr' entry can
# be key/valued to some other string that's actually searched for in the DB. Merge or append the
# configured value if it's an array or a string. Or append the argument itself if there's no matching
# entry in config.
$search_types = array();
foreach($given_types as $type) {
if(isset($config[$type.'_descr']) === true) {
if (is_array($config[$type.'_descr']) === true) {
$search_types = array_merge($search_types, $config[$type.'_descr']);
}
else {
$search_types[] = $config[$type.'_descr'];
}
}
else {
$search_types[] = $type;
}
}
# Using the full list of strings to search the DB for, build the 'where' portion of a query that
# compares 'port_descr_type' with entry in the list. Also, since '@' is the convential wildcard,
# replace it with '%' so it functions as a wildcard in the SQL query.
$type_where = ' (';
$or = '';
$type_param = array();
foreach($search_types as $type) {
if (!empty($type)) {
$type = strtr($type, '@', '%');
$type_where .= " $or `port_descr_type` LIKE ?";
$or = 'OR';
$type_param[] = $type;
}
}
$type_where .= ') ';
# Run the query with the generated 'where' and necessary parameters, and send it back.
$ports = dbFetchRows("SELECT * FROM `ports` as I, `devices` AS D WHERE $type_where AND I.device_id = D.device_id ORDER BY I.ifAlias", $type_param);
return $ports;
}
@@ -42,12 +42,12 @@ $rrd_list = array(
array(
'ds' => 'updates_received',
'filename' => $rrd_filename,
'descr' => 'Updates Recieved',
'descr' => 'Updates Received',
),
array (
'ds' => 'flushes_received',
'filename' => $rrd_filename,
'descr' => 'Flushes Recieved',
'descr' => 'Flushes Received',
),
);
+4
View File
@@ -90,6 +90,10 @@ if ($_GET['bg']) {
$rrd_options .= ' -c CANVAS#'.mres($_GET['bg']).' ';
}
if ($_GET['font']) {
$rrd_options .= ' -c FONT#'.mres($_GET['font']).' ';
}
// $rrd_options .= " -c BACK#FFFFFF";
if ($height < '99') {
$rrd_options .= ' --only-graph';
+4 -2
View File
@@ -85,15 +85,17 @@ $rrd_options .= ' VDEF:totin=inoctets,TOTAL';
$rrd_options .= ' VDEF:totout=outoctets,TOTAL';
$rrd_options .= ' VDEF:tot=octets,TOTAL';
$rrd_options .= ' VDEF:95thin=inbits,95,PERCENT';
$rrd_options .= ' VDEF:95thout=outbits,95,PERCENT';
$rrd_options .= ' CDEF:d95thoutn=doutbits,-1,* VDEF:d95thoutn95=d95thoutn,95,PERCENT CDEF:d95thoutn95n=doutbits,doutbits,-,d95thoutn95,-1,*,+ VDEF:d95thout=d95thoutn95n,FIRST';
if ($format == 'octets' || $format == 'bytes') {
$rrd_options .= ' VDEF:95thin=inoctets,95,PERCENT';
$rrd_options .= ' VDEF:95thout=outoctets,95,PERCENT';
$units = 'Bps';
$format = 'octets';
}
else {
$rrd_options .= ' VDEF:95thin=inbits,95,PERCENT';
$rrd_options .= ' VDEF:95thout=outbits,95,PERCENT';
$units = 'bps';
$format = 'bits';
}
+2 -2
View File
@@ -93,7 +93,7 @@ if ($percentile) {
$rrd_options .= ' GPRINT:percentile_in:%6.2lf%s';
}
$rrd_options .= " COMMENT:'\\n'";
$rrd_options .= " COMMENT:\\n";
$rrd_options .= ' AREA:dout#'.$colour_area_out.':';
$rrd_options .= ' LINE1.25:dout#'.$colour_line_out.":'".$out_text."'";
$rrd_options .= ' GPRINT:out:LAST:%6.2lf%s';
@@ -104,7 +104,7 @@ if ($percentile) {
$rrd_options .= ' GPRINT:percentile_out:%6.2lf%s';
}
$rrd_options .= " COMMENT:\\\\n";
$rrd_options .= " COMMENT:\\n";
if ($print_total) {
$rrd_options .= " GPRINT:tot:'Total %6.2lf%s'";
@@ -87,14 +87,14 @@ if ($i) {
// $rrd_options .= " LINE1.25:dout".$format."#".$colour_line_out.":";
}
else {
$rrd_options .= ' AREA:in'.$format.'#'.$colour_area_in.':';
$rrd_options .= " COMMENT:'bps Now Ave Max 95th %\\n'";
$rrd_options .= ' AREA:in'.$format.'#'.$colour_area_in.':In ';
// $rrd_options .= " LINE1.25:in".$format."#".$colour_line_in.":In\ ";
$rrd_options .= ' GPRINT:in'.$format.':LAST:%6.2lf%s';
$rrd_options .= ' GPRINT:in'.$format.':AVERAGE:%6.2lf%s';
$rrd_options .= ' GPRINT:in'.$format.':MAX:%6.2lf%s';
$rrd_options .= " GPRINT:95thin:%6.2lf%s\\\\n";
$rrd_options .= ' AREA:dout'.$format.'#'.$colour_area_out.':';
$rrd_options .= ' AREA:dout'.$format.'#'.$colour_area_out.':Out';
// $rrd_options .= " LINE1.25:dout".$format."#".$colour_line_out.":Out";
$rrd_options .= ' GPRINT:out'.$format.':LAST:%6.2lf%s';
$rrd_options .= ' GPRINT:out'.$format.':AVERAGE:%6.2lf%s';
+1 -1
View File
@@ -100,7 +100,7 @@ else {
}
$rrd_options .= "\\\\n";
$rrd_options .= " COMMENT:\\\\n";
$rrd_options .= " COMMENT:\\n";
if ($print_total) {
$rrd_options .= ' GPRINT:'.$ds.'_tot:Total\ %6.2lf%s\)\\\\l';
+2 -7
View File
@@ -155,7 +155,7 @@ $start = (($page_number - 1) * $results);
$full_query = $full_query.$query." LIMIT $start,$results";
foreach (dbFetchRows($full_query, $param) as $rule) {
$sub = dbFetchRows('SELECT * FROM alerts WHERE rule_id = ? ORDER BY id DESC LIMIT 1', array($rule['id']));
$sub = dbFetchRows('SELECT * FROM alerts WHERE rule_id = ? ORDER BY `state` DESC, `id` DESC LIMIT 1', array($rule['id']));
$ico = 'ok';
$col = 'success';
$extra = '';
@@ -165,16 +165,11 @@ foreach (dbFetchRows($full_query, $param) as $rule) {
$ico = 'ok';
$col = 'success';
}
else if ((int) $sub['state'] === 1) {
elseif ((int) $sub['state'] === 1 || (int) $sub['state'] === 2) {
$ico = 'remove';
$col = 'danger';
$extra = 'danger';
}
else if ((int) $sub['state'] === 2) {
$ico = 'time';
$col = 'default';
$extra = 'warning';
}
}
$alert_checked = '';
+10 -14
View File
@@ -78,16 +78,14 @@ if (in_array('mac',$config['network_map_items'])) {
SUM(IF(`P2_ip`.`ipv4_address` = `M`.`ipv4_address`, 1, 0))
AS `remote_matching_ips`
FROM `ipv4_mac` AS `M`
LEFT JOIN `ports` AS `P1` ON `P1`.`port_id`=`M`.`port_id`
LEFT JOIN `ports` AS `P2` ON `P2`.`ifPhysAddress`=`M`.`mac_address`
LEFT JOIN `devices` AS `D1` ON `P1`.`device_id`=`D1`.`device_id`
LEFT JOIN `devices` AS `D2` ON `P2`.`device_id`=`D2`.`device_id`
LEFT JOIN `ipv4_addresses` AS `P2_ip` ON `P2_ip`.`port_id` = `P2`.`port_id`
INNER JOIN `ports` AS `P1` ON `P1`.`port_id`=`M`.`port_id`
INNER JOIN `ports` AS `P2` ON `P2`.`ifPhysAddress`=`M`.`mac_address`
INNER JOIN `devices` AS `D1` ON `P1`.`device_id`=`D1`.`device_id`
INNER JOIN `devices` AS `D2` ON `P2`.`device_id`=`D2`.`device_id`
INNER JOIN `ipv4_addresses` AS `P2_ip` ON `P2_ip`.`port_id` = `P2`.`port_id`
$join_sql
WHERE
`M`.`mac_address` NOT IN ('000000000000','ffffffffffff') AND
`P1`.`port_id` IS NOT NULL AND
`P2`.`port_id` IS NOT NULL AND
`D1`.`device_id` != `D2`.`device_id`
$where
$sql
@@ -121,17 +119,15 @@ if (in_array('xdp', $config['network_map_items'])) {
`P2`.`ifInOctets_rate` AS `remote_ifinoctets_rate`,
`P2`.`ifOutOctets_rate` AS `remote_ifoutoctets_rate`
FROM `links`
LEFT JOIN `devices` AS `D1` ON `D1`.`device_id`=`links`.`local_device_id`
LEFT JOIN `devices` AS `D2` ON `D2`.`device_id`=`links`.`remote_device_id`
LEFT JOIN `ports` AS `P1` ON `P1`.`port_id`=`links`.`local_port_id`
LEFT JOIN `ports` AS `P2` ON `P2`.`port_id`=`links`.`remote_port_id`
INNER JOIN `devices` AS `D1` ON `D1`.`device_id`=`links`.`local_device_id`
INNER JOIN `devices` AS `D2` ON `D2`.`device_id`=`links`.`remote_device_id`
INNER JOIN `ports` AS `P1` ON `P1`.`port_id`=`links`.`local_port_id`
INNER JOIN `ports` AS `P2` ON `P2`.`port_id`=`links`.`remote_port_id`
$join_sql
WHERE
`active`=1 AND
`local_device_id` != 0 AND
`remote_device_id` != 0 AND
`local_device_id` IS NOT NULL AND
`remote_device_id` IS NOT NULL
`remote_device_id` != 0
$where
$sql
GROUP BY `P1`.`port_id`,`P2`.`port_id`
+6 -3
View File
@@ -47,15 +47,18 @@ if ($rowCount != -1) {
$sql .= " LIMIT $limit_low,$limit_high";
}
$sql = "SELECT `S`.`schedule_id`, DATE_FORMAT(`S`.`start`, '".$config['dateformat']['mysql']['compact']."') AS `start`, DATE_FORMAT(`S`.`end`, '".$config['dateformat']['mysql']['compact']."') AS `end`, `S`.`title` $sql";
$sql = "SELECT `S`.`schedule_id`, DATE_FORMAT(NOW(), '".$config['dateformat']['mysql']['compact']."') AS now, DATE_FORMAT(`S`.`start`, '".$config['dateformat']['mysql']['compact']."') AS `start`, DATE_FORMAT(`S`.`end`, '".$config['dateformat']['mysql']['compact']."') AS `end`, `S`.`title` $sql";
foreach (dbFetchRows($sql, $param) as $schedule) {
$status = 0;
if ($schedule['end'] < date('dS M Y H:i::s')) {
$start = strtotime($schedule['start']);
$end = strtotime($schedule['end']);
$now = strtotime($schedule['now']);
if ($end < $now) {
$status = 1;
}
if (date('dS M Y H:i::s') >= $schedule['start'] && date('dS M Y H:i::s') < $schedule['end']) {
if ($now >= $start && $now < $end) {
$status = 2;
}
+1
View File
@@ -71,6 +71,7 @@ foreach (dbFetchRows($sql, $param) as $port) {
<input type="hidden" name="oldign_'.$port['port_id'].'" value="'.($port['ignore'] ? 1 : 0).'"">',
'port_tune' => '<input type="checkbox" id="override_config" name="override_config" data-attrib="ifName_tune:'.$port['ifName'].'" data-device_id="'.$port['device_id'].'" data-size="small" '.$checked.'>',
'ifAlias' => '<div class="form-group"><input class="form-control input-sm" id="if-alias" name="if-alias" data-device_id="'.$port['device_id'].'" data-port_id="'.$port['port_id'].'" data-ifName="'.$port['ifName'].'" value="'.$port['ifAlias'].'"><span class="glyphicon form-control-feedback" aria-hidden="true"></span></div>',
'ifSpeed' => '<div class="form-group has-feedback"><input type="text" pattern="[0-9]*" inputmode="numeric" class="form-control input-sm" id="if-speed" name="if-speed" data-device_id="'.$port['device_id'].'" data-port_id="'.$port['port_id'].'" data-ifName="'.$port['ifName'].'" value="'.$port['ifSpeed'].'"><span class="glyphicon form-control-feedback" aria-hidden="true"></span></div>',
);
}//end foreach
+4
View File
@@ -36,7 +36,11 @@ if (!empty($filter_hostname)) {
$query .= ' && ';
}
$ip = gethostbyname($filter_hostname);
$device = device_by_name($filter_hostname);
$query .= 'source:"'.$filter_hostname.'" || source:"'.$ip.'"';
if (isset($device['ip']) && $ip != $device['ip']) {
$query .= ' || source:"'.$device['ip'].'"';
}
}
$graylog_url = $config['graylog']['server'] . ':' . $config['graylog']['port'] . '/search/universal/relative?query=' . urlencode($query) . '&range='. $filter_range . $extra_query;
+4
View File
@@ -19,6 +19,10 @@ if (isset($searchPhrase) && !empty($searchPhrase)) {
$sql .= " AND (hostname LIKE '%$searchPhrase%' OR last_polled LIKE '%$searchPhrase%' OR last_polled_timetaken LIKE '%$searchPhrase%')";
}
if ($_POST['type'] == "unpolled") {
$sql .= " AND `last_polled` <= DATE_ADD(NOW(), INTERVAL - 15 minute)";
}
if (!isset($sort) || empty($sort)) {
$sort = 'last_polled_timetaken DESC';
}
+1 -1
View File
@@ -320,7 +320,7 @@ echo('<h5>Powered by <a href="' . $config['project_home'] . '" target="_blank" c
}
if(dbFetchCell("SELECT COUNT(`device_id`) FROM `devices` WHERE `last_polled` <= DATE_ADD(NOW(), INTERVAL - 15 minute) AND `ignore` = 0 AND `disabled` = 0 AND status = 1",array()) > 0) {
$msg_box[] = array('type' => 'warning', 'message' => "<a href=\"poll-log/\">It appears as though you have some devices that haven't completed polling within the last 15 minutes, you may want to check that out :)</a>",'title' => 'Devices unpolled');
$msg_box[] = array('type' => 'warning', 'message' => "<a href=\"poll-log/filter=unpolled/\">It appears as though you have some devices that haven't completed polling within the last 15 minutes, you may want to check that out :)</a>",'title' => 'Devices unpolled');
}
if(is_array($msg_box)) {
+7 -3
View File
@@ -145,7 +145,7 @@ echo "
<h3>LibreNMS is an autodiscovering PHP/MySQL-based network monitoring system.</h3>
<?php
$versions = version_info();
$versions = version_info(false);
$project_name = $config['project_name'];
$project_version = $config['version'];
$apache_version = str_replace('Apache/', '', $_SERVER['SERVER_SOFTWARE']);
@@ -155,12 +155,12 @@ $netsnmp_version = $versions['netsnmp_ver'];
$rrdtool_version = $versions['rrdtool_ver'];
$schema_version = $versions['db_schema'];
$version = `git rev-parse --short HEAD`;
$version_date = $versions['local_date'];
echo "
<div class='table-responsive'>
<table class='table table-condensed' border='0'>
<tr><td><b>Version</b></td><td><a href='http://www.librenms.org/changelog.html'>$version</a></td></tr>
<tr><td><b>Version</b></td><td><a href='http://www.librenms.org/changelog.html'>$version - <span id='version_date'>$version_date</span></a></td></tr>
<tr><td><b>DB Schema</b></td><td>#$schema_version</td></tr>
<tr><td><b>Apache</b></td><td>$apache_version</td></tr>
<tr><td><b>PHP</b></td><td>$php_version</td></tr>
@@ -234,4 +234,8 @@ echo "
}
});
});
// convert the version date from ISO 8601 to the browser's timezone
var ver_date = $('#version_date');
ver_date.text(new Date(ver_date.text()).toString());
</script>
+1 -1
View File
@@ -29,6 +29,6 @@ $pagetitle[] = 'Customers';
id: "customers",
};
},
url: "/ajax_table.php"
url: "ajax_table.php"
});
</script>
+2 -2
View File
@@ -67,7 +67,7 @@
event.preventDefault();
$.ajax({
type: "POST",
url: "/ajax_form.php",
url: "ajax_form.php",
data: $('form#components').serialize(),
dataType: "json",
success: function(data){
@@ -97,6 +97,6 @@
device_id: "<?php echo $device['device_id']; ?>"
};
},
url: "/ajax_table.php"
url: "ajax_table.php"
});
</script>
+43
View File
@@ -16,6 +16,7 @@
<th data-column-id='ifOperStatus'>Oper</th>
<th data-column-id='disabled' data-sortable='false'>Disable</th>
<th data-column-id='ignore' data-sortable='false'>Ignore</th>
<th data-column-id='ifSpeed'>ifSpeed (bits/s)</th>
<th data-column-id='port_tune' data-sortable='false' data-searchable='false'>RRD Tune</th>
<th data-column-id='ifAlias'>Description</th>
</tr>
@@ -66,6 +67,48 @@
}
});
});
$(document).on('blur keyup', "[name='if-speed']", function (e){
if (e.type === 'keyup' && e.keyCode !== 13) return;
var $this = $(this);
var speed = $this.val().replace(/[^0-9]/gi, '');
var device_id = $this.data('device_id');
var port_id = $this.data('port_id');
var ifName = $this.data('ifname');
$.ajax({
type: 'POST',
url: 'ajax_form.php',
data: {type: "update-ifspeed", speed: speed, ifName: ifName, port_id: port_id, device_id: device_id},
dataType: "json",
success: function (data) {
if (data.status == 'ok') {
$this.closest('.form-group').addClass('has-success');
$this.next().addClass('glyphicon-ok');
$this.val(speed);
setTimeout(function(){
$this.closest('.form-group').removeClass('has-success');
$this.next().removeClass('glyphicon-ok');
}, 2000);
} else if (data.status == 'na') {
} else {
$(this).closest('.form-group').addClass('has-error');
$this.next().addClass('glyphicon-remove');
setTimeout(function(){
$this.closest('.form-group').removeClass('has-error');
$this.next().removeClass('glyphicon-remove');
}, 2000);
}
},
error: function () {
$(this).closest('.form-group').addClass('has-error');
$this.next().addClass('glyphicon-remove');
setTimeout(function(){
$this.closest('.form-group').removeClass('has-error');
$this.next().removeClass('glyphicon-remove');
}, 2000);
}
});
});
$(document).ready(function() {
$('form#ignoreport').submit(function (event) {
$('#disable-toggle').click(function (event) {
+2 -2
View File
@@ -40,7 +40,7 @@
device_id: <?php echo $device['device_id']; ?>,
};
},
url: "/ajax_table.php",
url: "ajax_table.php",
formatters: {
"perc_update": function(column,row) {
return "<div class='form-group'><input type='text' class='form-control input-sm storage' data-device_id='<?php echo $device['device_id']; ?>' data-storage_id='"+row.storage_id+"' value='"+row.storage_perc_warn+"'></div>";
@@ -58,7 +58,7 @@
var $this = $(this);
$.ajax({
type: 'POST',
url: '/ajax_form.php',
url: 'ajax_form.php',
data: {type: "storage-update", device_id: device_id, data: data, storage_id: storage_id},
dataType: "json",
success: function (data) {
+2 -2
View File
@@ -61,7 +61,7 @@ if (is_module_enabled('poller', 'mib')) {
device_id: '<?php echo htmlspecialchars($device['device_id']); ?>',
};
},
url: "/ajax_table.php",
url: "ajax_table.php",
formatters: {
},
templates: {
@@ -80,7 +80,7 @@ if (is_module_enabled('poller', 'mib')) {
device_id: '<?php echo htmlspecialchars($device['device_id']); ?>',
};
},
url: "/ajax_table.php",
url: "ajax_table.php",
formatters: {
},
templates: {
+5 -5
View File
@@ -80,11 +80,11 @@ if ($config['warn']['ifdown']) {
FIXME service permissions? seem nonexisting now.. */
// Service down boxes
if (is_admin() === true || is_read() === true) {
$sql = "SELECT * FROM `services` AS S, `devices` AS D WHERE S.device_id = D.device_id AND service_status = 'down' AND D.ignore = '0' AND S.service_ignore = '0' AND `D`.`status` = '2' LIMIT ".$config['front_page_down_box_limit'];
$sql = "SELECT * FROM `services` AS S, `devices` AS D WHERE S.device_id = D.device_id AND service_status = '2' AND D.ignore = '0' AND S.service_ignore = '0' LIMIT ".$config['front_page_down_box_limit'];
$param[] = '';
}
else {
$sql = "SELECT * FROM services AS S, devices AS D, devices_perms AS P WHERE P.`user_id` = ? AND P.`device_id` = D.`device_id` AND S.`device_id` = D.`device_id` AND S.`service_ignore` = '0' AND S.`service_disabled` = '0' AND S.`service_status` = '0' AND `D`.`status` = '2' LIMIT ".$config['front_page_down_box_limit'];
$sql = "SELECT * FROM services AS S, devices AS D, devices_perms AS P WHERE P.`user_id` = ? AND P.`device_id` = D.`device_id` AND S.`device_id` = D.`device_id` AND S.`service_ignore` = '0' AND S.`service_disabled` = '0' AND S.`service_status` = '2' LIMIT ".$config['front_page_down_box_limit'];
$param[] = $_SESSION['user_id'];
}
@@ -252,8 +252,8 @@ else {
echo '</div>';
}//end if
echo '</div>';
?>
</div>
echo '
</div>
';
-1
View File
@@ -22,7 +22,6 @@ if (($tmp = dbFetchCell('SELECT dashboard FROM users WHERE user_id=?',array($_SE
$default_dash = $tmp;
}
else if (dbFetchCell('SELECT dashboard_id FROM dashboards WHERE user_id=?',array($_SESSION['user_id'])) == 0) {
$tmp = dbInsert(array('dashboard_name'=>'Default','user_id'=>$_SESSION['user_id']),'dashboards');
$vars['dashboard'] = dbInsert(array('dashboard_name'=>'Default','user_id'=>$_SESSION['user_id']),'dashboards');
if (dbFetchCell('select 1 from users_widgets where user_id = ? && dashboard_id = ?',array($_SESSION['user_id'],0)) == 1) {
dbUpdate(array('dashboard_id'=>$vars['dashboard']),'users_widgets','user_id = ? && dashboard_id = ?',array($_SESSION['user_id'],0));
+2 -22
View File
@@ -16,27 +16,8 @@ else {
$bg = '#ffffff';
}
$type_where = ' (';
foreach (explode(',', $vars['type']) as $type) {
if (is_array($config[$type.'_descr']) === false) {
$config[$type.'_descr'] = array($config[$type.'_descr']);
}
foreach ($config[$type.'_descr'] as $additional_type) {
if (!empty($additional_type)) {
$type_where .= " $or `port_descr_type` = ?";
$or = 'OR';
$type_param[] = $additional_type;
}
}
$type_where .= " $or `port_descr_type` = ?";
$or = 'OR';
$type_param[] = $type;
}
$type_where .= ') ';
$ports = dbFetchRows("SELECT * FROM `ports` as I, `devices` AS D WHERE $type_where AND I.device_id = D.device_id ORDER BY I.ifAlias", $type_param);
$types_array = explode(',', $vars['type']);
$ports = get_ports_from_type($types_array);
foreach ($ports as $port) {
$if_list .= $seperator.$port['port_id'];
@@ -45,7 +26,6 @@ foreach ($ports as $port) {
unset($seperator);
$types_array = explode(',', $vars['type']);
for ($i = 0; $i < count($types_array);
$i++) {
$types_array[$i] = ucfirst($types_array[$i]);
+1 -1
View File
@@ -41,7 +41,7 @@ if (is_module_enabled('poller', 'mib')) {
id: "device_mibs",
};
},
url: "/ajax_table.php",
url: "ajax_table.php",
formatters: {
},
templates: {
+1 -1
View File
@@ -47,7 +47,7 @@ if (is_module_enabled('poller', 'mib')) {
view: '<?php echo $vars['view']; ?>'
};
},
url: "/ajax_table.php",
url: "ajax_table.php",
formatters: {
},
templates: {
+16 -1
View File
@@ -1,6 +1,9 @@
<?php
$no_refresh = true;
$pagetitle[] = 'Poll Log';
if (isset($vars['filter'])) {
$type = $vars['filter'];
}
?>
<table id="poll-log" class="table table-condensed table-hover table-striped">
<thead>
@@ -15,12 +18,24 @@ $pagetitle[] = 'Poll Log';
<script>
searchbar = "<div id=\"{{ctx.id}}\" class=\"{{css.header}}\"><div class=\"row\">"+
"<div class=\"col-sm-9 actionBar\"><span class=\"pull-left\">"+
"<a href='<?php echo generate_url(array('page' => 'poll-log')); ?>' class='btn btn-primary btn-sm'>All devices</a> "+
"<a href='<?php echo generate_url(array('page' => 'poll-log', 'filter' => 'unpolled')); ?>' class='btn btn-danger btn-sm'>Unpolled devices</a>"+
"</div><div class=\"col-sm-3 actionBar\"><p class=\"{{css.search}}\"></p><p class=\"{{css.actions}}\"></p></div>";
var grid = $("#poll-log").bootgrid({
ajax: true,
rowCount: [50,100,250,-1],
columnSelection: false,
templates: {
header: searchbar
},
post: function ()
{
return {
id: "poll-log"
id: "poll-log",
type: "<?php echo $type;?>"
};
},
url: "ajax_table.php"
+1 -65
View File
@@ -22,6 +22,7 @@
* @subpackage Alerts
*/
include_once($config['install_dir'].'/includes/common.inc.php');
include_once($config['install_dir'].'/includes/device-groups.inc.php');
include_once($config['install_dir'].'/html/includes/authentication/'.$config['auth_mechanism'].'.inc.php');
@@ -88,71 +89,6 @@ function GenSQL($rule) {
return $sql;
}
/**
* Create a glue-chain
* @param array $tables Initial Tables to construct glue-chain
* @param string $target Glue to find (usual device_id)
* @param int $x Recursion Anchor
* @param array $hist History of processed tables
* @param array $last Glues on the fringe
* @return string|boolean
*/
function ResolveGlues($tables,$target,$x=0,$hist=array(),$last=array()) {
if( sizeof($tables) == 1 && $x != 0 ) {
if( dbFetchCell('SELECT 1 FROM information_schema.COLUMNS WHERE TABLE_NAME = ? && COLUMN_NAME = ?',array($tables[0],$target)) == 1 ) {
return array_merge($last,array($tables[0].'.'.$target));
}
else {
return false;
}
}
else {
$x++;
if( $x > 30 ) {
//Too much recursion. Abort.
return false;
}
foreach( $tables as $table ) {
$glues = dbFetchRows('SELECT COLUMN_NAME FROM information_schema.COLUMNS WHERE TABLE_NAME = ? && COLUMN_NAME LIKE "%\_id"',array($table));
if( sizeof($glues) == 1 && $glues[0]['COLUMN_NAME'] != $target ) {
//Search for new candidates to expand
$ntables = array();
list($tmp) = explode('_',$glues[0]['COLUMN_NAME'],2);
$ntables[] = $tmp;
$ntables[] = $tmp.'s';
$tmp = dbFetchRows('SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_NAME LIKE "'.substr($table,0,-1).'_%" && TABLE_NAME != "'.$table.'"');
foreach( $tmp as $expand ) {
$ntables[] = $expand['TABLE_NAME'];
}
$tmp = ResolveGlues($ntables,$target,$x++,array_merge($tables,$ntables),array_merge($last,array($table.'.'.$glues[0]['COLUMN_NAME'])));
if( is_array($tmp) ) {
return $tmp;
}
}
else {
foreach( $glues as $glue ) {
if( $glue['COLUMN_NAME'] == $target ) {
return array_merge($last,array($table.'.'.$target));
}
else {
list($tmp) = explode('_',$glue['COLUMN_NAME']);
$tmp .= 's';
if( !in_array($tmp,$tables) && !in_array($tmp,$hist) ) {
//Expand table
$tmp = ResolveGlues(array($tmp),$target,$x++,array_merge($tables,array($tmp)),array_merge($last,array($table.'.'.$glue['COLUMN_NAME'])));
if( is_array($tmp) ) {
return $tmp;
}
}
}
}
}
}
}
//You should never get here.
return false;
}
/**
* Process Macros
* @param string $rule Rule to process
+73 -7
View File
@@ -318,14 +318,16 @@ function device_by_id_cache($device_id, $refresh = '0') {
//order vrf_lite_cisco with context, this will help to get the vrf_name and instance_name all the time
$vrfs_lite_cisco = dbFetchRows("SELECT * FROM `vrf_lite_cisco` WHERE `device_id` = ?", array($device_id));
$device['vrf_lite_cisco'] = array();
if(!empty($vrfs_lite_cisco)){
$device['vrf_lite_cisco'] = array();
foreach ($vrfs_lite_cisco as $vrf){
$device['vrf_lite_cisco'][$vrf['context_name']] = $vrf;
}
}
$device['ip'] = inet6_ntop($device['ip']);
if(!empty($device['ip'])) {
$device['ip'] = inet6_ntop($device['ip']);
}
$cache['devices']['id'][$device_id] = $device;
}
return $device;
@@ -1036,13 +1038,11 @@ function version_info($remote=true) {
curl_setopt($api, CURLOPT_RETURNTRANSFER, 1);
$output['github'] = json_decode(curl_exec($api),true);
}
$output['local_sha'] = rtrim(`git rev-parse HEAD`);
list($local_sha, $local_date) = explode('|', rtrim(`git show --pretty='%H|%ci' -s HEAD`));
$output['local_sha'] = $local_sha;
$output['local_date'] = $local_date;
$output['local_branch'] = rtrim(`git rev-parse --abbrev-ref HEAD`);
exec('git diff --name-only --exit-code', $cmdoutput, $code);
$output['git_modified'] = ($code !== 0);
$output['git_modified_files'] = $cmdoutput;
$output['db_schema'] = dbFetchCell('SELECT version FROM dbSchema');
$output['php_ver'] = phpversion();
$output['mysql_ver'] = dbFetchCell('SELECT version()');
@@ -1234,3 +1234,69 @@ function get_port_id ($ports_mapped, $port, $port_association_mode) {
return $port_id;
}
/**
* Create a glue-chain
* @param array $tables Initial Tables to construct glue-chain
* @param string $target Glue to find (usual device_id)
* @param int $x Recursion Anchor
* @param array $hist History of processed tables
* @param array $last Glues on the fringe
* @return string|boolean
*/
function ResolveGlues($tables,$target,$x=0,$hist=array(),$last=array()) {
if( sizeof($tables) == 1 && $x != 0 ) {
if( dbFetchCell('SELECT 1 FROM information_schema.COLUMNS WHERE TABLE_NAME = ? && COLUMN_NAME = ?',array($tables[0],$target)) == 1 ) {
return array_merge($last,array($tables[0].'.'.$target));
}
else {
return false;
}
}
else {
$x++;
if( $x > 30 ) {
//Too much recursion. Abort.
return false;
}
foreach( $tables as $table ) {
$glues = dbFetchRows('SELECT COLUMN_NAME FROM information_schema.COLUMNS WHERE TABLE_NAME = ? && COLUMN_NAME LIKE "%\_id"',array($table));
if( sizeof($glues) == 1 && $glues[0]['COLUMN_NAME'] != $target ) {
//Search for new candidates to expand
$ntables = array();
list($tmp) = explode('_',$glues[0]['COLUMN_NAME'],2);
$ntables[] = $tmp;
$ntables[] = $tmp.'s';
$tmp = dbFetchRows('SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_NAME LIKE "'.substr($table,0,-1).'_%" && TABLE_NAME != "'.$table.'"');
foreach( $tmp as $expand ) {
$ntables[] = $expand['TABLE_NAME'];
}
$tmp = ResolveGlues($ntables,$target,$x++,array_merge($tables,$ntables),array_merge($last,array($table.'.'.$glues[0]['COLUMN_NAME'])));
if( is_array($tmp) ) {
return $tmp;
}
}
else {
foreach( $glues as $glue ) {
if( $glue['COLUMN_NAME'] == $target ) {
return array_merge($last,array($table.'.'.$target));
}
else {
list($tmp) = explode('_',$glue['COLUMN_NAME']);
$tmp .= 's';
if( !in_array($tmp,$tables) && !in_array($tmp,$hist) ) {
//Expand table
$tmp = ResolveGlues(array($tmp),$target,$x++,array_merge($tables,array($tmp)),array_merge($last,array($table.'.'.$glue['COLUMN_NAME'])));
if( is_array($tmp) ) {
return $tmp;
}
}
}
}
}
}
}
//You should never get here.
return false;
}
+3 -3
View File
@@ -138,11 +138,11 @@ $config['old_graphs'] = 1;
$config['int_customers'] = 1;
// Enable Customer Port Parsing
$config['customers_descr'] = 'cust';
$config['transit_descr'] = '';
$config['transit_descr'] = 'transit';
// Add custom transit descriptions (can be an array)
$config['peering_descr'] = '';
$config['peering_descr'] = 'peering';
// Add custom peering descriptions (can be an array)
$config['core_descr'] = '';
$config['core_descr'] = 'core';
// Add custom core descriptions (can be an array)
$config['custom_descr'] = '';
// Add custom interface descriptions (can be an array)
+96 -1
View File
@@ -423,6 +423,19 @@ $config['os'][$os]['over'][1]['text'] = 'CPU Usage';
$config['os'][$os]['over'][2]['graph'] = 'device_mempool';
$config['os'][$os]['over'][2]['text'] = 'Memory Usage';
$os = 'acs';
$config['os'][$os]['group'] = "cisco";
$config['os'][$os]['text'] = 'Cisco ACS';
$config['os'][$os]['ifname'] = 1;
$config['os'][$os]['type'] = 'server';
$config['os'][$os]['icon'] = 'cisco';
$config['os'][$os]['over'][0]['graph'] = 'device_bits';
$config['os'][$os]['over'][0]['text'] = 'Device Traffic';
$config['os'][$os]['over'][1]['graph'] = 'device_processor';
$config['os'][$os]['over'][1]['text'] = 'CPU Usage';
$config['os'][$os]['over'][2]['graph'] = 'device_mempool';
$config['os'][$os]['over'][2]['text'] = 'Memory Usage';
$os = 'cat1900';
$config['os'][$os]['group'] = 'cat1900';
$config['os'][$os]['text'] = 'Cisco Catalyst 1900';
@@ -583,6 +596,14 @@ $config['os'][$os]['text'] = 'Huawei VRP';
$config['os'][$os]['type'] = 'network';
$config['os'][$os]['icon'] = 'huawei';
// Huawei access products
$os = 'smartax';
$config['os'][$os]['group'] = 'huawei';
$config['os'][$os]['text'] = 'Huawei SmartAX';
$config['os'][$os]['type'] = 'network';
$config['os'][$os]['icon'] = 'huawei';
$config['os'][$os]['ifname'] = 1;
// ZTE
$os = 'zxr10';
$config['os'][$os]['group'] = 'zxr10';
@@ -742,6 +763,50 @@ $config['os'][$os]['over'][1]['text'] = 'CPU Usage';
$config['os'][$os]['over'][2]['graph'] = 'device_mempool';
$config['os'][$os]['over'][2]['text'] = 'Memory Usage';
$os = 'swos';
$config['os'][$os]['text'] = 'Mikrotik SwOS';
$config['os'][$os]['type'] = 'network';
$config['os'][$os]['nobulk'] = 1;
$config['os'][$os]['over'][0]['graph'] = 'device_bits';
$config['os'][$os]['over'][0]['text'] = 'Device Traffic';
$config['os'][$os]['over'][1]['graph'] = 'device_processor';
$config['os'][$os]['over'][1]['text'] = 'CPU Usage';
$config['os'][$os]['over'][2]['graph'] = 'device_mempool';
$config['os'][$os]['over'][2]['text'] = 'Memory Usage';
$os = 'binos';
$config['os'][$os]['text'] = 'Telco Systems BiNOS';
$config['os'][$os]['type'] = 'network';
$config['os'][$os]['icon'] = 'telco-systems';
$config['os'][$os]['over'][0]['graph'] = 'device_bits';
$config['os'][$os]['over'][0]['text'] = 'Device Traffic';
$config['os'][$os]['over'][1]['graph'] = 'device_processor';
$config['os'][$os]['over'][1]['text'] = 'CPU Usage';
$config['os'][$os]['over'][2]['graph'] = 'device_mempool';
$config['os'][$os]['over'][2]['text'] = 'Memory Usage';
$os = 'binox';
$config['os'][$os]['text'] = 'Telco Systems BiNOX';
$config['os'][$os]['type'] = 'network';
$config['os'][$os]['icon'] = 'telco-systems';
$config['os'][$os]['over'][0]['graph'] = 'device_bits';
$config['os'][$os]['over'][0]['text'] = 'Device Traffic';
$config['os'][$os]['over'][1]['graph'] = 'device_processor';
$config['os'][$os]['over'][1]['text'] = 'CPU Usage';
$config['os'][$os]['over'][2]['graph'] = 'device_mempool';
$config['os'][$os]['over'][2]['text'] = 'Memory Usage';
$os = 'adtran-aos';
$config['os'][$os]['text'] = 'Adtran AOS';
$config['os'][$os]['type'] = 'network';
$config['os'][$os]['icon'] = 'adtran';
$config['os'][$os]['over'][0]['graph'] = 'device_bits';
$config['os'][$os]['over'][0]['text'] = 'Device Traffic';
$config['os'][$os]['over'][1]['graph'] = 'device_processor';
$config['os'][$os]['over'][1]['text'] = 'CPU Usage';
$config['os'][$os]['over'][2]['graph'] = 'device_mempool';
$config['os'][$os]['over'][2]['text'] = 'Memory Usage';
$os = 'bintec-smart';
$config['os'][$os]['text'] = 'Bintec Smart Router';
$config['os'][$os]['type'] = 'network';
@@ -753,6 +818,17 @@ $config['os'][$os]['over'][1]['text'] = 'CPU Usage';
$config['os'][$os]['over'][2]['graph'] = 'device_mempool';
$config['os'][$os]['over'][2]['text'] = 'Memory Usage';
$os = 'aen';
$config['os'][$os]['text'] = 'Accedian AEN';
$config['os'][$os]['type'] = 'network';
$config['os'][$os]['icon'] = 'accedian';
$config['os'][$os]['over'][0]['graph'] = 'device_bits';
$config['os'][$os]['over'][0]['text'] = 'Device Traffic';
$config['os'][$os]['over'][1]['graph'] = 'device_processor';
$config['os'][$os]['over'][1]['text'] = 'CPU Usage';
$config['os'][$os]['over'][2]['graph'] = 'device_mempool';
$config['os'][$os]['over'][2]['text'] = 'Memory Usage';
$os = 'ironware';
$config['os'][$os]['text'] = 'Brocade IronWare';
$config['os'][$os]['type'] = 'network';
@@ -933,6 +1009,20 @@ $config['os'][$os]['over'][2]['text'] = 'Memory Usage';
$config['os'][$os]['over'][3]['graph'] = 'device_storage';
$config['os'][$os]['over'][3]['text'] = 'Storage Usage';
// EMC FlareOS
$os = 'flareos';
$config['os'][$os]['text'] = 'EMC CLARiiON';
$config['os'][$os]['type'] = 'storage';
$config['os'][$os]['icon'] = 'emc';
$config['os'][$os]['over'][0]['graph'] = 'device_bits';
$config['os'][$os]['over'][0]['text'] = 'Device Traffic';
$config['os'][$os]['over'][1]['graph'] = 'device_processor';
$config['os'][$os]['over'][1]['text'] = 'CPU Usage';
$config['os'][$os]['over'][2]['graph'] = 'device_mempool';
$config['os'][$os]['over'][2]['text'] = 'Memory Usage';
$config['os'][$os]['over'][3]['graph'] = 'device_storage';
$config['os'][$os]['over'][3]['text'] = 'Storage Usage';
$os = 'equallogic';
$config['os'][$os]['text'] = 'Dell EqualLogic';
$config['os'][$os]['icon'] = 'dell';
@@ -1622,7 +1712,7 @@ $config['os'][$os]['over'][0]['text'] = 'Traffic';
$os = 'macosx';
$config['os'][$os]['text'] = 'Apple OS X';
$config['os'][$os]['type'] = 'server';
$config['os'][$os]['icon'] = 'generic';
$config['os'][$os]['icon'] = 'apple';
$config['os'][$os]['over'][0]['graph'] = 'device_bits';
$config['os'][$os]['over'][0]['text'] = 'Traffic';
@@ -1711,6 +1801,11 @@ $config['os'][$os]['text'] = 'Infoblox';
$config['os'][$os]['type'] = 'appliance';
$config['os'][$os]['icon'] = 'infoblox';
$os = 'ibm-amm';
$config['os'][$os]['text'] = 'IBM AMM';
$config['os'][$os]['type'] = 'appliance';
$config['os'][$os]['icon'] = 'ibmnos';
// Oracle ILOM
$os = 'oracle-ilom';
$config['os'][$os]['text'] = 'Oracle ILOM';
+39 -16
View File
@@ -25,6 +25,7 @@
* @subpackage Devices
*/
include_once($config['install_dir'].'/includes/common.inc.php');
/**
* Add a new device group
@@ -97,26 +98,50 @@ function GenGroupSQL($pattern, $search='',$extra=0) {
$pattern = rtrim($pattern, '||');
$tables = array_keys(array_flip($tables));
$x = sizeof($tables);
$i = 0;
$join = '';
while ($i < $x) {
if (isset($tables[($i + 1)])) {
$join .= $tables[$i].'.device_id = '.$tables[($i + 1)].'.device_id && ';
if( dbFetchCell('SELECT 1 FROM information_schema.COLUMNS WHERE TABLE_NAME = ? && COLUMN_NAME = ?',array($tables[0],'device_id')) != 1 ) {
//Our first table has no valid glue, append the 'devices' table to it!
array_unshift($tables, 'devices');
}
$x = sizeof($tables)-1;
$i = 0;
$join = "";
while( $i < $x ) {
if( isset($tables[$i+1]) ) {
$gtmp = ResolveGlues(array($tables[$i+1]),'device_id');
if( $gtmp === false ) {
//Cannot resolve glue-chain. Rule is invalid.
return false;
}
$last = "";
$qry = "";
foreach( $gtmp as $glue ) {
if( empty($last) ) {
list($tmp,$last) = explode('.',$glue);
$qry .= $glue.' = ';
}
else {
list($tmp,$new) = explode('.',$glue);
$qry .= $tmp.'.'.$last.' && '.$tmp.'.'.$new.' = ';
$last = $new;
}
if( !in_array($tmp, $tables) ) {
$tables[] = $tmp;
}
}
$join .= "( ".$qry.$tables[0].".device_id ) && ";
}
$i++;
}
if (!empty($search)) {
$search .= ' &&';
}
$sql_extra = '';
if ($extra === 1) {
$sql_extra = ",`devices`.*";
}
$sql = 'SELECT DISTINCT('.str_replace('(', '', $tables[0]).'.device_id)'.$sql_extra.' FROM '.implode(',', $tables).' WHERE '.$search.' ('.str_replace(array('%', '@', '!~', '~'), array('', '.*', 'NOT REGEXP', 'REGEXP'), $pattern).')';
if (!empty($search)) {
$search = str_replace("(","",$tables[0]).'.'.$search. ' AND';
}
if (!empty($join)) {
$join = '('.rtrim($join, ' && ').') &&';
}
$sql = 'SELECT DISTINCT('.str_replace('(', '', $tables[0]).'.device_id)'.$sql_extra.' FROM '.implode(',', $tables).' WHERE '.$join.' '.$search.' ('.str_replace(array('%', '@', '!~', '~'), array('', '.*', 'NOT REGEXP', 'REGEXP'), $pattern).')';
return $sql;
}//end GenGroupSQL()
@@ -236,8 +261,6 @@ function RunGroupMacros($rule,$x=1) {
*/
function UpdateGroupsForDevice($device_id)
{
global $debug;
$debug = true;
$queried_groups = QueryGroupsFromDevice($device_id);
$db_groups = GetGroupsFromDevice($device_id);
-2
View File
@@ -2,8 +2,6 @@
unset($mac_table);
echo 'ARP Table : ';
if( key_exists('vrf_lite_cisco', $device) && (count($device['vrf_lite_cisco'])!=0) ){
$vrfs_lite_cisco = $device['vrf_lite_cisco'];
}
+2 -3
View File
@@ -1,7 +1,6 @@
<?php
if ($config['enable_bgp']) {
// Discover BGP peers
echo 'BGP Sessions : ';
if( key_exists('vrf_lite_cisco', $device) && (count($device['vrf_lite_cisco'])!=0) ){
$vrfs_lite_cisco = $device['vrf_lite_cisco'];
@@ -139,7 +138,7 @@ if ($config['enable_bgp']) {
$bgp_ip = str_replace('"', '', str_replace(' ', '', $bgp_ip));
if ($afi && $safi && $bgp_ip == $peer['ip']) {
$af_list[$bgp_ip][$afi][$safi] = 1;
if (dbFetchCell('SELECT COUNT(*) from `bgpPeers_cbgp` WHERE device_id = ? AND bgpPeerIdentifier = ?, AND afi=? AND safi=?', array($device['device_id'], $peer['ip'], $afi, $safi)) == 0) {
if (dbFetchCell('SELECT COUNT(*) from `bgpPeers_cbgp` WHERE device_id = ? AND bgpPeerIdentifier = ? AND afi=? AND safi=?', array($device['device_id'], $peer['ip'], $afi, $safi)) == 0) {
dbInsert(array('device_id' => $device['device_id'], 'bgpPeerIdentifier' => $peer['ip'], 'afi' => $afi, 'safi' => $safi, 'context_name' => $device['context_name']), 'bgpPeers_cbgp');
}
}
@@ -190,7 +189,7 @@ if ($config['enable_bgp']) {
list ($afi,$safi) = explode('.', $afisafi);
$safi = $safis[$safi];
$af_list[$afi][$safi] = 1;
if (dbFetchCell('SELECT COUNT(*) from `bgpPeers_cbgp` WHERE device_id = ? AND bgpPeerIdentifier = ?, AND afi=? AND safi=?', array($device['device_id'], $peer['ip'], $afi, $safi)) == 0) {
if (dbFetchCell('SELECT COUNT(*) from `bgpPeers_cbgp` WHERE device_id = ? AND bgpPeerIdentifier = ? AND afi=? AND safi=?', array($device['device_id'], $peer['ip'], $afi, $safi)) == 0) {
dbInsert(array('device_id' => $device['device_id'], 'bgpPeerIdentifier' => $peer['ip'], 'afi' => $afi, 'safi' => $safi), 'bgpPeers_cbgp');
}
}
-1
View File
@@ -14,7 +14,6 @@
if ($device['os_group'] == 'cisco') {
$module = 'Cisco-CBQOS';
echo $module.': ';
require_once 'includes/component.php';
$component = new component();
-2
View File
@@ -1,7 +1,5 @@
<?php
echo 'Cisco CEF Switching Path: ';
$cefs = array();
$cefs = snmpwalk_cache_threepart_oid($device, 'CISCO-CEF-MIB::cefSwitchingPath', $cefs);
d_echo($cefs);
@@ -1,7 +1,6 @@
<?php
if ($device['os_group'] == 'cisco') {
echo 'Cisco MAC Accounting : ';
$datas = shell_exec($config['snmpbulkwalk'].' -M '.$config['mibdir'].' -m CISCO-IP-STAT-MIB -Oqn '.snmp_gen_auth($device).' '.$device['hostname'].' cipMacSwitchedBytes');
// echo("$datas\n");
-1
View File
@@ -58,7 +58,6 @@ if ($device['os_group'] == 'cisco') {
$error_overlay[6] = "destroy";
$module = 'Cisco-OTV';
echo $module.': ';
require_once 'includes/component.php';
$component = new component();
-2
View File
@@ -4,8 +4,6 @@ if ($config['enable_pseudowires'] && $device['os_group'] == 'cisco') {
unset($cpw_count);
unset($cpw_exists);
echo 'Cisco Pseudowires : ';
// Pre-cache the existing state of pseudowires for this device from the database
$pws_db_raw = dbFetchRows('SELECT * FROM `pseudowires` WHERE `device_id` = ?', array($device['device_id']));
foreach ($pws_db_raw as $pw_db) {
-1
View File
@@ -1,7 +1,6 @@
<?php
if ($config['enable_sla'] && $device['os_group'] == 'cisco') {
echo 'SLAs : ';
$slas = snmp_walk($device, 'ciscoRttMonMIB.ciscoRttMonObjects.rttMonCtrl', '-Osq', '+CISCO-RTTMON-MIB');
@@ -24,7 +24,6 @@ if ($config['enable_vrf_lite_cisco']) {
// For the moment only will be cisco and the version 3
if ($device['os_group'] == "cisco" && $device['snmpver'] == 'v3') {
echo ("VRF lite cisco : \n");
$mib = "SNMP-COMMUNITY-MIB";
$mib = "CISCO-CONTEXT-MAPPING-MIB";
//-Osq because if i put the n the oid from the first command is not the same of this one
-2
View File
@@ -5,8 +5,6 @@ if ($config['enable_vrfs']) {
if ($device['os_group'] == 'cisco' || $device['os_group'] == 'junos' || $device['os'] == 'ironware') {
unset($vrf_count);
echo 'VRFs : ';
/*
There are 2 MIBs for VPNs : MPLS-VPN-MIB (oldest) and MPLS-L3VPN-STD-MIB (newest)
Unfortunately, there is no simple way to find out which one to use, unless we reference
-2
View File
@@ -13,8 +13,6 @@
// License: GPLv3
//
echo 'ARP Discovery: ';
$hostname = $device['hostname'];
$deviceid = $device['device_id'];
@@ -1,7 +1,5 @@
<?php
echo 'Discovery protocols:';
global $link_exists;
$community = $device['community'];
@@ -1,7 +1,6 @@
<?php
if ($config['enable_inventory']) {
echo 'Physical Inventory : ';
echo "\nCaching OIDs:";
+16 -13
View File
@@ -106,23 +106,26 @@ function discover_device($device, $options = null) {
// If we've specified modules, use them, else walk the modules array
if ($options['m']) {
$config['discovery_modules'] = array();
foreach (explode(',', $options['m']) as $module) {
if (is_file("includes/discovery/$module.inc.php")) {
include "includes/discovery/$module.inc.php";
$config['discovery_modules'][$module] = 1;
}
}
} else {
foreach ($config['discovery_modules'] as $module => $module_status) {
if ($attribs['discover_' . $module] || ( $module_status && !isset($attribs['discover_' . $module]))) {
$module_start = microtime(true);
include 'includes/discovery/' . $module . '.inc.php';
$module_time = microtime(true) - $module_start;
echo "Runtime for discovery module '$module': $module_time\n";
} else if (isset($attribs['discover_' . $module]) && $attribs['discover_' . $module] == '0') {
echo "Module [ $module ] disabled on host.\n";
} else {
echo "Module [ $module ] disabled globally.\n";
}
}
foreach ($config['discovery_modules'] as $module => $module_status) {
if ($attribs['discover_' . $module] || ( $module_status && !isset($attribs['discover_' . $module]))) {
$module_start = microtime(true);
echo "#### Load disco module $module ####\n";
include "includes/discovery/$module.inc.php";
$module_time = microtime(true) - $module_start;
$module_time = substr($module_time, 0, 5);
echo "\n>> Runtime for discovery module '$module': $module_time seconds\n";
echo "#### Unload disco module $module ####\n\n";
} else if (isset($attribs['discover_' . $module]) && $attribs['discover_' . $module] == '0') {
echo "Module [ $module ] disabled on host.\n\n";
} else {
echo "Module [ $module ] disabled globally.\n\n";
}
}
-2
View File
@@ -1,7 +1,5 @@
<?php
echo 'hrDevice : ';
$hrDevice_oids = array(
'hrDeviceEntry',
'hrProcessorEntry',
+1 -2
View File
@@ -1,6 +1,5 @@
<?php
echo 'IPv4 Addresses : ';
if( key_exists('vrf_lite_cisco', $device) && (count($device['vrf_lite_cisco'])!= 0) ){
$vrfs_lite_cisco = $device['vrf_lite_cisco'];
}
@@ -72,4 +71,4 @@ foreach ($vrfs_lite_cisco as $vrf) {
unset($device['context_name']);
unset($valid_v4);
}
unset($vrfs_c);
unset($vrfs_c);
+1 -2
View File
@@ -1,6 +1,5 @@
<?php
echo 'IPv6 Addresses : ';
if( key_exists('vrf_lite_cisco', $device) && (count($device['vrf_lite_cisco'])!=0) ){
$vrfs_lite_cisco = $device['vrf_lite_cisco'];
}
@@ -86,4 +85,4 @@ foreach ($vrfs_lite_cisco as $vrf) {
echo "\n";
unset($device['context_name']);
}
unset($vrfs_c);
unset($vrfs_c);
-1
View File
@@ -4,7 +4,6 @@
// snmpwalk -v2c -c <community> <hostname> -M mibs/junose/ -m Juniper-UNI-ATM-MIB juniAtmVpStatsEntry
// JunOSe ATM vps
if ($device['os'] == 'junose' && $config['enable_ports_junoseatmvp']) {
echo 'JunOSe ATM vps : ';
$vp_array = snmpwalk_cache_multi_oid($device, 'juniAtmVpStatsInCells', $vp_array, 'Juniper-UNI-ATM-MIB', $config['install_dir'].'/mibs/junose');
$valid_vp = array();
d_echo($vp_array);
@@ -5,8 +5,6 @@
if ($config['enable_libvirt'] == '1' && $device['os'] == 'linux') {
$libvirt_vmlist = array();
echo 'Libvirt VM: ';
$ssh_ok = 0;
$userHostname = $device['hostname'];
-2
View File
@@ -1,7 +1,5 @@
<?php
echo 'Memory : ';
// Include all discovery modules
$include_dir = 'includes/discovery/mempools';
require 'includes/include-dir.inc.php';
+30
View File
@@ -0,0 +1,30 @@
<?php
/*
* LibreNMS Telco Systems RAM discovery module
*
* Copyright (c) 2016 Chris A. Evans <thecityofguanyu@outlook.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'] == "binox") {
echo("telco systems: ");
$used = snmp_get($device, ".1.3.6.1.4.1.738.10.111.3.1.3.0", "-Ovq");
$used = str_replace('%', '', $used);
$used = str_replace('"', '', $used);
$total = "100";
$free = ($total - $used);
$percent = $used;
if (is_numeric($used)) {
discover_mempool($valid_mempool, $device, 0, "binox", "Memory", "1", NULL, NULL);
}
}
@@ -0,0 +1,12 @@
<?php
if ($device['os'] == 'ciscowlc') {
echo 'Cisco WLC';
$total = str_replace('"', "", snmp_get($device, "1.3.6.1.4.1.14179.1.1.5.3.0", '-OvQ'));
$avail = str_replace('"', "", snmp_get($device, "1.3.6.1.4.1.14179.1.1.5.2.0", '-OvQ'));
if ((is_numeric($total)) && (is_numeric($avail))) {
discover_mempool($valid_mempool, $device, 0, 'ciscowlc', 'Memory', '1', null, null);
}
}
-2
View File
@@ -1,7 +1,5 @@
<?php
echo 'OS: ';
$os = getHostOS($device);
if ($os != $device['os']) {
log_event('Device OS changed '.$device['os']." => $os", $device, 'system');
+8
View File
@@ -0,0 +1,8 @@
<?php
if (!$os) {
if (strstr($sysObjectId, '.1.3.6.1.4.1.9.1.1117')) {
$os = 'acs';
}
}
+23
View File
@@ -0,0 +1,23 @@
<?php
/*
* LibreNMS ADTRAN AOS OS Discovery module
*
* Copyright (c) 2016 Chris A. Evans <thecityofguanyu@outlook.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 (preg_match('/NetVanta/', $sysDescr)) {
$os = 'adtran-aos';
}
elseif (strstr($sysObjectId, '.1.3.6.1.4.1.664')) {
$os = 'adtran-aos';
}
}
+20
View File
@@ -0,0 +1,20 @@
<?php
/*
* LibreNMS Acceidan MetroNID OS Discovery module
*
* Copyright (c) 2016 Chris A. Evans <thecityofguanyu@outlook.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 (preg_match('/AMN-/', $sysDescr)) {
$os = 'aen';
}
}
+9 -36
View File
@@ -10,44 +10,17 @@ if (!$os) {
$os = 'aos';
}
}
if (strpos($sysObjectId, '.1.3.6.1.4.1.6486.801') !== false) {
elseif (strpos($sysObjectId, '.1.3.6.1.4.1.6486.801') !== false) {
$os = 'aos';
}
if (strpos($sysObjectId, '.1.3.6.1.4.1.6527.1.3') !== false) {
elseif (
strpos($sysObjectId, '.1.3.6.1.4.1.6527.1.3') !== false
|| strpos($sysObjectId, '.1.3.6.1.4.1.6527.6.2.1.2.2.') !== false // TiMOS-B-2.0.R3 both/mpc ALCATEL SAS-M 7210
|| strpos($sysObjectId, '.1.3.6.1.4.1.6527.1.6.1') !== false // TiMOS-B-6.1.R14 both/hops ALCATEL ESS 7450
|| strpos($sysObjectId, '.1.3.6.1.4.1.6527.6.1.1.2.') !== false // TiMOS-B-6.0.R2 both/hops ALCATEL-LUCENT SAR 7705
|| strpos($sysObjectId, '.1.3.6.1.4.1.6527.1.9.1') !== false // TiMOS-B-6.1.R14 both/hops ALCATEL SR 7710
|| strpos($sysObjectId, '.1.3.6.1.4.1.6527.1.15.') !== false // TiMOS-C-12.0.R16 cpm/hops64 ALCATEL XRS 7950
) {
$os = 'timos';
}
// FIXME: make these less specific.
// TiMOS-B-6.1.R14 both/hops ALCATEL ESS 7450
if (strpos($sysObjectId, '.1.3.6.1.4.1.6527.1.6.1') !== false) {
$os = 'timos';
}
// TiMOS-B-2.0.R3 both/mpc ALCATEL SAS-M 7210
if (strpos($sysObjectId, '.1.3.6.1.4.1.6527.6.2.1.2.2.1') !== false) {
$os = 'timos';
}
// TiMOS-B-6.1.R14 both/hops ALCATEL SR 7710
if (strpos($sysObjectId, '.1.3.6.1.4.1.6527.1.9.1') !== false) {
$os = 'timos';
}
// TiMOS-B-6.0.R2 both/hops ALCATEL-LUCENT SAR 7705
if (strpos($sysObjectId, '.1.3.6.1.4.1.6527.6.1.1.2.1') !== false) {
$os = 'timos';
}
// TiMOS-B-6.1.R7 both/hops ALCATEL-LUCENT SAR 7705
if (strpos($sysObjectId, '.1.3.6.1.4.1.6527.6.1.1.2.2') !== false) {
$os = 'timos';
}
// TiMOS-B-7.0.R5 both/hops ALCATEL SAR 7705
if (strpos($sysObjectId, '.1.3.6.1.4.1.6527.6.1.1.2.5') !== false) {
$os = 'timos';
}
// TiMOS-B-6.0.R2 both/hops ALCATEL-LUCENT SAR 7705
if (strpos($sysObjectId, '.1.3.6.1.4.1.6527.6.1.1.2.6') !== false) {
$os = 'timos';
}
}//end if
+20
View File
@@ -0,0 +1,20 @@
<?php
/*
* LibreNMS Telco Systems OS discovery module
*
* Copyright (c) 2016 Chris A. Evans <thecityofguanyu@outlook.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.738.1.5.100')) {
$os = 'binos';
}
}
+20
View File
@@ -0,0 +1,20 @@
<?php
/*
* LibreNMS Telco Systems OS discovery module
*
* Copyright (c) 2016 Chris A. Evans <thecityofguanyu@outlook.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.738.10.5.100')) {
$os = 'binox';
}
}
+8 -1
View File
@@ -25,5 +25,12 @@ if (!$os) {
//Dell N4064F
$os = 'dnos';
}
if (strstr($sysObjectId, '.1.3.6.1.4.1.674.10895.3058')) {
//Dell N3048P
$os = 'dnos';
}
if (strstr($sysObjectId, '.1.3.6.1.4.1.674.10895.3060')) {
//Dell N3024P
$os = 'dnos';
}
}
+1 -5
View File
@@ -1,11 +1,7 @@
<?php
if (!$os) {
if (strstr($sysObjectId, '.1.3.6.1.4.1.1588.2.1.1.1')) {
$os = 'fabos';
}
if (strstr($sysObjectId, '.1.3.6.1.4.1.1588.2.1.1.1')) {
if (strstr($sysObjectId, '.1.3.6.1.4.1.1588.2.1.1.1') || strstr($sysObjectId, '.1.3.6.1.4.1.1588.2.1.1.43')) {
$os = 'fabos';
}
}
+17
View File
@@ -0,0 +1,17 @@
<?php
/*
* LibreNMS
*
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
if (!$os) {
if (strstr($sysObjectId, '.1.3.6.1.4.1.1981.1.1')) {
$os = 'flareos';
}
}
+17
View File
@@ -0,0 +1,17 @@
<?php
/*
* LibreNMS IBM NOS information module
*
* Copyright (c) 2015 Søren Friis Rosiak <sorenrosiak@gmail.com>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
if (!$os) {
if (stristr($sysDescr, 'BladeCenter Advanced Management Module')) {
$os = 'ibm-amm';
}
}
+3 -3
View File
@@ -69,9 +69,9 @@ if (!$os) {
elseif (stristr($sysObjectId, 'cumulusMib') || strstr($sysObjectId, '.1.3.6.1.4.1.40310')) {
$os = 'cumulus';
}
// elseif (strstr($sysObjectId, '.1.3.6.1.4.1.8072.3.2.10')) {
// $os = 'sophos';
// }
elseif (strstr($sysDescr, 'g56fa85e') || strstr($sysDescr, 'gc80f187') || strstr($sysDescr, 'g829be90') || strstr($sysDescr, 'g63c0044')) {
$os = 'sophos';
}
else {
// Check for Synology DSM
$hrSystemInitialLoadParameters = trim(snmp_get($device, 'HOST-RESOURCES-MIB::hrSystemInitialLoadParameters.0', '-Osqnv'));
+2 -1
View File
@@ -10,7 +10,8 @@
* the source code distribution for details.
*/
if (!$os) {
if (strpos($sysObjectId, '1.3.6.1.4.1.8072.3.2.16') !== false) {
if (strpos($sysObjectId, '1.3.6.1.4.1.8072.3.2.16') !== false ||
preg_match('/Darwin Kernel Version 15/', $sysDescr)) {
$os = 'macosx';
}
}
-4
View File
@@ -15,10 +15,6 @@ if (!$os) {
$os = 'routeros';
}
if ($sysDescr == 'RB260GS') {
$os = 'routeros';
}
// poll Cisco AAA MIB
if (!empty($os)) {
$extra_mibs = array(
+2 -2
View File
@@ -6,8 +6,8 @@ if (!$os) {
// ServerTech doesn't have a way to distinguish between sentry3 and sentry4 devices
// Hopefully, we can use the version string to figure it out
$version = trim(snmp_get($device, 'Sentry3-MIB::serverTech.4.1.1.1.3.0', '-Osqnv'));
$version = explode(" ", $version)[1];
$version = intval($version);
$version = explode(" ", $version);
$version = intval($version[1]);
// It appears that version 8 and up is good for sentry4
if ($version >= 8) {
+30
View File
@@ -0,0 +1,30 @@
<?php
/**
* smartax.inc.php
*
* Huawei Access products
*
* 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2016 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
if (!$os) {
if (strpos($sysDescr, 'Huawei Integrated Access Software') !== false) {
$os = 'smartax';
}
}
+7
View File
@@ -0,0 +1,7 @@
<?php
if (!$os) {
if (is_numeric(snmp_get($device, 'SNMPv2-SMI::enterprises.14988.2', '-Oqv', ''))) {
$os = 'swos';
}
}
-2
View File
@@ -1,7 +1,5 @@
<?php
echo 'Port Stack: ';
$sql = "SELECT * FROM `ports_stack` WHERE `device_id` = '".$device['device_id']."'";
foreach (dbFetchRows($sql) as $entry) {
-2
View File
@@ -1,7 +1,5 @@
<?php
echo 'Processors : ';
// Include all discovery modules
$include_dir = 'includes/discovery/processors';
require 'includes/include-dir.inc.php';
@@ -0,0 +1,27 @@
<?php
/*
* LibreNMS ADTRAN AOS Processor Discovery module
*
* Copyright (c) 2016 Chris A. Evans <thecityofguanyu@outlook.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'] == 'adtran-aos') {
echo 'ADTRAN AOS:';
$descr = 'Processor';
$usage = snmp_get($device, '.1.3.6.1.4.1.664.5.53.1.4.1.0', '-Ovq');
echo "This is the CP info AAAA $usage AAAA";
if (is_numeric($usage)) {
discover_processor($valid['processor'], $device, '.1.3.6.1.4.1.664.5.53.1.4.1.0', '0', 'adtran-aos', $descr, '1', $usage, null, null);
}
}

Some files were not shown because too many files have changed in this diff Show More