Merge remote-tracking branch 'upstream/master' into rrd-create-remote

This commit is contained in:
Tony Murray
2016-07-26 19:29:11 -05:00
55 changed files with 5762 additions and 162 deletions

View File

@@ -2,7 +2,9 @@
> Please read this information and delete it once ready.
If you issue is a request for us to add a new device then please ensure you provide the following information as pastebin links.
- Ensure that your install is upto date before submitting an issue. You can ensure you are upto date by running `./daily.sh` as the librenms user. If you experience errors updating then please run `./validate.php`.
- If your issue is a request for us to add a new device then please ensure you provide the following information as pastebin links.
Please replace the relevant information in these commands.
@@ -13,5 +15,3 @@ snmpbulkwalk -On -v2c -c COMMUNITY HOSTNAME .
```
If possible please also provide what the OS name should be if it doesn't exist already.

View File

@@ -111,6 +111,7 @@ LibreNMS contributors:
- Benjamin Busche <benjamin.busche@gmail.com> (optic00)
- Brandon Boudrias <bt.boudrias@gmail.com> (brandune)
- Andy Noyland <andrew@noyland.co.uk> (Zappatron)
- Cercel Valentin <crc@nuamchefazi.ro> (crcro)
[1]: http://observium.org/ "Observium web site"
Observium was written by:

View File

@@ -38,10 +38,20 @@ if [ -z "$arg" ]; then
exit
elif [ "$up" -eq 1 ]; then
# Update to Master-Branch
old_ver=$(git show --pretty="%H" -s HEAD)
status_run 'Updating to latest codebase' 'git pull --quiet'
new_ver=$(git show --pretty="%H" -s HEAD)
if [ "$old_ver" != "$new_ver" ]; then
status_run "Updated from $old_ver to $new_ver" ''
fi
elif [ "$up" -eq 3 ]; then
# Update to last Tag
old_ver=$(git describe --exact-match --tags $(git log -n1 --pretty='%h'))
status_run 'Updating to latest release' 'git fetch --tags && git checkout $(git describe --tags $(git rev-list --tags --max-count=1))'
new_ver=$(git describe --exact-match --tags $(git log -n1 --pretty='%h'))
if [ "$old_ver" -ne "$new_ver" ]; then
status_run "Updated from $old_ver to $new_ver" ''
fi
fi
cnf=$(echo $(grep '\[.distributed_poller.\]' config.php | egrep -v -e '^//' -e '^#' | cut -d = -f 2 | sed 's/;//g'))

View File

@@ -133,3 +133,15 @@ location /nginx-status {
}
```
### PowerDNS Recursor
A recursive DNS sever: https://www.powerdns.com/recursor.html
#### Direct Connection
The LibreNMS polling host must be able to connect to port 8082 on the monitored device.
The web-server must be enabled, see the Recursor docs: https://doc.powerdns.com/md/recursor/settings/#webserver
There is currently no way to specify a custom port or password.
#### Agent
Copy powerdns-recursor to the `/usr/lib/check_mk_agent/local` directory.
The user check_mk is running as must be able to run `rec_control get-all`

View File

@@ -23,7 +23,7 @@ Table of Content:
The Component extension provides a generic database storage mechanism for discovery and poller modules.
The Driver behind this extension was to provide the features of ports, in a generic manner to discovery/poller modules.
It provides a status (Normal or Alert), the ability to Disable (do not poll), or Ignore (do not Alert).
It provides a status (Nagios convention), the ability to Disable (do not poll), or Ignore (do not Alert).
# <a name="database">Database Structure</a>
@@ -282,18 +282,23 @@ Please see the [API-Docs](http://docs.librenms.org/API/API-Docs/#api-route-25) f
## <a name="alert">Alerting</a>
It is intended that discovery/poller modules will detect the status of a component during the polling cycle.
If you are creating a poller module which can detect a fault condition simply set STATUS to 0 and ERROR to a message that indicates the problem.
Status is logged using the Nagios convention for status codes, where:
0 = Ok,
1 = Warning,
2 = Critical
If you are creating a poller module which can detect a fault condition simply set STATUS to something other than 0 and ERROR to a message that indicates the problem.
To actually raise an alert, the user will need to create an alert rule. To assist with this several Alerting Macro's have been created:
- ```%macro.component_alert``` - A component that is not disabled or ignored and in alert state.
- ```%macro.component_normal``` - A component that is not disabled or ignored and NOT in alert state.
- ```%macro.component_normal``` - A component that is not disabled or ignored and in a Normal state.
- ```%macro.component_warning``` - A component that is not disabled or ignored and NOT in a Warning state.
- ```%macro.component_critical``` - A component that is not disabled or ignored and NOT in a Critical state.
To raise alerts for components, the following rules could be created:
- ```%macros.component_alert = "1"``` - To alert on all components
- ```%macros.component_alert = "1" && %component.type = "<Type of Component>"``` - To alert on all components of a particular type.
- ```%macros.component_critical = "1"``` - To alert on all Critical components
- ```%macros.component_critical = "1" && %component.type = "<Type of Component>"``` - To alert on all Critical components of a particular type.
If there is a particular component you would like excluded from alerting, simply set the ignore field to 1.

View File

@@ -21,7 +21,7 @@ FLUSH PRIVILEGES;
exit
```
`vim /etc/my.cnf`
`vim /etc/my.cnf.d/server.cnf`
Within the [mysqld] section please add:

View File

@@ -50,15 +50,14 @@ 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
service php-fpm restart
```
#### Add librenms user
```bash
useradd librenms -d /opt/librenms -M -r
usermod -a -G librenms apache
usermod -a -G librenms nginx
```
#### Clone repo

View File

@@ -7,7 +7,7 @@
#### Install / Configure MySQL
```bash
apt-get install mariadb-server mariadb-client
service mariadb restart
service mysql restart
mysql -uroot -p
```
@@ -30,7 +30,7 @@ innodb_file_per_table=1
sql-mode=""
```
```service mariadb restart```
```service mysql restart```
### Web Server ###

View File

@@ -7,7 +7,7 @@
#### Install / Configure MySQL
```bash
apt-get install mariadb-server mariadb-client
service mariadb restart
service mysql restart
mysql -uroot -p
```
@@ -30,7 +30,7 @@ innodb_file_per_table=1
sql-mode=""
```
```service mariadb restart```
```service mysql restart```
### Web Server ###

View File

@@ -0,0 +1,41 @@
<?php
require_once "../includes/component.php";
$OBJCOMP = new component();
$common_output[] = '
<div>
<table id="component-status" class="table table-hover table-condensed table-striped">
<thead>
<tr>
<th data-column-id="status" data-order="desc">Status</th>
<th data-column-id="count">Count</th>
</tr>
</thead>
<tbody>
';
foreach ($OBJCOMP->getComponentStatus() as $k => $v) {
if ($k == 0) {
$status = 'Ok';
$color = 'green';
}
elseif ($k == 1) {
$status = 'Warning';
$color = 'grey';
}
else {
$status = 'Critical';
$color = 'red';
}
$common_output[] .= '
<tr>
<td><p class="text-left '.$color.'">'.$status.'</p></td>
<td><p class="text-left '.$color.'">'.$v.'</p></td>
</tr>
';
}
$common_output[] .= '
</tbody>
</table>
</div>
';

View File

@@ -67,6 +67,9 @@ function nicecase($item) {
case 'nfs-stats':
return 'NFS Stats';
case 'nfs-v3-stats':
return 'NFS v3 Stats';
default:
return ucfirst($item);
}

View File

@@ -0,0 +1,37 @@
<?php
require 'includes/graphs/common.inc.php';
$scale_min = 0;
$colours = 'mixed';
$unit_text = 'Operations';
$unitlen = 10;
$bigdescrlen = 15;
$smalldescrlen = 15;
$dostack = 0;
$printtotal = 0;
$addarea = 1;
$transparency = 33;
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/app-nfs-stats-'.$app['app_id'].'.rrd';
$array = array(
'fh_lookup' => array('descr' => 'lookup','colour' => '136421',),
'fh_anon' => array('descr' => 'anon','colour' => 'B2C945',),
'fh_ncachedir' => array('descr' => 'ncachedir','colour' => '778D0D',),
'fh_ncachenondir' => array('descr' => 'ncachenondir','colour' => '536400',),
'fh_stale' => array('descr' => 'stale','colour' => '832119',),
);
$i = 0;
if (is_file($rrd_filename)) {
foreach ($array as $ds => $vars) {
$rrd_list[$i]['filename'] = $rrd_filename;
$rrd_list[$i]['descr'] = $vars['descr'];
$rrd_list[$i]['ds'] = $ds;
$rrd_list[$i]['colour'] = $vars['colour'];
$i++;
}
}
else {
echo "file missing: $rrd_filename";
}
require 'includes/graphs/generic_v3_multiline.inc.php';

View File

@@ -0,0 +1,34 @@
<?php
require 'includes/graphs/common.inc.php';
$scale_min = 0;
$colours = 'mixed';
$unit_text = 'Operations';
$unitlen = 10;
$bigdescrlen = 15;
$smalldescrlen = 15;
$dostack = 0;
$printtotal = 0;
$addarea = 1;
$transparency = 33;
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/app-nfs-stats-'.$app['app_id'].'.rrd';
$array = array(
'io_read' => array('descr' => 'read','colour' => '2B9220',),
'io_write' => array('descr' => 'write','colour' => 'B0262D',),
);
$i = 0;
if (is_file($rrd_filename)) {
foreach ($array as $ds => $vars) {
$rrd_list[$i]['filename'] = $rrd_filename;
$rrd_list[$i]['descr'] = $vars['descr'];
$rrd_list[$i]['ds'] = $ds;
$rrd_list[$i]['colour'] = $vars['colour'];
$i++;
}
}
else {
echo "file missing: $rrd_filename";
}
require 'includes/graphs/generic_v3_multiline.inc.php';

View File

@@ -0,0 +1,36 @@
<?php
require 'includes/graphs/common.inc.php';
$scale_min = 0;
$colours = 'mixed';
$unit_text = 'net stats';
$unitlen = 15;
$bigdescrlen = 15;
$smalldescrlen = 15;
$dostack = 0;
$printtotal = 0;
$addarea = 1;
$transparency = 33;
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/app-nfs-stats-'.$app['app_id'].'.rrd';
$array = array(
'net_all' => array('descr' => 'total','colour' => '000000',),
'net_udp' => array('descr' => 'udp','colour' => 'AA3F39',),
'net_tcp' => array('descr' => 'tcp','colour' => '2C8437',),
'net_tcpconn' => array('descr' => 'tcp conn','colour' => '576996',),
);
$i = 0;
if (is_file($rrd_filename)) {
foreach ($array as $ds => $vars) {
$rrd_list[$i]['filename'] = $rrd_filename;
$rrd_list[$i]['descr'] = $vars['descr'];
$rrd_list[$i]['ds'] = $ds;
$rrd_list[$i]['colour'] = $vars['colour'];
$i++;
}
}
else {
echo "file missing: $rrd_filename";
}
require 'includes/graphs/generic_v3_multiline.inc.php';

View File

@@ -0,0 +1,44 @@
<?php
require 'includes/graphs/common.inc.php';
$scale_min = 0;
$colours = 'mixed';
$unit_text = 'Cached seconds';
$unitlen = 15;
$bigdescrlen = 15;
$smalldescrlen = 15;
$dostack = 0;
$printtotal = 0;
$addarea = 1;
$transparency = 33;
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/app-nfs-stats-'.$app['app_id'].'.rrd';
$array = array(
'ra_size' => array('descr' => 'size','colour' => '091B40',),
'ra_range01' => array('descr' => '0-10','colour' => '8293B3',),
'ra_range02' => array('descr' => '10-20','colour' => '566B95',),
'ra_range03' => array('descr' => '20-30','colour' => '1B315D',),
'ra_range04' => array('descr' => '30-40','colour' => '091B40',),
'ra_range05' => array('descr' => '40-50','colour' => '296F6A',),
'ra_range06' => array('descr' => '50-60','colour' => '498984',),
'ra_range07' => array('descr' => '60-70','colour' => '125651',),
'ra_range08' => array('descr' => '70-80','colour' => '023B37',),
'ra_range09' => array('descr' => '80-90','colour' => '14623A',),
'ra_range10' => array('descr' => '90-100','colour' => '034423',),
'ra_notfound' => array('descr' => 'not found','colour' => '590315',),
);
$i = 0;
if (is_file($rrd_filename)) {
foreach ($array as $ds => $vars) {
$rrd_list[$i]['filename'] = $rrd_filename;
$rrd_list[$i]['descr'] = $vars['descr'];
$rrd_list[$i]['ds'] = $ds;
$rrd_list[$i]['colour'] = $vars['colour'];
$i++;
}
}
else {
echo "file missing: $rrd_filename";
}
require 'includes/graphs/generic_v3_multiline.inc.php';

View File

@@ -0,0 +1,35 @@
<?php
require 'includes/graphs/common.inc.php';
$scale_min = 0;
$colours = 'mixed';
$unit_text = 'Reply cache';
$unitlen = 15;
$bigdescrlen = 15;
$smalldescrlen = 15;
$dostack = 0;
$printtotal = 0;
$addarea = 1;
$transparency = 33;
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/app-nfs-stats-'.$app['app_id'].'.rrd';
$array = array(
'rc_hits' => array('descr' => 'hits','colour' => '2B9220',),
'rc_misses' => array('descr' => 'misses','colour' => 'B36326',),
'rc_nocache' => array('descr' => 'nocache','colour' => 'B0262D',),
);
$i = 0;
if (is_file($rrd_filename)) {
foreach ($array as $ds => $vars) {
$rrd_list[$i]['filename'] = $rrd_filename;
$rrd_list[$i]['descr'] = $vars['descr'];
$rrd_list[$i]['ds'] = $ds;
$rrd_list[$i]['colour'] = $vars['colour'];
$i++;
}
}
else {
echo "file missing: $rrd_filename";
}
require 'includes/graphs/generic_v3_multiline.inc.php';

View File

@@ -0,0 +1,37 @@
<?php
require 'includes/graphs/common.inc.php';
$scale_min = 0;
$colours = 'mixed';
$unit_text = 'RPC Stats';
$unitlen = 15;
$bigdescrlen = 15;
$smalldescrlen = 15;
$dostack = 0;
$printtotal = 0;
$addarea = 1;
$transparency = 33;
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/app-nfs-stats-'.$app['app_id'].'.rrd';
$array = array(
'rpc_calls' => array('descr' => 'calls','colour' => '000000',),
'rpc_badcalls' => array('descr' => 'bad calls','colour' => '600604',),
'rpc_badfmt' => array('descr' => 'bad fmt','colour' => '8C201D',),
'rpc_badauth' => array('descr' => 'bad auth','colour' => 'DF7A77',),
'rpc_badclnt' => array('descr' => 'bad clnt','colour' => 'FFB3B1',),
);
$i = 0;
if (is_file($rrd_filename)) {
foreach ($array as $ds => $vars) {
$rrd_list[$i]['filename'] = $rrd_filename;
$rrd_list[$i]['descr'] = $vars['descr'];
$rrd_list[$i]['ds'] = $ds;
$rrd_list[$i]['colour'] = $vars['colour'];
$i++;
}
}
else {
echo "file missing: $rrd_filename";
}
require 'includes/graphs/generic_v3_multiline.inc.php';

View File

@@ -0,0 +1,54 @@
<?php
require 'includes/graphs/common.inc.php';
$scale_min = 0;
$colours = 'mixed';
$unit_text = 'Operations';
$unitlen = 10;
$bigdescrlen = 15;
$smalldescrlen = 15;
$dostack = 0;
$printtotal = 0;
$addarea = 1;
$transparency = 33;
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/app-nfs-stats-'.$app['app_id'].'.rrd';
$array = array(
'proc3_null' => array('descr' => 'Null','colour' => '630606',),
'proc3_getattr' => array('descr' => 'Get attributes','colour' => '50C150',),
'proc3_setattr' => array('descr' => 'Set attributes','colour' => '4D65A2',),
'proc3_lookup' => array('descr' => 'Lookup','colour' => '8B64A1',),
'proc3_access' => array('descr' => 'Access','colour' => 'AAAA39',),
'proc3_read' => array('descr' => 'Read','colour' => '308A30',),
'proc3_write' => array('descr' => 'Write','colour' => '457A9A',),
'proc3_create' => array('descr' => 'Create','colour' => '690D87',),
'proc3_mkdir' => array('descr' => 'Make dir','colour' => '3A3478',),
'proc3_mknod' => array('descr' => 'Make nod','colour' => '512E74',),
'proc3_link' => array('descr' => 'Link','colour' => '072A3F',),
'proc3_remove' => array('descr' => 'Remove','colour' => 'F16464',),
'proc3_rmdir' => array('descr' => 'Remove dir','colour' => '57162D',),
'proc3_rename' => array('descr' => 'Rename','colour' => 'A40B62',),
'proc3_readlink' => array('descr' => 'Read link','colour' => '557917',),
'proc3_readdir' => array('descr' => 'Read dir','colour' => 'A3C666',),
'proc3_symlink' => array('descr' => 'Symlink','colour' => '85C490',),
'proc3_readdirplus' => array('descr' => 'Read dir plus','colour' => 'F1F164',),
'proc3_fsstat' => array('descr' => 'FS stat','colour' => 'F1F191',),
'proc3_fsinfo' => array('descr' => 'FS info','colour' => '6E2770',),
'proc3_pathconf' => array('descr' => 'Pathconf','colour' => '993555',),
'proc3_commit' => array('descr' => 'Commit','colour' => '463176',),
);
$i = 0;
if (is_file($rrd_filename)) {
foreach ($array as $ds => $vars) {
$rrd_list[$i]['filename'] = $rrd_filename;
$rrd_list[$i]['descr'] = $vars['descr'];
$rrd_list[$i]['ds'] = $ds;
$rrd_list[$i]['colour'] = $vars['colour'];
$i++;
}
}
else {
echo "file missing: $rrd_filename";
}
require 'includes/graphs/generic_v3_multiline.inc.php';

View File

@@ -0,0 +1,30 @@
<?php
/**
* powerdns-recursor.inc.php
*
* -Description-
*
* 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>
*/
$rrd = rrd_name($device['hostname'], array('app', 'powerdns-recursor', $app['app_id']));
if (is_file($rrd)) {
$rrd_filename = $rrd;
}
$simple_rrd = true;

View File

@@ -0,0 +1,64 @@
<?php
/**
* powerdns-recursor_answers.inc.php
*
* Graph of answers
*
* 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>
*/
include 'powerdns-recursor.inc.php';
$colours = 'oranges';
$unit_text = 'Answers/sec';
$print_total = true;
if (is_file($rrd_filename)) {
$rrd_list = array(
array(
'ds' => 'answers0-1',
'filename' => $rrd_filename,
'descr' => '0-1ms',
),
array(
'ds' => 'answers1-10',
'filename' => $rrd_filename,
'descr' => '1-10ms',
),
array(
'ds' => 'answers10-100',
'filename' => $rrd_filename,
'descr' => '10-100ms',
),
array(
'ds' => 'answers100-1000',
'filename' => $rrd_filename,
'descr' => '100-1000ms',
),
array(
'ds' => 'answers-slow',
'filename' => $rrd_filename,
'descr' => '>1s',
),
);
} else {
echo "file missing: $rrd_filename";
}
require 'includes/graphs/generic_multi.inc.php';

View File

@@ -0,0 +1,65 @@
<?php
/**
* powerdns-recursor_cache_performance.inc.php
*
* -Description-
*
* 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>
*/
include 'powerdns-recursor.inc.php';
$colours = 'mixed';
$unit_text = 'Packets/sec';
if (is_file($rrd_filename)) {
$rrd_list = array(
array(
'filename' => $rrd_filename,
'ds' => 'cache-hits',
'descr' => 'Query Cache Hits',
'colour' => '297159',
'area' => true,
),
array(
'filename' => $rrd_filename,
'ds' => 'cache-misses',
'descr' => 'Query Cache Misses',
'colour' => '73AC61',
'area' => true,
),
array(
'filename' => $rrd_filename,
'ds' => 'packetcache-hits',
'descr' => 'Packet Cache Hits',
'colour' => 'BC7049',
'area' => true,
),
array(
'filename' => $rrd_filename,
'ds' => 'packetcache-misses',
'descr' => 'Packet Cache Misses',
'colour' => 'C98F45',
'area' => true,
)
);
} else {
echo "file missing: $rrd_filename";
}
require 'includes/graphs/generic_multi_line.inc.php';

View File

@@ -0,0 +1,50 @@
<?php
/**
* powerdns-recursor_cache_size.inc.php
*
* -Description-
*
* 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>
*/
include 'powerdns-recursor.inc.php';
$colours = 'purples';
$unit_text = 'Entries';
if (is_file($rrd_filename)) {
$rrd_list = array(
array(
'filename' => $rrd_filename,
'ds' => 'cache-entries',
'descr' => 'Query Cache',
'colour' => '202048',
),
array(
'filename' => $rrd_filename,
'ds' => 'packetcache-entries',
'descr' => 'Packet Cache',
'colour' => 'CC7CCC',
)
);
} else {
echo "file missing: $rrd_filename";
}
require 'includes/graphs/generic_multi_line.inc.php';

View File

@@ -0,0 +1,68 @@
<?php
/**
* powerdns-recursor_outqueries.inc.php
*
* -Description-
*
* 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>
*/
include 'powerdns-recursor.inc.php';
$colours = 'mixed';
$unit_text = 'Queries/sec';
if (is_file($rrd_filename)) {
$rrd_list = array(
array(
'filename' => $rrd_filename,
'ds' => 'all-outqueries',
'descr' => 'Total',
'area' => true,
),
array(
'filename' => $rrd_filename,
'ds' => 'ipv6-outqueries',
'descr' => 'IPv6',
'area' => true,
),
array(
'filename' => $rrd_filename,
'ds' => 'tcp-outqueries',
'descr' => 'TCP',
'area' => true,
),
array(
'filename' => $rrd_filename,
'ds' => 'throttled-out',
'descr' => 'Throttled',
'area' => true,
),
array(
'filename' => $rrd_filename,
'ds' => 'outgoing-timeouts',
'descr' => 'Timeouts',
'area' => true,
)
);
} else {
echo "file missing: $rrd_filename";
}
require 'includes/graphs/generic_multi_line.inc.php';

View File

@@ -0,0 +1,68 @@
<?php
/**
* powerdns-recursor_questions.inc.php
*
* -Description-
*
* 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>
*/
include 'powerdns-recursor.inc.php';
$colours = 'mixed';
$unit_text = 'Questions/sec';
if (is_file($rrd_filename)) {
$rrd_list = array(
array(
'filename' => $rrd_filename,
'ds' => 'questions',
'descr' => 'Total Questions',
'area' => true,
),
array(
'filename' => $rrd_filename,
'ds' => 'ipv6-questions',
'descr' => 'IPv6 Questions',
'area' => true,
),
array(
'filename' => $rrd_filename,
'ds' => 'tcp-questions',
'descr' => 'TCP Questions',
'area' => true,
),
array(
'filename' => $rrd_filename,
'ds' => 'over-capacity-drops',
'descr' => 'Over Capacity Drops',
'area' => true,
),
array(
'filename' => $rrd_filename,
'ds' => 'policy-drops',
'descr' => 'Policy Drops',
'area' => true,
)
);
} else {
echo "file missing: $rrd_filename";
}
require 'includes/graphs/generic_multi_line.inc.php';

View File

@@ -7,7 +7,7 @@ if (!is_array($config['nfsen_rrds'])) {
}
foreach ($config['nfsen_rrds'] as $nfsenrrds) {
if ($configs[(strlen($nfsenrrds) - 1)] != '/') {
if ($nfsenrrds[(strlen($nfsenrrds) - 1)] != '/') {
$nfsenrrds .= '/';
}
@@ -18,7 +18,7 @@ foreach ($config['nfsen_rrds'] as $nfsenrrds) {
}
$basefilename_underscored = preg_replace('/\./', $config['nfsen_split_char'], $device['hostname']);
$nfsen_filename = (strstr($basefilename_underscored, $nfsensuffix, true));
$nfsen_filename = preg_replace('/'.$nfsensuffix.'/', '', $basefilename_underscored);
if (is_file($nfsenrrds.$nfsen_filename.'.rrd')) {
$rrd_filename = $nfsenrrds.$nfsen_filename.'.rrd';

View File

@@ -1,5 +1,20 @@
<?php
/*
* Outputs a stacked, filled line graph
*
* Variables:
* $rrd_list array required - array of data sets to graph. Each item is an array that contains the following
* ds string required - data set name as defined in rrd
* filename string required - path to the rrd file as generated by rrd_name()
* descr string required - the label for this data set
* colour string optional - Defines the colour for this data set (overrides the overall colour set)
* invert boolean optional - multiplies values in this data set by -1
* $colours string required - colour set as defined in $config['graph_colours']
* $print_total boolean optional - Sum all the values and output the last, min, max, and avg in the legend
* $simplerrd boolean optional - All data sets reside in the same rrd file
*/
require 'includes/graphs/common.inc.php';
if ($width > '500') {
@@ -29,20 +44,26 @@ else {
$i = 0;
$iter = 0;
$ids = array();
foreach ($rrd_list as $rrd) {
if (!$config['graph_colours'][$colours][$iter]) {
$iter = 0;
// get the color for this data set
if(isset($rrd['colour'])) {
$colour = $rrd['colour'];
} else {
if (!$config['graph_colours'][$colours][$iter]) {
$iter = 0;
}
$colour = $config['graph_colours'][$colours][$iter];
$iter++;
}
$colour = $config['graph_colours'][$colours][$iter];
$ds = $rrd['ds'];
$filename = $rrd['filename'];
$descr = rrdtool_escape($rrd['descr'], $descr_len);
$id = 'ds'.$i;
$ids[] = ($id = 'ds'.$i);
$rrd_options .= ' DEF:'.$id."=$filename:$ds:AVERAGE";
@@ -69,10 +90,26 @@ foreach ($rrd_list as $rrd) {
$bstack = ':STACK';
}
$i++;
$iter++;
}//end foreach
if ($print_total) {
$tot = $ids;
for ($i=1; $i<count($ids); $i++) {
$tot[] = '+';
}
$rrd_options .= ' CDEF:tot=' . implode($tot, ',');
$rrd_options .= ' COMMENT:" '.rrdtool_escape('Total', $descr_len).'"';
$rrd_options .= ' GPRINT:tot:LAST:%5.1lf%s';
$rrd_options .= ' GPRINT:tot:MIN:%5.1lf%s';
$rrd_options .= ' GPRINT:tot:MAX:%5.1lf%s';
$rrd_options .= ' GPRINT:tot:AVERAGE:%5.1lf%s\n';
}
$rrd_options .= $rrd_optionsb;
$rrd_options .= ' HRULE:0#555555';
$rrd_options .= $rrd_optionsc;

View File

@@ -1,5 +1,22 @@
<?php
/*
* Outputs a graph with multiple overlaid lines
*
* Variables:
* $rrd_list array required - array of data sets to graph. Each item is an array that contains the following
* ds string required - data set name as defined in rrd
* filename string required - path to the rrd file as generated by rrd_name()
* descr string required - the label for this data set
* colour string optional - Defines the colour for this data set (overrides the overall colour set)
* area boolean optional - Colors in the area of the data set with 20% opacity (unless areacolor is set)
* areacolor string optional - Sets the area color manually
* invert boolean optional - multiplies values in this data set by -1
* $colours string required - colour set as defined in $config['graph_colours']
* $print_total boolean optional - Sum all the values and output the last, min, max, and avg in the legend
* $simplerrd boolean optional - All data sets reside in the same rrd file
*/
require 'includes/graphs/common.inc.php';
if ($width > '500') {
@@ -31,11 +48,17 @@ $i = 0;
$iter = 0;
foreach ($rrd_list as $rrd) {
if (!$config['graph_colours'][$colours][$iter]) {
$iter = 0;
// get the color for this data set
if(isset($rrd['colour'])) {
$colour = $rrd['colour'];
} else {
if (!$config['graph_colours'][$colours][$iter]) {
$iter = 0;
}
$colour = $config['graph_colours'][$colours][$iter];
$iter++;
}
$colour = $config['graph_colours'][$colours][$iter];
if (!empty($rrd['area']) && empty($rrd['areacolour'])) {
$rrd['areacolour'] = $colour."20";
}
@@ -76,7 +99,6 @@ foreach ($rrd_list as $rrd) {
$rrd_optionsb .= ' GPRINT:'.$id.'max:MAX:%5.2lf%s'.$units.' GPRINT:'.$id.":AVERAGE:'%5.2lf%s$units\\n'";
$i++;
$iter++;
}//end foreach
$rrd_options .= $rrd_optionsb;

View File

@@ -0,0 +1,121 @@
<?php
require 'includes/graphs/common.inc.php';
if ($width > '500') {
$descr_len = $bigdescrlen;
} else {
$descr_len = $smalldescrlen;
}
if ($printtotal === 1) {
$descr_len += '2';
$unitlen += '2';
}
$unit_text = str_pad(truncate($unit_text, $unitlen), $unitlen);
if ($width > '500') {
$rrd_options .= " COMMENT:'".substr(str_pad($unit_text, ($descr_len + 10)), 0, ($descr_len + 10))."Now Min Max Avg\l'";
if($printtotal === 1) {
$rrd_options .= " COMMENT:'Total '";
}
$rrd_options .= " COMMENT:'\l'";
} else {
$rrd_options .= " COMMENT:'".substr(str_pad($unit_text, ($descr_len + 10)), 0, ($descr_len + 10))."Now Min Max Avg\l'";
}
foreach ($rrd_list as $rrd) {
if ($rrd['colour']) {
$colour = $rrd['colour'];
}
else {
if (!$config['graph_colours'][$colours][$colour_iter]) {
$colour_iter = 0;
}
$colour = $config['graph_colours'][$colours][$colour_iter];
$colour_iter++;
}
$ds = $rrd['ds'];
$filename = $rrd['filename'];
$descr = rrdtool_escape($rrd['descr'], $descr_len);
$id = 'ds'.$i;
$rrd_options .= ' DEF:'.$rrd['ds'].$i.'='.$rrd['filename'].':'.$rrd['ds'].':AVERAGE ';
if ($simple_rrd) {
$rrd_options .= ' CDEF:'.$rrd['ds'].$i.'min='.$rrd['ds'].$i.' ';
$rrd_options .= ' CDEF:'.$rrd['ds'].$i.'max='.$rrd['ds'].$i.' ';
}
else {
$rrd_options .= ' DEF:'.$rrd['ds'].$i.'min='.$rrd['filename'].':'.$rrd['ds'].':MIN ';
$rrd_options .= ' DEF:'.$rrd['ds'].$i.'max='.$rrd['filename'].':'.$rrd['ds'].':MAX ';
}
if ($_GET['previous']) {
$rrd_options .= ' DEF:'.$i.'X='.$rrd['filename'].':'.$rrd['ds'].':AVERAGE:start='.$prev_from.':end='.$from;
$rrd_options .= ' SHIFT:'.$i."X:$period";
$thingX .= $seperatorX.$i.'X,UN,0,'.$i.'X,IF';
$plusesX .= $plusX;
$seperatorX = ',';
$plusX = ',+';
}
if ($printtotal === 1) {
$rrd_options .= ' VDEF:tot'.$rrd['ds'].$i.'='.$rrd['ds'].$i.',TOTAL';
}
$g_defname = $rrd['ds'];
if (is_numeric($multiplier)) {
$g_defname = $rrd['ds'].'_cdef';
$rrd_options .= ' CDEF:'.$g_defname.$i.'='.$rrd['ds'].$i.','.$multiplier.',*';
$rrd_options .= ' CDEF:'.$g_defname.$i.'min='.$rrd['ds'].$i.'min,'.$multiplier.',*';
$rrd_options .= ' CDEF:'.$g_defname.$i.'max='.$rrd['ds'].$i.'max,'.$multiplier.',*';
} else if (is_numeric($divider)) {
$g_defname = $rrd['ds'].'_cdef';
$rrd_options .= ' CDEF:'.$g_defname.$i.'='.$rrd['ds'].$i.','.$divider.',/';
$rrd_options .= ' CDEF:'.$g_defname.$i.'min='.$rrd['ds'].$i.'min,'.$divider.',/';
$rrd_options .= ' CDEF:'.$g_defname.$i.'max='.$rrd['ds'].$i.'max,'.$divider.',/';
}
if (isset($text_orig) && $text_orig) {
$t_defname = $rrd['ds'];
} else {
$t_defname = $g_defname;
}
if ($i && ($dostack === 1)) {
$stack = ':STACK';
}
$rrd_options .= ' LINE2:'.$g_defname.$i.'#'.$colour.":'".$descr."'$stack";
if ($addarea === 1)
{
$descr = ":";
$rrd_options .= ' AREA:'.$g_defname.$i.'#'.$colour.$transparency.":'".$descr."'$stack";
}
$rrd_options .= ' GPRINT:'.$t_defname.$i.':LAST:%8.0lf%s GPRINT:'.$t_defname.$i.'min:MIN:%8.0lf%s';
$rrd_options .= ' GPRINT:'.$t_defname.$i.'max:MAX:%8.0lf%s GPRINT:'.$t_defname.$i.":AVERAGE:'%8.0lf%s\\n'";
if ($printtotal === 1) {
$rrd_options .= ' GPRINT:tot'.$rrd['ds'].$i.":%6.2lf%s'".rrdtool_escape($total_units)."'";
}
$rrd_options .= " COMMENT:'\\n'";
}//end foreach
if ($_GET['previous'] == 'yes') {
if (is_numeric($multiplier)) {
$rrd_options .= ' CDEF:X='.$thingX.$plusesX.','.$multiplier.',*';
}
else if (is_numeric($divider)) {
$rrd_options .= ' CDEF:X='.$thingX.$plusesX.','.$divider.',/';
}
else {
$rrd_options .= ' CDEF:X='.$thingX.$plusesX;
}
$rrd_options .= ' HRULE:0#555555';
}

View File

@@ -34,17 +34,30 @@ $COMPONENTS = $OBJCOMP->getComponents($device_id,$options);
$response[] = array(
'id' => '<button type="submit" id="save-form" class="btn btn-success btn-sm" title="Save current component disable/ignore settings">Save</button><button type="submit" id="form-reset" class="btn btn-danger btn-sm" title="Reset form to when the page was loaded">Reset</button>',
'label' => '&nbsp;',
'status' => '<button type="submit" id="alert-select" class="btn btn-default btn-sm" title="Disable alerting on all currently-alerting components">Alerting</button>',
'status' => '<button type="submit" id="warning-select" class="btn btn-default btn-sm" title="Disable alerting on all currently warning components">Warning</button>&nbsp;<button type="submit" id="critical-select" class="btn btn-default btn-sm" title="Disable alerting on all currently critical components">Critical</button>',
'disable' => '<button type="submit" id="disable-toggle" class="btn btn-default btn-sm" title="Toggle polling for all components">Toggle</button><button type="button" id="disable-select" class="btn btn-default btn-sm" title="Disable polling on all components">Select All</button>',
'ignore' => '<button type="submit" id="ignore-toggle" class="btn btn-default btn-sm" title="Toggle alerting for all components">Toggle</button><button type="button" id="ignore-select" class="btn btn-default btn-sm" title="Disable alerting on all components">Select All</button>',
);
foreach ($COMPONENTS[$device_id] as $ID => $AVP) {
if ($AVP['status'] == 0) {
$class = "green";
$status = "Ok";
}
elseif ($AVP['status'] == 1) {
$class = "grey";
$status = "Warning";
}
else {
// Critical
$class = "red";
$status = "Critical";
}
$response[] = array(
'id' => $ID,
'type' => $AVP['type'],
'label' => $AVP['label'],
'status' => ($AVP['status'] ? "<span name='status_".$ID."' class='green'>Normal</span>" : "<span name='status_".$ID."' class='red'>Alert</span>"),
'status' => "<span name='status_".$ID."' class='".$class."'>".$status."</span>",
'disable' => '<input type="checkbox" class="disable-check" name="dis_'.$ID.'"'.($AVP['disabled'] ? 'checked' : '').'>',
'ignore' => '<input type="checkbox" class="ignore-check" name="ign_'.$ID.'"'.($AVP['ignore'] ? 'checked' : '').'>',
);

View File

@@ -33,6 +33,13 @@ $graphs['nginx'] = array(
'req',
);
$graphs['powerdns-recursor'] = array(
'questions',
'answers',
'cache_performance',
'outqueries'
);
$graphs['rrdcached'] = array(
'queue_length',
'events',

View File

@@ -360,7 +360,7 @@ if (device_permitted($vars['device']) || $check_device == $vars['device']) {
}
foreach ($config['nfsen_rrds'] as $nfsenrrds) {
if ($configs[(strlen($nfsenrrds) - 1)] != '/') {
if ($nfsenrrds[(strlen($nfsenrrds) - 1)] != '/') {
$nfsenrrds .= '/';
}
@@ -370,7 +370,7 @@ if (device_permitted($vars['device']) || $check_device == $vars['device']) {
}
$basefilename_underscored = preg_replace('/\./', $config['nfsen_split_char'], $device['hostname']);
$nfsen_filename = (strstr($basefilename_underscored, $nfsensuffix, true));
$nfsen_filename = preg_replace('/'.$nfsensuffix.'/', '', $basefilename_underscored);
if (is_file($nfsenrrds.$nfsen_filename.'.rrd')) {
$nfsen_rrd_file = $nfsenrrds.$nfsen_filename.'.rrd';
}

View File

@@ -0,0 +1,35 @@
<?php
global $config;
$graphs = array(
'nfs-v3-stats' => 'NFS v3 Statistics',
'nfs-io' => 'IO',
'nfs-fh' => 'File handler',
'nfs-rc' => 'Reply cache',
'nfs-ra' => 'Read ahead cache',
'nfs-net' => 'Network stats',
'nfs-rpc' => 'RPC Stats',
);
foreach ($graphs as $key => $text) {
$graph_type = $key;
$graph_array['height'] = '100';
$graph_array['width'] = '215';
$graph_array['to'] = $config['time']['now'];
$graph_array['id'] = $app['app_id'];
$graph_array['type'] = 'application_'.$key;
echo '<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">'.$text.'</h3>
</div>
<div class="panel-body">
<div class="row">';
include 'includes/print-graphrow.inc.php';
echo '</div>';
echo '</div>';
echo '</div>';
}

View File

@@ -0,0 +1,53 @@
<?php
/**
* powerdns-recursor.php
*
* Graphs for PowerDNS Recursor
*
* 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>
*/
global $config;
$graphs = array(
'powerdns-recursor_questions' => 'Questions',
'powerdns-recursor_answers' => 'Answers',
'powerdns-recursor_cache_performance' => 'Cache Performance',
'powerdns-recursor_cache_size' => 'Cache Size',
'powerdns-recursor_outqueries' => 'Outbound Queries',
);
foreach ($graphs as $key => $text) {
$graph_array['height'] = '100';
$graph_array['width'] = '215';
$graph_array['to'] = $config['time']['now'];
$graph_array['id'] = $app['app_id'];
$graph_array['type'] = 'application_'.$key;
echo '<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">'.$text.'</h3>
</div>
<div class="panel-body">
<div class="row">';
include 'includes/print-graphrow.inc.php';
echo '</div>';
echo '</div>';
echo '</div>';
}

View File

@@ -44,13 +44,27 @@
event.preventDefault();
$('.ignore-check').prop('checked', true);
});
$('#alert-select').click(function (event) {
// select ignore buttons for all ports which are down
$('#warning-select').click(function (event) {
// select ignore button for all components that are in a warning state.
event.preventDefault();
$('[name^="status_"]').each(function () {
var name = $(this).attr('name');
var text = $(this).text();
if (name && text == 'Alert') {
if (name && text == 'Warning') {
// get the component number from the object name
var id = name.split('_')[1];
// find its corresponding checkbox and toggle it
$('input[name="ign_' + id + '"]').trigger('click');
}
});
});
$('#critical-select').click(function (event) {
// select ignore button for all components that are in a critical state.
event.preventDefault();
$('[name^="status_"]').each(function () {
var name = $(this).attr('name');
var text = $(this).text();
if (name && text == 'Critical') {
// get the component number from the object name
var id = name.split('_')[1];
// find its corresponding checkbox and toggle it

View File

@@ -2,7 +2,7 @@
if ($sensor_class == 'state') {
$sensors = dbFetchRows('SELECT * FROM `sensors` LEFT JOIN `sensors_to_state_indexes` ON sensors_to_state_indexes.sensor_id = sensors.sensor_id LEFT JOIN state_indexes ON state_indexes.state_index_id = sensors_to_state_indexes.state_index_id WHERE `sensor_class` = ? AND device_id = ? ORDER BY `poller_type`, `sensor_index`+0, `sensor_oid`', array($sensor_class, $device['device_id']));
$sensors = dbFetchRows('SELECT * FROM `sensors` LEFT JOIN `sensors_to_state_indexes` ON sensors_to_state_indexes.sensor_id = sensors.sensor_id LEFT JOIN state_indexes ON state_indexes.state_index_id = sensors_to_state_indexes.state_index_id WHERE `sensor_class` = ? AND device_id = ? ORDER BY `sensor_type`, `sensor_index`+0, `sensor_oid`', array($sensor_class, $device['device_id']));
}
else {
$sensors = dbFetchRows('SELECT * FROM `sensors` WHERE `sensor_class` = ? AND device_id = ? ORDER BY `poller_type`, `sensor_oid`, `sensor_index`', array($sensor_class, $device['device_id']));

View File

@@ -19,7 +19,7 @@ global $config;
// Loop over each component, pulling out the Overlays.
foreach ($components as $oid => $overlay) {
if ($overlay['otvtype'] == 'overlay') {
if ($overlay['status'] == 1) {
if ($overlay['status'] == 0) {
$overlay_status = "<span class='green pull-right'>Normal</span>";
$gli = "";
}
@@ -33,7 +33,7 @@ foreach ($components as $oid => $overlay) {
<?php
foreach ($components as $aid => $adjacency) {
if (($adjacency['otvtype'] == 'adjacency') && ($adjacency['index'] == $overlay['index'])) {
if ($adjacency['status'] == 1) {
if ($adjacency['status'] == 0) {
$adj_status = "<span class='green pull-right'>Normal</span>";
$gli = "";
}

View File

@@ -1,17 +1,19 @@
<?php
$link_array = array(
'page' => 'device',
'device' => $device['device_id'],
'tab' => 'routing',
'proto' => 'ipsec_tunnels',
);
'page' => 'device',
'device' => $device['device_id'],
'tab' => 'routing',
'proto' => 'ipsec_tunnels'
);
print_optionbar_start();
echo "<span style='font-weight: bold;'>IPSEC Tunnels</span> &#187; ";
$menu_options = array('basic' => 'Basic');
$menu_options = array(
'basic' => 'Basic'
);
if (!isset($vars['view'])) {
$vars['view'] = 'basic';
@@ -19,8 +21,8 @@ if (!isset($vars['view'])) {
echo "<span style='font-weight: bold;'>VRFs</span> &#187; ";
$menu_options = array('basic' => 'Basic',
// 'detail' => 'Detail',
$menu_options = array(
'basic' => 'Basic'
);
if (!$_GET['opta']) {
@@ -32,83 +34,98 @@ foreach ($menu_options as $option => $text) {
if ($vars['view'] == $option) {
echo "<span class='pagemenu-selected'>";
}
echo generate_link($text, $link_array, array('view' => $option));
echo generate_link($text, $link_array, array(
'view' => $option
));
if ($vars['view'] == $option) {
echo '</span>';
}
echo ' | ';
}
echo ' Graphs: ';
$graph_types = array(
'bits' => 'Bits',
'pkts' => 'Packets',
);
'bits' => 'Bits',
'pkts' => 'Packets'
);
foreach ($graph_types as $type => $descr) {
echo "$type_sep";
if ($vars['graph'] == $type) {
echo "<span class='pagemenu-selected'>";
}
echo generate_link($descr, $link_array, array('view' => 'graphs', 'graph' => $type));
echo generate_link($descr, $link_array, array(
'view' => 'graphs',
'graph' => $type
));
if ($vars['graph'] == $type) {
echo '</span>';
}
$type_sep = ' | ';
}
print_optionbar_end();
echo "<div style='margin: 5px;'><table border=0 cellspacing=0 cellpadding=0 width=100%>";
$i = '0';
foreach (dbFetchRows('SELECT * FROM `ipsec_tunnels` WHERE `device_id` = ? ORDER BY `peer_addr`', array($device['device_id'])) as $tunnel) {
if (is_integer($i / 2)) {
$bg_colour = $list_colour_a;
}
else {
$bg_colour = $list_colour_b;
}
$tunnel = dbFetchRows('SELECT * FROM `ipsec_tunnels` WHERE `device_id` = ? ORDER BY `peer_addr`', array(
$device['device_id']
));
if ($tunnel['tunnel_status'] == 'active') {
$tunnel_class = 'green';
if (is_null($vars['graph'])) {
$tunnel_label = 'warning';
echo '<table class="table table-condensed table-hover">
<thead>
<tr>
<th>Local Identity</th>
<th>Remote Identity</th>
<th>Name</th>
<th>Status</th>
</tr>
</thead>
<tbody>';
foreach ($tunnel as $entry) {
$local_addr = preg_replace('/\b0+(?=\d)/', '', htmlentities($entry['local_addr']));
$remote_addr = preg_replace('/\b0+(?=\d)/', '', htmlentities($entry['peer_addr']));
if ($tunnel['tunnel_status'] = 'active') {
$tunnel_label = 'success';
}
echo '<tr>
<td>' . $local_addr . '</td>
<td>' . $remote_addr . '</td>
<td>' . htmlentities($entry['tunnel_name']) . '</td>
<td><span class="label label-' . $tunnel_label . '">' . htmlentities($entry['tunnel_status']) . '</span></td>
</tr>';
}
else {
$tunnel_class = 'red';
}
echo "<tr bgcolor='$bg_colour'>";
echo '<td width=320 class=list-large>'.$tunnel['local_addr'].' &#187; '.$tunnel['peer_addr'].'</a></td>';
echo '<td width=150 class=box-desc>'.$tunnel['tunnel_name'].'</td>';
echo "<td width=100 class=list-large><span class='".$tunnel_class."'>".$tunnel['tunnel_status'].'</span></td>';
echo '</tr>';
if (isset($vars['graph'])) {
echo '<tr class="list-bold">';
echo '<td colspan = 3>';
$graph_type = 'ipsectunnel_'.$vars['graph'];
echo '</tbody>
</table>';
} else {
foreach ($tunnel as $entry) {
$local_addr = preg_replace('/\b0+(?=\d)/', '', htmlentities($entry['local_addr']));
$remote_addr = preg_replace('/\b0+(?=\d)/', '', htmlentities($entry['peer_addr']));
$graph_type = 'ipsectunnel_' . $vars['graph'];
$graph_array['height'] = '100';
$graph_array['width'] = '215';
$graph_array['to'] = $config['time']['now'];
$graph_array['id'] = $tunnel['tunnel_id'];
$graph_array['id'] = $entry['tunnel_id'];
$graph_array['type'] = $graph_type;
echo '<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">' . $local_addr . ' &#187; ' . $remote_addr . '</h3>
</div>
<div class="panel-body">';
echo "<div class='row'>";
include 'includes/print-graphrow.inc.php';
echo '
</td>
</tr>';
echo '</div>';
echo '</div>';
echo '</div>';
}
echo '</td>';
echo '</tr>';
$i++;
}//end foreach
echo '</table></div>';
}

View File

@@ -19,7 +19,7 @@ foreach ($COMPONENTS as $DEVICE_ID => $COMP) {
// Loop over each component, pulling out the Overlays.
foreach ($COMP as $OID => $OVERLAY) {
if ($OVERLAY['otvtype'] == 'overlay') {
if ($OVERLAY['status'] == 1) {
if ($OVERLAY['status'] == 0) {
$OVERLAY_STATUS = "<span class='green pull-right'>Normal</span>";
$GLI = "";
}
@@ -33,7 +33,7 @@ foreach ($COMPONENTS as $DEVICE_ID => $COMP) {
<?php
foreach ($COMP as $AID => $ADJACENCY) {
if (($ADJACENCY['otvtype'] == 'adjacency') && ($ADJACENCY['index'] == $OVERLAY['index'])) {
if ($ADJACENCY['status'] == 1) {
if ($ADJACENCY['status'] == 0) {
$ADJ_STATUS = "<span class='green pull-right'>Normal</span>";
$GLI = "";
}

View File

@@ -20,7 +20,7 @@ class component {
private $reserved = array(
'type' => '',
'label' => '',
'status' => 1,
'status' => 0,
'ignore' => 0,
'disabled' => 0,
'error' => '',
@@ -148,6 +148,69 @@ class component {
return $RESULT;
}
public function getComponentStatus($device=null) {
$sql_query = "SELECT status, count(status) as count FROM component WHERE";
$sql_param = array();
$add = 0;
if (!is_null($device)) {
// Add a device filter to the SQL query.
$sql_query .= " `device_id` = ?";
$sql_param[] = $device;
$add++;
}
if ($add == 0) {
// No filters, remove " WHERE" -6
$sql_query = substr($sql_query, 0, strlen($sql_query)-6);
}
$sql_query .= " GROUP BY status";
d_echo("SQL Query: ".$sql_query);
// $service is not null, get only what we want.
$result = dbFetchRows($sql_query, $sql_param);
// Set our defaults to 0
$count = array(0 => 0, 1 => 0, 2 => 0);
// Rebuild the array in a more convenient method
foreach ($result as $v) {
$count[$v['status']] = $v['count'];
}
d_echo("Component Count by Status: ".print_r($count,TRUE)."\n");
return $count;
}
public function getComponentStatusLog($component=null,$start=null,$end=null) {
if ( ($component == null) || ($start == null) || ($end == null) ) {
// Error...
d_echo("Required arguments are missing. Component: ".$component.", Start: ".$start.", End: ".$end."\n");
return false;
}
// Create our return array.
$return = array();
// 1. find the previous value, this is the value when $start occurred.
$sql_query = "SELECT status FROM component_statuslog WHERE `component` = ? AND time < ? ORDER BY `id` desc LIMIT 1";
$sql_param = array($component,$start);
$result = dbFetchRow($sql_query, $sql_param);
if ($result == false) {
$return['initial'] = false;
}
else {
$return['initial'] = $result['status'];
}
// 2. Then we just need a list of all the entries for the time period.
$sql_query = "SELECT status, time, message FROM component_statuslog WHERE `component` = ? AND time >= ? AND time < ? ORDER BY `time`";
$sql_param = array($component,$start,$end);
$return['data'] = dbFetchRows($sql_query, $sql_param);
d_echo("Status Log Data: ".print_r($return,TRUE)."\n");
return $return;
}
public function createComponent ($device_id,$TYPE) {
// Prepare our default values to be inserted.
$DATA = $this->reserved;
@@ -159,6 +222,9 @@ class component {
// Insert a new component into the database.
$id = dbInsert($DATA, 'component');
// Add a default status log entry - we always start ok.
$this->createStatusLogEntry($id,0,'Component Created');
// Create a default component array based on what was inserted.
$ARRAY = array();
$ARRAY[$id] = $DATA;
@@ -166,6 +232,17 @@ class component {
return $ARRAY;
}
public function createStatusLogEntry($component,$status,$message) {
// Add an entry to the statuslog table for a particular component.
$DATA = array(
'component' => $component,
'status' => $status,
'message' => $message,
);
return dbInsert($DATA, 'component_statuslog');
}
public function deleteComponent ($id) {
// Delete a component from the database.
return dbDelete('component', "`id` = ?",array($id));
@@ -187,6 +264,12 @@ class component {
// Ignore type, we cant change that.
unset($AVP['type'],$OLD[$device_id][$COMPONENT]['type']);
// If the Status has changed we need to add a log entry
if ($AVP['status'] != $OLD[$device_id][$COMPONENT]['status']) {
d_echo("Status Changed - Old: ".$OLD[$device_id][$COMPONENT]['status'].", New: ".$AVP['status']."\n");
$this->createStatusLogEntry($COMPONENT,$AVP['status'],$AVP['error']);
}
// Process our reserved components first.
$UPDATE = array();
foreach ($this->reserved as $k => $v) {
@@ -239,7 +322,7 @@ class component {
log_event("Component: ".$AVP[$COMPONENT]['type']."(".$COMPONENT."). Attribute: ".$ATTR.", was modified from: ".$OLD[$COMPONENT][$ATTR].", to: ".$VALUE,$device_id,'component',$COMPONENT);
}
} // End Foreach COMPONENT
} // End Foreach AVP
// Process our Deletes.
$DELETE = array_diff_key($OLD[$device_id][$COMPONENT], $AVP);

View File

@@ -116,11 +116,11 @@ if ($device['os_group'] == 'cisco') {
// If we have set a message, we have an error, activate alert.
if ($message !== false) {
$result['error'] = $message;
$result['status'] = 0;
$result['status'] = 2;
}
else {
$result['error'] = "";
$result['status'] = 1;
$result['status'] = 0;
}
// Let's log some debugging
@@ -154,11 +154,11 @@ if ($device['os_group'] == 'cisco') {
// If we have set a message, we have an error, activate alert.
if ($message !== false) {
$result['error'] = $message;
$result['status'] = 0;
$result['status'] = 1;
}
else {
$result['error'] = "";
$result['status'] = 1;
$result['status'] = 0;
}
// Set a default name, if for some unknown reason we cant find the parent VPN.

View File

@@ -103,6 +103,13 @@ function discover_device($device, $options = null) {
}
}
// Set type to a predefined type for the OS if it's not already set
if ($device['type'] == 'unknown' || $device['type'] == '') {
if ($config['os'][$device['os']]['type']) {
$device['type'] = $config['os'][$device['os']]['type'];
}
}
if ($config['os'][$device['os']]['group']) {
$device['os_group'] = $config['os'][$device['os']]['group'];
echo ' (' . $device['os_group'] . ')';
@@ -142,13 +149,6 @@ function discover_device($device, $options = null) {
register_mibs($device, $devicemib, "includes/discovery/functions.inc.php");
}
// Set type to a predefined type for the OS if it's not already set
if ($device['type'] == 'unknown' || $device['type'] == '') {
if ($config['os'][$device['os']]['type']) {
$device['type'] = $config['os'][$device['os']]['type'];
}
}
$device_end = microtime(true);
$device_run = ($device_end - $device_start);
$device_time = substr($device_run, 0, 5);

View File

@@ -12,26 +12,22 @@
if ($device['os'] == 'ibm-amm') {
$oids = array('blower1speedRPM', 'blower2speedRPM', 'blower3speedRPM', 'blower4speedRPM');
d_echo($oids."\n");
if (!empty($oids)) {
$descr_prefix = 'Blower ';
$oids = array(
'.1.3.6.1.4.1.2.3.51.2.2.3.20.0', // BLADE-MIB:blower1speedRPM
'.1.3.6.1.4.1.2.3.51.2.2.3.21.0', // BLADE-MIB:blower2speedRPM
'.1.3.6.1.4.1.2.3.51.2.2.3.22.0', // BLADE-MIB:blower3speedRPM
'.1.3.6.1.4.1.2.3.51.2.2.3.23.0', // BLADE-MIB:blower4speedRPM
);
echo 'BLADE-MIB ';
foreach ($oids as $index => $data) {
if (!empty($data)) {
$value = trim(snmp_get($device, $data.'.0', '-Oqv', 'BLADE-MIB'), '"');
if (is_numeric($value)) {
$oid = 'BLADE-MIB::' . $data . '.0';
$descr = $data;
discover_sensor($valid['sensor'], 'fanspeed', $device, $oid, $index, 'snmp', $descr, 1, 1, null, null, null, null, $value);
}
}
echo 'BLADE-MIB ';
foreach ($oids as $index => $oid) {
$value = trim(snmp_get($device, $oid, '-Oqv'), '"');
if (is_numeric($value)) {
$descr = $descr_prefix . ($index + 1);
discover_sensor($valid['sensor'], 'fanspeed', $device, $oid, $index, 'snmp', $descr, 1, 1, null, null, null, null, $value);
}
}
}

View File

@@ -13,16 +13,25 @@
if ($device['os'] == 'ibm-amm') {
$index = 1;
$state_name = 'ibm-amm_BlowerState';
$state_descr = 'Blower ';
$oids = array(
'blower1State' => '.1.3.6.1.4.1.2.3.51.2.2.3.10.0',
'blower2State' => '.1.3.6.1.4.1.2.3.51.2.2.3.11.0',
'blower3State' => '.1.3.6.1.4.1.2.3.51.2.2.3.12.0',
'blower4State' => '.1.3.6.1.4.1.2.3.51.2.2.3.13.0'
'.1.3.6.1.4.1.2.3.51.2.2.3.10.0', // BLADE-MIB::blower1State.0
'.1.3.6.1.4.1.2.3.51.2.2.3.11.0', // BLADE-MIB::blower2State.0
'.1.3.6.1.4.1.2.3.51.2.2.3.12.0', // BLADE-MIB::blower3State.0
'.1.3.6.1.4.1.2.3.51.2.2.3.13.0', // BLADE-MIB::blower4State.0
);
/* BLADE-MIB: blower1State
* unknown(0),
* good(1),
* warning(2),
* bad(3)
*/
foreach ($oids as $state_name => $oid) {
foreach ($oids as $oid) {
$state = snmp_get($device, $oid, '-Oqv');
$descr = $state_descr . $index;
if (!empty($state)) {
$state_index_id = create_state_index($state_name);
@@ -30,10 +39,10 @@ if ($device['os'] == 'ibm-amm') {
if ($state_index_id) {
$states = array(
array($state_index_id,'unknown',0,0,3) ,
array($state_index_id,'good',1,1,0) ,
array($state_index_id,'warning',1,2,1) ,
array($state_index_id,'bad',1,3,2) ,
array($state_index_id, 'unknown', 0, 0, 3),
array($state_index_id, 'good', 1, 1, 0),
array($state_index_id, 'warning', 1, 2, 1),
array($state_index_id, 'bad', 1, 3, 2),
);
foreach($states as $value) {
@@ -49,7 +58,7 @@ if ($device['os'] == 'ibm-amm') {
}//end if
discover_sensor($valid['sensor'], 'state', $device, $oid, $index, $state_name, $state_name, '1', '1', null, null, null, null, $state, 'snmp', $index);
discover_sensor($valid['sensor'], 'state', $device, $oid, $index, $state_name, $descr, '1', '1', null, null, null, null, $state, 'snmp', $index);
//Create Sensor To State Index
create_sensor_to_state_index($device, $state_name, $index);
$index++;
@@ -59,15 +68,25 @@ if ($device['os'] == 'ibm-amm') {
}//end foreach
$index = 1;
$state_name = 'ibm-amm_BlowerControllerState';
$state_descr = 'Blower Controller ';
$oids = array(
'blower1ControllerState' => '.1.3.6.1.4.1.2.3.51.2.2.3.30.0',
'blower2ControllerState' => '.1.3.6.1.4.1.2.3.51.2.2.3.31.0',
'blower3ControllerState' => '.1.3.6.1.4.1.2.3.51.2.2.3.32.0',
'blower4ControllerState' => '.1.3.6.1.4.1.2.3.51.2.2.3.33.0');
foreach ($oids as $state_name => $oid) {
'.1.3.6.1.4.1.2.3.51.2.2.3.30.0', // BLADE-MIB::blower1ControllerState.0
'.1.3.6.1.4.1.2.3.51.2.2.3.31.0', // BLADE-MIB::blower2ControllerState.0
'.1.3.6.1.4.1.2.3.51.2.2.3.32.0', // BLADE-MIB::blower3ControllerState.0
'.1.3.6.1.4.1.2.3.51.2.2.3.33.0', // BLADE-MIB::blower4ControllerState.0
);
/* BLADE-MIB: blower1ControllerState
* operational(0),
* flashing(1),
* notPresent(2),
* communicationError(3),
* unknown(255)
*/
foreach ($oids as $oid) {
$state = snmp_get($device, $oid, '-Oqv');
$descr = $state_descr . $index;
if (is_numeric($state) && $state != 2) {
@@ -76,11 +95,11 @@ if ($device['os'] == 'ibm-amm') {
if ($state_index_id) {
$states = array(
array($state_index_id,'operational',0,0,0),
array($state_index_id,'flashing',1,1,1),
array($state_index_id,'notPresent',1,2,2),
array($state_index_id,'communicationError',1,3,2),
array($state_index_id,'unknown',1,4,2),
array($state_index_id, 'operational', 1, 0, 0),
array($state_index_id, 'flashing', 1, 1, 1),
array($state_index_id, 'notPresent', 1, 2, -1),
array($state_index_id, 'communicationError', 1, 3, 2),
array($state_index_id, 'unknown', 0, 255, 3),
);
foreach($states as $value) {
@@ -96,7 +115,7 @@ if ($device['os'] == 'ibm-amm') {
}//end if
discover_sensor($valid['sensor'], 'state', $device, $oid, $index, $state_name, $state_name, '1', '1', null, null, null, null, $state, 'snmp', $index);
discover_sensor($valid['sensor'], 'state', $device, $oid, $index, $state_name, $descr, '1', '1', null, null, null, null, $state, 'snmp', $index);
//Create Sensor To State Index
create_sensor_to_state_index($device, $state_name, $index);
$index++;
@@ -105,4 +124,57 @@ if ($device['os'] == 'ibm-amm') {
}//end foreach
$index = 1;
$state_name = 'ibm-amm_PowerModuleState';
$state_descr = 'Power Module ';
$powerModuleStateOid= '.1.3.6.1.4.1.2.3.51.2.2.4.1.1.3'; // BLADE-MIB::powerModuleState
$data = snmpwalk_cache_oid_num($device, $powerModuleStateOid, array());
/* BLADE-MIB: powerModuleState
* unknown(0),
* good(1),
* warning(2),
* notAvailable(3),
* critical(4)
*/
foreach ($data as $oid => $array) {
$state = current($array); // get the first (and only) item from the array
$descr = $state_descr . $index;
if (is_numeric($state) && $state != 3) {
$state_index_id = create_state_index($state_name);
if ($state_index_id) {
$states = array(
array($state_index_id, 'unknown', 0, 0, 3),
array($state_index_id, 'good', 1, 1, 0),
array($state_index_id, 'warning', 1, 2, 1),
array($state_index_id, 'notAvailable', 1, 3, -1),
array($state_index_id, 'critical', 1, 4, 2),
);
foreach ($states as $value) {
$insert = array(
'state_index_id' => $value[0],
'state_descr' => $value[1],
'state_draw_graph' => $value[2],
'state_value' => $value[3],
'state_generic_value' => $value[4]
);
dbInsert($insert, 'state_translations');
}//end foreach
}//end if
discover_sensor($valid['sensor'], 'state', $device, $oid, $index, $state_name, $descr, '1', '1', null, null,
null, null, $state, 'snmp', $index);
//Create Sensor To State Index
create_sensor_to_state_index($device, $state_name, $index);
$index++;
}//end if
}//end foreach
}//end if

View File

@@ -0,0 +1,33 @@
<?php
/*
* LibreNMS
*
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
if ($device['os'] == 'comware') {
$entphydata = dbFetchRows("SELECT `entPhysicalIndex`, `entPhysicalClass`, `entPhysicalName` FROM `entPhysical` WHERE `device_id` = ? AND `entPhysicalClass` REGEXP 'module|sensor' ORDER BY `entPhysicalIndex`", array(
$device['device_id']
));
if (!empty($entphydata)) {
$tempdata = snmpwalk_cache_multi_oid($device, 'hh3cEntityExtTemperature', array(), 'HH3C-ENTITY-EXT-MIB');
foreach ($entphydata as $index) {
foreach ($tempdata as $tempindex => $value) {
if ($index['entPhysicalIndex'] == $tempindex) {
$cur_oid = '.1.3.6.1.4.1.25506.2.6.1.1.1.1.12.';
discover_sensor($valid['sensor'], 'temperature', $device, $cur_oid . $tempindex, $tempindex, 'comware', $index['entPhysicalName'], '1', '1', null, null, null, null, $value['hh3cEntityExtTemperature'], 'snmp', $index);
}
}
}
}
}

View File

@@ -11,8 +11,8 @@
*/
if ($device['os'] == 'ibm-amm') {
$oid = 'BLADE-MIB::mmTemp.0';
$mmtemp = snmp_get($device, $oid, '-OsqnU');
$oid = '.1.3.6.1.4.1.2.3.51.2.2.1.1.2.0'; // BLADE-MIB::mmTemp.0
$mmtemp = snmp_get($device, $oid, '-Oqv');
preg_match('/[\d\.]+/', $mmtemp, $temp_response);
if (!empty($temp_response[0])) {
@@ -28,8 +28,8 @@ if ($device['os'] == 'ibm-amm') {
discover_sensor($valid['sensor'], 'temperature', $device, $oid, $oid, 'ibm-amm', $descr, $divisor, '1', null, null, null, null, $current);
}
$oid = 'BLADE-MIB::frontPanelTemp.0';
$fptemp = snmp_get($device, $oid, '-OsqnU');
$oid = '.1.3.6.1.4.1.2.3.51.2.2.1.5.1.0'; // BLADE-MIB::frontPanelTemp.0
$fptemp = snmp_get($device, $oid, '-Oqv');
preg_match('/[\d\.]+/', $fptemp, $temp_response);
if (!empty($temp_response[0])) {

View File

@@ -0,0 +1,132 @@
<?php
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/app-nfs-stats-'.$app['app_id'].'.rrd';
$options = '-O qv';
$mib = 'NET-SNMP-EXTEND-MIB';
$oid = '.1.3.6.1.4.1.8072.1.3.2.4.1.2.7.110.102.115.115.116.97.116';
echo 'nfs-v3-stats';
$nfsstats = snmp_walk($device, $oid, $options, $mib);
list($ra_size,$rc_hits,$rc_misses,$rc_nocache,$fh_lookup,$fh_anon,$fh_ncachedir,$fh_ncachenondir,$fh_stale,$io_read,$io_write,$ra_range01,$ra_range02,$ra_range03,$ra_range04,$ra_range05,$ra_range06,$ra_range07,$ra_range08,$ra_range09,$ra_range10,$ra_notfound,$net_all,$net_udp,$net_tcp,$net_tcpconn,$rpc_calls,$rpc_badcalls,$rpc_badfmt,$rpc_badauth,$rpc_badclnt,$proc3_null,$proc3_getattr,$proc3_setattr,$proc3_lookup,$proc3_access,$proc3_readlink,$proc3_read,$proc3_write,$proc3_create,$proc3_mkdir,$proc3_symlink,$proc3_mknod,$proc3_remove,$proc3_rmdir,$proc3_rename,$proc3_link,$proc3_readdir,$proc3_readdirplus,$proc3_fsstat,$proc3_fsinfo,$proc3_pathconf,$proc3_commit) = explode("\n",$nfsstats);
if(!is_file($rrd_filename))
{
rrdtool_create(
$rrd_filename,
'--step 300
DS:rc_hits:GAUGE:600:0:U
DS:rc_misses:GAUGE:600:0:U
DS:rc_nocache:GAUGE:600:0:U
DS:fh_lookup:GAUGE:600:0:U
DS:fh_anon:GAUGE:600:0:U
DS:fh_ncachedir:GAUGE:600:0:U
DS:fh_ncachenondir:GAUGE:600:0:U
DS:fh_stale:GAUGE:600:0:U
DS:io_read:GAUGE:600:0:U
DS:io_write:GAUGE:600:0:U
DS:ra_size:GAUGE:600:0:U
DS:ra_range01:GAUGE:600:0:U
DS:ra_range02:GAUGE:600:0:U
DS:ra_range03:GAUGE:600:0:U
DS:ra_range04:GAUGE:600:0:U
DS:ra_range05:GAUGE:600:0:U
DS:ra_range06:GAUGE:600:0:U
DS:ra_range07:GAUGE:600:0:U
DS:ra_range08:GAUGE:600:0:U
DS:ra_range09:GAUGE:600:0:U
DS:ra_range10:GAUGE:600:0:U
DS:ra_notfound:GAUGE:600:0:U
DS:net_all:GAUGE:600:0:U
DS:net_udp:GAUGE:600:0:U
DS:net_tcp:GAUGE:600:0:U
DS:net_tcpconn:GAUGE:600:0:U
DS:rpc_calls:GAUGE:600:0:U
DS:rpc_badcalls:GAUGE:600:0:U
DS:rpc_badfmt:GAUGE:600:0:U
DS:rpc_badauth:GAUGE:600:0:U
DS:rpc_badclnt:GAUGE:600:0:U
DS:proc3_null:GAUGE:600:0:U
DS:proc3_getattr:GAUGE:600:0:U
DS:proc3_setattr:GAUGE:600:0:U
DS:proc3_lookup:GAUGE:600:0:U
DS:proc3_access:GAUGE:600:0:U
DS:proc3_readlink:GAUGE:600:0:U
DS:proc3_read:GAUGE:600:0:U
DS:proc3_write:GAUGE:600:0:U
DS:proc3_create:GAUGE:600:0:U
DS:proc3_mkdir:GAUGE:600:0:U
DS:proc3_symlink:GAUGE:600:0:U
DS:proc3_mknod:GAUGE:600:0:U
DS:proc3_remove:GAUGE:600:0:U
DS:proc3_rmdir:GAUGE:600:0:U
DS:proc3_rename:GAUGE:600:0:U
DS:proc3_link:GAUGE:600:0:U
DS:proc3_readdir:GAUGE:600:0:U
DS:proc3_readdirplus:GAUGE:600:0:U
DS:proc3_fsstat:GAUGE:600:0:U
DS:proc3_fsinfo:GAUGE:600:0:U
DS:proc3_pathconf:GAUGE:600:0:U
DS:proc3_commit:GAUGE:600:0:U
'.$config['rrd_rra']
);
}
$fields = array(
'rc_hits' => $rc_hits,
'rc_misses' => $rc_misses,
'rc_nocache' => $rc_nocache,
'fh_lookup' => $fh_lookup,
'fh_anon' => $fh_anon,
'fh_ncachedir' => $fh_ncachedir,
'fh_ncachenondir' => $fh_ncachenondir,
'fh_stale' => $fh_stale,
'io_read' => $io_read,
'io_write' => $io_write,
'ra_size' => $ra_size,
'ra_range01' => $ra_range01,
'ra_range02' => $ra_range02,
'ra_range03' => $ra_range03,
'ra_range04' => $ra_range04,
'ra_range05' => $ra_range05,
'ra_range06' => $ra_range06,
'ra_range07' => $ra_range07,
'ra_range08' => $ra_range08,
'ra_range09' => $ra_range09,
'ra_range10' => $ra_range10,
'ra_notfound'=> $ra_notfound,
'net_all' => $net_all,
'net_udp' => $net_udp,
'net_tcp' => $net_tcp,
'net_tcpconn' => $net_tcpconn,
'rpc_calls' => $rpc_calls,
'rpc_badcalls' => $rpc_badcalls,
'rpc_badfmt' => $rpc_badfmt,
'rpc_badauth' => $rpc_badauth,
'rpc_badclnt' => $rpc_badclnt,
'proc3_null' => $proc3_null,
'proc3_getattr' => $proc3_getattr,
'proc3_setattr' => $proc3_setattr,
'proc3_lookup' => $proc3_lookup,
'proc3_access' => $proc3_access,
'proc3_readlink' => $proc3_readlink,
'proc3_read' => $proc3_read,
'proc3_write' => $proc3_write,
'proc3_create' => $proc3_create,
'proc3_mkdir' => $proc3_mkdir,
'proc3_symlink' => $proc3_symlink,
'proc3_mknod' => $proc3_mknod,
'proc3_remove' => $proc3_remove,
'proc3_rmdir' => $proc3_rmdir,
'proc3_rename' => $proc3_rename,
'proc3_link' => $proc3_link,
'proc3_readdir' => $proc3_readdir,
'proc3_readdirplus' => $proc3_readdirplus,
'proc3_fsstat' => $proc3_fsstat,
'proc3_fsinfo' => $proc3_fsinfo,
'proc3_pathconf' => $proc3_pathconf,
'proc3_commit' => $proc3_commit,
);
rrdtool_update($rrd_filename, $fields);
$tags = array('name' => 'nfs-v3-stats', 'app_id' => $app['app_id']);
influx_update($device,'app',$tags,$fields);

View File

@@ -0,0 +1,126 @@
<?php
/**
* powerdns-recursor.inc.php
*
* PowerDNS Recursor application polling module
* Capable of collecting stats from the agent or via direct connection
*
* 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>
*/
echo ' powerdns-recrusor';
global $config;
$data = '';
$name = 'powerdns-recursor';
$app_id = $app['app_id'];
if ($agent_data['app'][$name]) {
$data = $agent_data['app'][$name];
} elseif (isset($config['apps'][$name]['api-key'])) {
d_echo("\nNo Agent Data. Attempting to connect directly to the powerdns-recursor server " . $device['hostname'] . ":8082\n");
$context = stream_context_create(array('http' => array('header' => 'X-API-Key: ' . $config['apps'][$name]['api-key'])));
$data = file_get_contents('http://' . $device['hostname'] . ':8082/servers/localhost/statistics', false, $context);
}
if (!empty($data)) {
$rrd_def = array(
'all-outqueries' => 'DS:all-outqueries:COUNTER:600:0:U',
'answers-slow' => 'DS:answers-slow:COUNTER:600:0:U',
'answers0-1' => 'DS:answers0-1:COUNTER:600:0:U',
'answers1-10' => 'DS:answers1-10:COUNTER:600:0:U',
'answers10-100' => 'DS:answers10-100:COUNTER:600:0:U',
'answers100-1000' => 'DS:answers100-1000:COUNTER:600:0:U',
'cache-entries' => 'DS:cache-entries:GAUGE:600:0:U',
'cache-hits' => 'DS:cache-hits:COUNTER:600:0:U',
'cache-misses' => 'DS:cache-misses:COUNTER:600:0:U',
'case-mismatches' => 'DS:case-mismatches:COUNTER:600:0:U',
'chain-resends' => 'DS:chain-resends:COUNTER:600:0:U',
'client-parse-errors' => 'DS:client-parse-errors:COUNTER:600:0:U',
'concurrent-queries' => 'DS:concurrent-queries:GAUGE:600:0:U',
'dlg-only-drops' => 'DS:dlg-only-drops:COUNTER:600:0:U',
'dont-outqueries' => 'DS:dont-outqueries:COUNTER:600:0:U',
'edns-ping-matches' => 'DS:edns-ping-matches:COUNTER:600:0:U',
'edns-ping-mismatches' => 'DS:edns-ping-mismatches:COUNTER:600:0:U',
'failed-host-entries' => 'DS:failed-host-entries:GAUGE:600:0:U',
'ipv6-outqueries' => 'DS:ipv6-outqueries:COUNTER:600:0:U',
'ipv6-questions' => 'DS:ipv6-questions:COUNTER:600:0:U',
'malloc-bytes' => 'DS:malloc-bytes:GAUGE:600:0:U',
'max-mthread-stack' => 'DS:max-mthread-stack:GAUGE:600:0:U',
'negcache-entries' => 'DS:negcache-entries:GAUGE:600:0:U',
'no-packet-error' => 'DS:no-packet-error:COUNTER:600:0:U',
'noedns-outqueries' => 'DS:noedns-outqueries:COUNTER:600:0:U',
'noerror-answers' => 'DS:noerror-answers:COUNTER:600:0:U',
'noping-outqueries' => 'DS:noping-outqueries:COUNTER:600:0:U',
'nsset-invalidations' => 'DS:nsset-invalidations:COUNTER:600:0:U',
'nsspeeds-entries' => 'DS:nsspeeds-entries:GAUGE:600:0:U',
'nxdomain-answers' => 'DS:nxdomain-answers:COUNTER:600:0:U',
'outgoing-timeouts' => 'DS:outgoing-timeouts:COUNTER:600:0:U',
'over-capacity-drops' => 'DS:over-capacity-drops:COUNTER:600:0:U',
'packetcache-entries' => 'DS:packetcache-entries:GAUGE:600:0:U',
'packetcache-hits' => 'DS:packetcache-hits:COUNTER:600:0:U',
'packetcache-misses' => 'DS:packetcache-misses:COUNTER:600:0:U',
'policy-drops' => 'DS:policy-drops:COUNTER:600:0:U',
'qa-latency' => 'DS:qa-latency:GAUGE:600:0:U',
'questions' => 'DS:questions:COUNTER:600:0:U',
'resource-limits' => 'DS:resource-limits:COUNTER:600:0:U',
'security-status' => 'DS:security-status:GAUGE:600:0:U',
'server-parse-errors' => 'DS:server-parse-errors:COUNTER:600:0:U',
'servfail-answers' => 'DS:servfail-answers:COUNTER:600:0:U',
'spoof-prevents' => 'DS:spoof-prevents:COUNTER:600:0:U',
'sys-msec' => 'DS:sys-msec:COUNTER:600:0:U',
'tcp-client-overflow' => 'DS:tcp-client-overflow:COUNTER:600:0:U',
'tcp-clients' => 'DS:tcp-clients:GAUGE:600:0:U',
'tcp-outqueries' => 'DS:tcp-outqueries:COUNTER:600:0:U',
'tcp-questions' => 'DS:tcp-questions:COUNTER:600:0:U',
'throttle-entries' => 'DS:throttle-entries:GAUGE:600:0:U',
'throttled-out' => 'DS:throttled-out:COUNTER:600:0:U',
'throttled-outqueries' => 'DS:throttled-outquerie:COUNTER:600:0:U',
'too-old-drops' => 'DS:too-old-drops:COUNTER:600:0:U',
'unauthorized-tcp' => 'DS:unauthorized-tcp:COUNTER:600:0:U',
'unauthorized-udp' => 'DS:unauthorized-udp:COUNTER:600:0:U',
'unexpected-packets' => 'DS:unexpected-packets:COUNTER:600:0:U',
'unreachables' => 'DS:unreachables:COUNTER:600:0:U',
'uptime' => 'DS:uptime:COUNTER:600:0:U',
'user-msec' => 'DS:user-msec:COUNTER:600:0:U',
);
//decode and flatten the data
$stats = array();
foreach (json_decode($data, true) as $stat) {
$stats[$stat['name']] = $stat['value'];
}
d_echo($stats);
// only the stats we store in rrd
$fields = array();
foreach ($rrd_def as $key => $value) {
if (isset($stats[$key])) {
$fields[$key] = $stats[$key];
} else {
$fields[$key] = 'U';
}
}
$rrd_name = array('app', 'powerdns', 'recursor', $app_id);
$tags = compact('name', 'app_id', 'rrd_name', 'rrd_def');
data_update($device, 'app', $tags, $fields);
}
unset($data, $stats, $rrd_def, $rrd_name, $rrd_keys, $tags, $fields);

View File

@@ -106,11 +106,11 @@ if ($device['os_group'] == "cisco") {
// If we have set a message, we have an error, activate alert.
if ($message !== false) {
$array['error'] = $message;
$array['status'] = 0;
$array['status'] = 2;
}
else {
$array['error'] = "";
$array['status'] = 1;
$array['status'] = 0;
}
// Time to graph the count of the active VLAN's on this overlay.
@@ -154,11 +154,11 @@ if ($device['os_group'] == "cisco") {
// If we have set a message, we have an error, activate alert.
if ($message !== false) {
$array['error'] = $message;
$array['status'] = 0;
$array['status'] = 1;
}
else {
$array['error'] = "";
$array['status'] = 1;
$array['status'] = 0;
}
// Let's log some debugging

View File

@@ -6,7 +6,7 @@
// SNMPv2-MIB::sysObjectID.0 = OID: HH3C-PRODUCT-ID-MIB::hh3c-S3100-8TP-EI
echo 'Comware OS...';
$hardware = snmp_get($device, 'sysObjectID.0', '-OQsv', 'SNMPv2-MIB:HH3C-PRODUCT-ID-MIB', '+'.$config['install_dir'].'/mibs/h3c');
$hardware = snmp_get($device, 'sysObjectID.0', '-Osqv', 'SNMPv2-MIB:HH3C-PRODUCT-ID-MIB');
preg_match('/Software Version (.+), Release ([a-zA-Z0-9]+)/', $poll_device['sysDescr'], $match);
list(,$version,$features) = $match;

1847
mibs/HH3C-ENTITY-EXT-MIB Executable file

File diff suppressed because it is too large Load Diff

310
mibs/HH3C-OID-MIB Executable file
View File

@@ -0,0 +1,310 @@
-- ============================================================================
-- Copyright (c) 2004-2015 Hangzhou H3C Tech. Co., Ltd. All rights reserved.
-- Description: This MIB will maintain the products MIB OID and management
-- properties root node for H3C products
--
-- Reference:
-- Version: V1.25
-- History:
-- V1.00 2006-04-19 created by longyin
-- V1.01 2007/08/09 add hh3cSiemMib by gaolong
-- V1.02 2007/09/25 add hh3cSurveillanceMIB, hh3cVMMan, hh3cPUMan,
-- and hh3cMSMan by longyin
-- V1.03 2007/10/25 add hh3cStorageRef under hh3c,
-- and hh3cStorageMIB, hh3cStorageSnap, hh3cDisk,
-- hh3cRaid, hh3cLogicVolume under hh3cStorageRef
-- and hh3cUps under hh3cCommon by longyin
-- V1.04 2007/11/27 add hh3cEOCCommon and hh3cHPEOC by longyin
-- V1.05 2007/12/27 add hh3cAFC and hh3cMultCDR by longyin
-- V1.06 2008/02/27 add hh3cMACInformation, hh3cFireWall, hh3cDSP by longyin
-- V1.07 2008/04/29 add hh3cNetMan by songhao
-- V1.08 2008/06/02 add hh3cStack, hh3cPosa by songhao
-- V1.09 2008/07/29 add hh3cWebAuthentication by songhao
-- V1.10 2008/08/26 add hh3cCATVTransceiver by songhao
-- V1.11 2008/12/03 add hh3cLpbkdt by songhao
-- V1.12 2009/02/27 add hh3cMultiMedia, hh3cDns, hh3c3GModem
-- and hh3cPortal by songhao
-- V1.13 2009/05/18 add hh3clldp, hh3cDHCPServer, hh3cPPPoEServer,
-- hh3cL2Isolate, hh3cSnmpExt by duyanbing
-- V1.14 2009/11/04 add hh3cVsi, hh3cEvc, hh3cMinm, hh3cblg, hh3cRS485 by shuaixiaojuan
-- V1.15 2010/03/16 add hh3cARPRatelimit, hh3cLI by songhao
-- 2010/09/15 add hpNetworking by songhao
-- V1.16 2011/01/31 add hh3cDar, hh3cPBR by songhao
-- V1.17 2011/04/22 add hh3cAAANasId by duyanbing
-- V1.18 2012/04/19 add hh3cTeTunnel, hh3cLB, hh3cDldp2, hh3cWIPS, hh3cFCoE,
-- hh3cDot11Sa by duyanbing
-- V1.19 2013/01/08 add hh3cInfoCenter, hh3cTRNG2, hh3cDhcp4, hh3cDhcpSnoop2,
-- hh3cRmonExt, hh3cIPsecMonitorV2, hh3cSanAgg, hh3cSpb,
-- hh3cPortExtender, hh3cSlbg, hh3cFdmi, hh3cFirmwareUpgrade,
-- hh3cIssuUpgrade by songhao
-- V1.20 2013/04/26 add hh3cEvb, hh3cFcoeMode, hh3cMDC, hh3cQinQv2, hh3cVmap
-- modify name of 127, 129, 132 under hh3cCommon by songhao
-- V1.21 2013/09/22 remove hh3cFdmi under hh3cCommon
-- add hh3cL2tp, hh3cMultilinkPPPV2, hh3cBpa by songhao
-- V1.22 2014/01/27 add hh3cLocAAASrv, hh3cMplsExt, hh3cMplsTe, hh3cLicense,
-- hh3cLBv2, hh3cSession, hh3cARPSourceSuppression, hh3cVxlan
-- under hh3cCommon by songhao
-- V1.23 2014/04/27 add hh3cRddc, hh3cIpRanDcn, hh3cContext
-- modify name of 129 under hh3cCommon by songhao
-- V1.24 2014/09/18 add hh3cJointMibs, hh3cMulticastSnoop, hh3cPvst, hh3cSmlk,
-- hh3c8021XExt2, hh3cObjp, hh3cNvgre by songhao
-- V1.25 2015/04/23 add 157 to 162 under hh3cCommon by songhao
-- ============================================================================
HH3C-OID-MIB DEFINITIONS ::= BEGIN
IMPORTS
enterprises
FROM RFC1155-SMI;
-- Object under .enterprises
hh3c OBJECT IDENTIFIER ::= { enterprises 25506 }
-- Object under .enterprises.hh3c
hh3cProductId OBJECT IDENTIFIER ::= { hh3c 1 }
hh3cCommon OBJECT IDENTIFIER ::= { hh3c 2 }
hh3cEntityVendorTypeOID OBJECT IDENTIFIER ::= { hh3c 3 }
hh3cNM OBJECT IDENTIFIER ::= { hh3c 4 }
hh3cSystem OBJECT IDENTIFIER ::= { hh3c 6 }
hh3cSNMPAgCpb OBJECT IDENTIFIER ::= { hh3c 7 }
hh3cRhw OBJECT IDENTIFIER ::= { hh3c 8 }
hh3cSurveillanceMIB OBJECT IDENTIFIER ::= { hh3c 9 }
hh3cStorageRef OBJECT IDENTIFIER ::= { hh3c 10 }
hpNetworking OBJECT IDENTIFIER ::= { hh3c 11 }
hh3cJointMibs OBJECT IDENTIFIER ::= { hh3c 12 }
-- Object under .enterprises.hh3c.hh3cCommon
hh3cFtm OBJECT IDENTIFIER ::= { hh3cCommon 1 }
hh3cUIMgt OBJECT IDENTIFIER ::= { hh3cCommon 2 }
hh3cSystemMan OBJECT IDENTIFIER ::= { hh3cCommon 3 }
hh3cConfig OBJECT IDENTIFIER ::= { hh3cCommon 4 }
hh3cFlash OBJECT IDENTIFIER ::= { hh3cCommon 5 }
hh3cEntityExtend OBJECT IDENTIFIER ::= { hh3cCommon 6 }
hh3cIPSecMonitor OBJECT IDENTIFIER ::= { hh3cCommon 7 }
hh3cAcl OBJECT IDENTIFIER ::= { hh3cCommon 8 }
hh3cVoiceVlan OBJECT IDENTIFIER ::= { hh3cCommon 9 }
hh3cL4Redirect OBJECT IDENTIFIER ::= { hh3cCommon 10 }
hh3cIpPBX OBJECT IDENTIFIER ::= { hh3cCommon 11 }
hh3cUser OBJECT IDENTIFIER ::= { hh3cCommon 12 }
hh3cRadius OBJECT IDENTIFIER ::= { hh3cCommon 13 }
hh3cPowerEthernetExt OBJECT IDENTIFIER ::= { hh3cCommon 14 }
hh3cEntityRelation OBJECT IDENTIFIER ::= { hh3cCommon 15 }
hh3cProtocolVlan OBJECT IDENTIFIER ::= { hh3cCommon 16 }
hh3cQosProfile OBJECT IDENTIFIER ::= { hh3cCommon 17 }
hh3cNat OBJECT IDENTIFIER ::= { hh3cCommon 18 }
hh3cPos OBJECT IDENTIFIER ::= { hh3cCommon 19 }
hh3cNS OBJECT IDENTIFIER ::= { hh3cCommon 20 }
hh3cAAL5 OBJECT IDENTIFIER ::= { hh3cCommon 21 }
hh3cSSH OBJECT IDENTIFIER ::= { hh3cCommon 22 }
hh3cRSA OBJECT IDENTIFIER ::= { hh3cCommon 23 }
hh3cVrrpExt OBJECT IDENTIFIER ::= { hh3cCommon 24 }
hh3cIpa OBJECT IDENTIFIER ::= { hh3cCommon 25 }
hh3cPortSecurity OBJECT IDENTIFIER ::= { hh3cCommon 26 }
hh3cVpls OBJECT IDENTIFIER ::= { hh3cCommon 27 }
hh3cE1 OBJECT IDENTIFIER ::= { hh3cCommon 28 }
hh3cT1 OBJECT IDENTIFIER ::= { hh3cCommon 29 }
hh3cIKEMonitor OBJECT IDENTIFIER ::= { hh3cCommon 30 }
hh3cWebSwitch OBJECT IDENTIFIER ::= { hh3cCommon 31 }
hh3cAutoDetect OBJECT IDENTIFIER ::= { hh3cCommon 32 }
hh3cIpBroadcast OBJECT IDENTIFIER ::= { hh3cCommon 33 }
hh3cIpx OBJECT IDENTIFIER ::= { hh3cCommon 34 }
hh3cIPS OBJECT IDENTIFIER ::= { hh3cCommon 35 }
hh3cDhcpSnoop OBJECT IDENTIFIER ::= { hh3cCommon 36 }
hh3cProtocolPriority OBJECT IDENTIFIER ::= { hh3cCommon 37 }
hh3cTrap OBJECT IDENTIFIER ::= { hh3cCommon 38 }
hh3cVoice OBJECT IDENTIFIER ::= { hh3cCommon 39 }
hh3cIfExt OBJECT IDENTIFIER ::= { hh3cCommon 40 }
hh3cCfCard OBJECT IDENTIFIER ::= { hh3cCommon 41 }
hh3cEpon OBJECT IDENTIFIER ::= { hh3cCommon 42 }
hh3cDldp OBJECT IDENTIFIER ::= { hh3cCommon 43 }
hh3cUnicast OBJECT IDENTIFIER ::= { hh3cCommon 44 }
hh3cRrpp OBJECT IDENTIFIER ::= { hh3cCommon 45 }
hh3cDomain OBJECT IDENTIFIER ::= { hh3cCommon 46 }
hh3cIds OBJECT IDENTIFIER ::= { hh3cCommon 47 }
hh3cRcr OBJECT IDENTIFIER ::= { hh3cCommon 48 }
hh3cAtmDxi OBJECT IDENTIFIER ::= { hh3cCommon 49 }
hh3cMulticast OBJECT IDENTIFIER ::= { hh3cCommon 50 }
hh3cMpm OBJECT IDENTIFIER ::= { hh3cCommon 51 }
hh3cOadp OBJECT IDENTIFIER ::= { hh3cCommon 52 }
hh3cTunnel OBJECT IDENTIFIER ::= { hh3cCommon 53 }
hh3cGre OBJECT IDENTIFIER ::= { hh3cCommon 54 }
hh3cObjectInfo OBJECT IDENTIFIER ::= { hh3cCommon 55 }
hh3cStorage OBJECT IDENTIFIER ::= { hh3cCommon 56 }
hh3cDvpn OBJECT IDENTIFIER ::= { hh3cCommon 57 }
hh3cDhcpRelay OBJECT IDENTIFIER ::= { hh3cCommon 58 }
hh3cIsis OBJECT IDENTIFIER ::= { hh3cCommon 59 }
hh3cRpr OBJECT IDENTIFIER ::= { hh3cCommon 60 }
hh3cSubnetVlan OBJECT IDENTIFIER ::= { hh3cCommon 61 }
hh3cDlswExt OBJECT IDENTIFIER ::= { hh3cCommon 62 }
hh3cSyslog OBJECT IDENTIFIER ::= { hh3cCommon 63 }
hh3cFlowTemplate OBJECT IDENTIFIER ::= { hh3cCommon 64 }
hh3cQos2 OBJECT IDENTIFIER ::= { hh3cCommon 65 }
hh3cStormConstrain OBJECT IDENTIFIER ::= { hh3cCommon 66 }
hh3cIpAddrMIB OBJECT IDENTIFIER ::= { hh3cCommon 67 }
hh3cMirrGroup OBJECT IDENTIFIER ::= { hh3cCommon 68 }
hh3cQINQ OBJECT IDENTIFIER ::= { hh3cCommon 69 }
hh3cTransceiver OBJECT IDENTIFIER ::= { hh3cCommon 70 }
hh3cIpv6AddrMIB OBJECT IDENTIFIER ::= { hh3cCommon 71 }
hh3cBfdMIB OBJECT IDENTIFIER ::= { hh3cCommon 72 }
hh3cRCP OBJECT IDENTIFIER ::= { hh3cCommon 73 }
hh3cAcfp OBJECT IDENTIFIER ::= { hh3cCommon 74 }
hh3cDot11 OBJECT IDENTIFIER ::= { hh3cCommon 75 }
hh3cE1T1VI OBJECT IDENTIFIER ::= { hh3cCommon 76 }
hh3cL2VpnPwe3 OBJECT IDENTIFIER ::= { hh3cCommon 78 }
hh3cMplsOam OBJECT IDENTIFIER ::= { hh3cCommon 79 }
hh3cMplsOamPs OBJECT IDENTIFIER ::= { hh3cCommon 80 }
hh3cSiemMib OBJECT IDENTIFIER ::= { hh3cCommon 81 }
hh3cUps OBJECT IDENTIFIER ::= { hh3cCommon 82 }
hh3cEOCCommon OBJECT IDENTIFIER ::= { hh3cCommon 83 }
hh3cHPEOC OBJECT IDENTIFIER ::= { hh3cCommon 84 }
hh3cAFC OBJECT IDENTIFIER ::= { hh3cCommon 85 }
hh3cMultCDR OBJECT IDENTIFIER ::= { hh3cCommon 86 }
hh3cMACInformation OBJECT IDENTIFIER ::= { hh3cCommon 87 }
hh3cFireWall OBJECT IDENTIFIER ::= { hh3cCommon 88 }
hh3cDSP OBJECT IDENTIFIER ::= { hh3cCommon 89 }
hh3cNetMan OBJECT IDENTIFIER ::= { hh3cCommon 90 }
hh3cStack OBJECT IDENTIFIER ::= { hh3cCommon 91 }
hh3cPosa OBJECT IDENTIFIER ::= { hh3cCommon 92 }
hh3cWebAuthentication OBJECT IDENTIFIER ::= { hh3cCommon 93 }
hh3cCATVTransceiver OBJECT IDENTIFIER ::= { hh3cCommon 94 }
hh3cLpbkdt OBJECT IDENTIFIER ::= { hh3cCommon 95 }
hh3cMultiMedia OBJECT IDENTIFIER ::= { hh3cCommon 96 }
hh3cDns OBJECT IDENTIFIER ::= { hh3cCommon 97 }
hh3c3GModem OBJECT IDENTIFIER ::= { hh3cCommon 98 }
hh3cPortal OBJECT IDENTIFIER ::= { hh3cCommon 99 }
hh3clldp OBJECT IDENTIFIER ::= { hh3cCommon 100 }
hh3cDHCPServer OBJECT IDENTIFIER ::= { hh3cCommon 101 }
hh3cPPPoEServer OBJECT IDENTIFIER ::= { hh3cCommon 102 }
hh3cL2Isolate OBJECT IDENTIFIER ::= { hh3cCommon 103 }
hh3cSnmpExt OBJECT IDENTIFIER ::= { hh3cCommon 104 }
hh3cVsi OBJECT IDENTIFIER ::= { hh3cCommon 105 }
hh3cEvc OBJECT IDENTIFIER ::= { hh3cCommon 106 }
hh3cMinm OBJECT IDENTIFIER ::= { hh3cCommon 107 }
hh3cBlg OBJECT IDENTIFIER ::= { hh3cCommon 108 }
hh3cRS485 OBJECT IDENTIFIER ::= { hh3cCommon 109 }
hh3cARPRatelimit OBJECT IDENTIFIER ::= { hh3cCommon 110 }
hh3cLI OBJECT IDENTIFIER ::= { hh3cCommon 111 }
hh3cDar OBJECT IDENTIFIER ::= { hh3cCommon 112 }
hh3cPBR OBJECT IDENTIFIER ::= { hh3cCommon 113 }
hh3cAAANasId OBJECT IDENTIFIER ::= { hh3cCommon 114 }
hh3cTeTunnel OBJECT IDENTIFIER ::= { hh3cCommon 115 }
hh3cLB OBJECT IDENTIFIER ::= { hh3cCommon 116 }
hh3cDldp2 OBJECT IDENTIFIER ::= { hh3cCommon 117 }
hh3cWIPS OBJECT IDENTIFIER ::= { hh3cCommon 118 }
hh3cInfoCenter OBJECT IDENTIFIER ::= { hh3cCommon 119 }
hh3cFCoE OBJECT IDENTIFIER ::= { hh3cCommon 120 }
hh3cTRNG2 OBJECT IDENTIFIER ::= { hh3cCommon 121 }
hh3cDhcp4 OBJECT IDENTIFIER ::= { hh3cCommon 122 }
hh3cMulticastSnoop OBJECT IDENTIFIER ::= { hh3cCommon 123 }
hh3cDhcpSnoop2 OBJECT IDENTIFIER ::= { hh3cCommon 124 }
hh3cRmonExt OBJECT IDENTIFIER ::= { hh3cCommon 125 }
hh3cIPsecMonitorV2 OBJECT IDENTIFIER ::= { hh3cCommon 126 }
hh3cSan OBJECT IDENTIFIER ::= { hh3cCommon 127 }
hh3cSpb OBJECT IDENTIFIER ::= { hh3cCommon 128 }
hh3cPex OBJECT IDENTIFIER ::= { hh3cCommon 129 }
hh3cSlbg OBJECT IDENTIFIER ::= { hh3cCommon 130 }
hh3cPvst OBJECT IDENTIFIER ::= { hh3cCommon 131 }
hh3cEvi OBJECT IDENTIFIER ::= { hh3cCommon 132 }
hh3cIssuUpgrade OBJECT IDENTIFIER ::= { hh3cCommon 133 }
hh3cEvb OBJECT IDENTIFIER ::= { hh3cCommon 134 }
hh3cFcoeMode OBJECT IDENTIFIER ::= { hh3cCommon 135 }
hh3cMDC OBJECT IDENTIFIER ::= { hh3cCommon 136 }
hh3cQinQv2 OBJECT IDENTIFIER ::= { hh3cCommon 137 }
hh3cVmap OBJECT IDENTIFIER ::= { hh3cCommon 138 }
hh3cL2tp OBJECT IDENTIFIER ::= { hh3cCommon 139 }
hh3cMultilinkPPPV2 OBJECT IDENTIFIER ::= { hh3cCommon 140 }
hh3cLocAAASrv OBJECT IDENTIFIER ::= { hh3cCommon 141 }
hh3cMplsExt OBJECT IDENTIFIER ::= { hh3cCommon 142 }
hh3cMplsTe OBJECT IDENTIFIER ::= { hh3cCommon 143 }
hh3cBpa OBJECT IDENTIFIER ::= { hh3cCommon 144 }
hh3cLicense OBJECT IDENTIFIER ::= { hh3cCommon 145 }
hh3cSmlk OBJECT IDENTIFIER ::= { hh3cCommon 147 }
hh3cARPSourceSuppression OBJECT IDENTIFIER ::= { hh3cCommon 146 }
hh3cLBv2 OBJECT IDENTIFIER ::= { hh3cCommon 148 }
hh3cSession OBJECT IDENTIFIER ::= { hh3cCommon 149 }
hh3cVxlan OBJECT IDENTIFIER ::= { hh3cCommon 150 }
hh3cRddc OBJECT IDENTIFIER ::= { hh3cCommon 151 }
hh3cIpRanDcn OBJECT IDENTIFIER ::= { hh3cCommon 152 }
hh3c8021XExt2 OBJECT IDENTIFIER ::= { hh3cCommon 153 }
hh3cContext OBJECT IDENTIFIER ::= { hh3cCommon 154 }
hh3cObjp OBJECT IDENTIFIER ::= { hh3cCommon 155 }
hh3cNvgre OBJECT IDENTIFIER ::= { hh3cCommon 156 }
hh3cWlanMt OBJECT IDENTIFIER ::= { hh3cCommon 157 }
hh3cRbac OBJECT IDENTIFIER ::= { hh3cCommon 158 }
hh3cDHCP6Server OBJECT IDENTIFIER ::= { hh3cCommon 159 }
hh3cMplsVpnBgp OBJECT IDENTIFIER ::= { hh3cCommon 160 }
hh3cOspf OBJECT IDENTIFIER ::= { hh3cCommon 161 }
hh3cL2vpn OBJECT IDENTIFIER ::= { hh3cCommon 162 }
-- under enterprises.hh3c.hh3cCommon.hh3cQos2
hh3cIfQos2 OBJECT IDENTIFIER ::= { hh3cQos2 1 }
hh3cCBQos2 OBJECT IDENTIFIER ::= { hh3cQos2 2 }
-- under enterprises.hh3c.hh3cSNMPAgCpb
hh3cQosCapability OBJECT IDENTIFIER ::= { hh3cSNMPAgCpb 1 }
-- under enterprises.hh3c.hh3cRhw
hh3cDHCPRelayMib OBJECT IDENTIFIER ::= { hh3cRhw 1 }
hh3cDHCPServerMib OBJECT IDENTIFIER ::= { hh3cRhw 2 }
hh3cNqa OBJECT IDENTIFIER ::= { hh3cRhw 3 }
hh3crmonExtend OBJECT IDENTIFIER ::= { hh3cRhw 4 }
-- hh3cVlan OBJECT IDENTIFIER ::= { hh3cRhw 5 } removed
hh3cpaeExtMib OBJECT IDENTIFIER ::= { hh3cRhw 6 }
hh3cHgmp OBJECT IDENTIFIER ::= { hh3cRhw 7 }
hh3cDevice OBJECT IDENTIFIER ::= { hh3cRhw 8 }
hh3cMpls OBJECT IDENTIFIER ::= { hh3cRhw 12 }
hh3cTRNG OBJECT IDENTIFIER ::= { hh3cRhw 13 }
hh3cUserLogMIB OBJECT IDENTIFIER ::= { hh3cRhw 18 }
hh3cNTP OBJECT IDENTIFIER ::= { hh3cRhw 22 }
hh3cLAG OBJECT IDENTIFIER ::= { hh3cRhw 25 }
hh3cSmonExtend OBJECT IDENTIFIER ::= { hh3cRhw 26 }
hh3cQoS OBJECT IDENTIFIER ::= { hh3cRhw 32 }
hh3cMultilinkPPP OBJECT IDENTIFIER ::= { hh3cRhw 33 }
-- delete hh3crouter OBJECT IDENTIFIER ::= { hh3cRhw 34 }
hh3clswCommon OBJECT IDENTIFIER ::= { hh3cRhw 35 }
hh3cmlsr OBJECT IDENTIFIER ::= { hh3cRhw 36 }
hh3cdlsw OBJECT IDENTIFIER ::= { hh3cRhw 37 }
-- Object under .enterprises.hh3c.hh3cSurveillanceMIB
hh3cVMMan OBJECT IDENTIFIER ::= { hh3cSurveillanceMIB 1 }
hh3cPUMan OBJECT IDENTIFIER ::= { hh3cSurveillanceMIB 2 }
hh3cMSMan OBJECT IDENTIFIER ::= { hh3cSurveillanceMIB 3 }
-- Object under .enterprises.hh3c.hh3cStorageRef
hh3cStorageMIB OBJECT IDENTIFIER ::= { hh3cStorageRef 1 }
hh3cStorageSnap OBJECT IDENTIFIER ::= { hh3cStorageRef 2 }
hh3cDisk OBJECT IDENTIFIER ::= { hh3cStorageRef 3 }
hh3cRaid OBJECT IDENTIFIER ::= { hh3cStorageRef 4 }
hh3cLogicVolume OBJECT IDENTIFIER ::= { hh3cStorageRef 5 }
-- under enterprises.hh3c.hh3cRhw.hh3cMpls
hh3cMplsLsr OBJECT IDENTIFIER ::= { hh3cMpls 1 }
hh3cMplsLdp OBJECT IDENTIFIER ::= { hh3cMpls 2 }
hh3cMplsVpn OBJECT IDENTIFIER ::= { hh3cMpls 3 }
-- under enterprises.hh3c.hh3cRhw.hh3clswCommon
hh3cLswExtInterface OBJECT IDENTIFIER ::= { hh3clswCommon 1 }
hh3cLswVlan OBJECT IDENTIFIER ::= { hh3clswCommon 2 }
hh3cLswMacPort OBJECT IDENTIFIER ::= { hh3clswCommon 3 }
hh3cLswArpMib OBJECT IDENTIFIER ::= { hh3clswCommon 4 }
hh3cLswL2InfMib OBJECT IDENTIFIER ::= { hh3clswCommon 5 }
hh3cLswRstpMib OBJECT IDENTIFIER ::= { hh3clswCommon 6 }
hh3cLswIgmpsnoopingMib OBJECT IDENTIFIER ::= { hh3clswCommon 7 }
hh3cLswDhcpMib OBJECT IDENTIFIER ::= { hh3clswCommon 8 }
hh3cLswdevMMib OBJECT IDENTIFIER ::= { hh3clswCommon 9 }
hh3cLswTrapMib OBJECT IDENTIFIER ::= { hh3clswCommon 12 }
hh3cdot1sMstp OBJECT IDENTIFIER ::= { hh3clswCommon 14 }
hh3cLswQosAclMib OBJECT IDENTIFIER ::= { hh3clswCommon 16 }
hh3cLswMix OBJECT IDENTIFIER ::= { hh3clswCommon 17 }
hh3cLswDeviceAdmin OBJECT IDENTIFIER ::= { hh3clswCommon 18 }
-- under enterprises.hh3c.hh3cRhw.hh3cmlsr
hh3cNDEC OBJECT IDENTIFIER ::= { hh3cmlsr 2 }
hh3credundancyPower OBJECT IDENTIFIER ::= { hh3cmlsr 4 }
hh3credundancyFan OBJECT IDENTIFIER ::= { hh3cmlsr 5 }
-- delete hh3cmSystem OBJECT IDENTIFIER ::= { hh3cmlsr 6 }
-- delete hh3c8040If OBJECT IDENTIFIER ::= { hh3cmlsr 7 }
hh3cpos OBJECT IDENTIFIER ::= { hh3cmlsr 8 }
hh3cIsdnMib OBJECT IDENTIFIER ::= { hh3cmlsr 9 }
-- delete hh3caR46-E200 OBJECT IDENTIFIER ::= { hh3cmlsr 20 }
END

1934
mibs/HH3C-PRODUCT-ID-MIB Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,47 @@
#!/bin/bash
############################################################
# copy this file somewhere like /opt and chmod +x it #
# edit your snmpd.conf and add the below line and restart: #
# extend nfs-stats /opt/nfs-stats.sh #
############################################################
CFG_NFSFILE='/proc/net/rpc/nfsd'
BIN_CAT='/usr/bin/cat'
BIN_SED='/usr/bin/sed'
BIN_AWK='/usr/bin/awk'
BIN_TR='/usr/bin/tr'
BIN_PASTE='/usr/bin/paste'
BIN_RM='/usr/bin/rm'
BIN_MV='/usr/bin/mv'
LOG_OLD='/tmp/nfsio_old'
LOG_NEW='/tmp/nfsio_new'
LOG_FIX='/tmp/nfsio_fix'
#get reply cache (rc - values: hits, misses, nocache)
$BIN_CAT $CFG_NFSFILE | $BIN_SED -n 1p | $BIN_AWK '{print $2,$3,$4}' | $BIN_TR " " "\n" > $LOG_NEW
#get server file handle (fh - values: lookup, anon, ncachedir, ncachenondir, stale)
$BIN_CAT $CFG_NFSFILE | $BIN_SED -n 2p | $BIN_AWK '{print $2,$3,$4,$5,$6}' | $BIN_TR " " "\n" >> $LOG_NEW
#get io bytes (io - values: read, write)
$BIN_CAT $CFG_NFSFILE | $BIN_SED -n 3p | $BIN_AWK '{print $2,$3}' | $BIN_TR " " "\n" >> $LOG_NEW
#get read ahead cache (ra - values: cache_size, 0-10%, 10-20%, 20-30%, 30-40%, 40-50%, 50-60%, 60-70%, 70-80%, 80-90%, 90-100%, not-found)
$BIN_CAT $CFG_NFSFILE | $BIN_SED -n 5p | $BIN_AWK '{print $3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13}' | $BIN_TR " " "\n" >> $LOG_NEW
$BIN_CAT $CFG_NFSFILE | $BIN_SED -n 5p | $BIN_AWK '{print $2}' > $LOG_FIX
#get server packet stats (net - values: all reads, udp packets, tcp packets, tcp conn)
$BIN_CAT $CFG_NFSFILE | $BIN_SED -n 6p | $BIN_AWK '{print $2,$3,$4,$5}' | $BIN_TR " " "\n" >> $LOG_NEW
#get server rpc operations (rpc - values: calls, badcalls, badfmt, badauth, badclnt)
$BIN_CAT $CFG_NFSFILE | $BIN_SED -n 7p | $BIN_AWK '{print $2,$3,$4,$5,$6}' | $BIN_TR " " "\n" >> $LOG_NEW
#get nfs v3 stats (proc3 - values: null, getattr, setattr, lookup, access, readlink, read, write, create, mkdir, symlink, mknod, remove, rmdir, rename, link, readdir, readdirplus, fsstat, fsinfo, pathconf, commit)
$BIN_CAT $CFG_NFSFILE | $BIN_SED -n 8p | $BIN_AWK '{print $3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24}' | $BIN_TR " " "\n" >> $LOG_NEW
$BIN_PASTE $LOG_FIX
$BIN_PASTE $LOG_NEW $LOG_OLD | while read a b ; do
echo $(($a-$b))
done
$BIN_RM $LOG_OLD 2>&1
$BIN_MV $LOG_NEW $LOG_OLD 2>&1

9
sql-schema/126.sql Normal file
View File

@@ -0,0 +1,9 @@
DROP TABLE IF EXISTS `component_statuslog`;
CREATE TABLE `component_statuslog` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID for each log entry, unique index', `component_id` int(11) unsigned NOT NULL COMMENT 'id from the component table', `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'The status that the component was changed TO', `timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'When the status of the component was changed', PRIMARY KEY (`id`), KEY `device` (`component_id`), CONSTRAINT `component_statuslog_ibfk_1` FOREIGN KEY (`component_id`) REFERENCES `component` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='log of status changes to a component.';
ALTER TABLE `component` CHANGE `status` `status` TINYINT(1) NOT NULL DEFAULT '0' COMMENT 'The status of the component, retreived from the device';
UPDATE `config` SET `config_name`='alert.macros.rule.component_warning',`config_descr`='Component status Warning' WHERE `config_name`='alert.macros.rule.component_normal';
UPDATE `config` SET `config_name`='alert.macros.rule.component_normal',`config_descr`='Component status Normal' WHERE `config_name`='alert.macros.rule.component_alert';
INSERT INTO `config` (`config_name`,`config_value`,`config_default`,`config_descr`,`config_group`,`config_group_order`,`config_sub_group`,`config_sub_group_order`,`config_hidden`,`config_disabled`) VALUES ('alert.macros.rule.component_critical','(%component.status = 2 && %macros.component)','(%component.status = 2 && %macros.component)','Component status Critical','alerting',0,'macros',0,'1','0');
UPDATE component SET status=2 WHERE status=0;
UPDATE component SET status=0 WHERE status=1;
INSERT INTO `widgets` (`widget_title`,`widget`,`base_dimensions`) VALUES ('Component Status','component-status','3,2');

View File

@@ -76,8 +76,7 @@ $versions = version_info();
echo "Version info:\n";
$cur_sha = $versions['local_sha'];
if ($config['update_channel'] == 'master' && $cur_sha != $versions['github']['sha']) {
$commit_date = new DateTime($versions['local_date']);
$commit_date->setTimezone(new DateTimeZone(date_default_timezone_get()));
$commit_date = new DateTime($versions['local_date'], new DateTimeZone(date_default_timezone_get()));
print_warn("Your install is out of date: $cur_sha " . $commit_date->format('(r)'));
}
else {