feature: Updated BIND application (#6218)

* add BIND named poller

* add BIND named graphs

* add BIND stuff

* add the color pallete used by this

* add app support

* white space cleanup

* document the bind stuff

* expand the linux package stuff a bit

* note the agent and zero_stats value

* now include the $mib stuff

* white space cleanup

* whoops, add the update app bit

* correct a error added when merging

* readd copyright info

* note myself in the copyright info
This commit is contained in:
VVelox 2017-05-03 09:23:33 -05:00 committed by Neil Lathwood
parent 5e790ee617
commit 62a562b39a
30 changed files with 1973 additions and 108 deletions

View File

@ -6,7 +6,7 @@ You can use Application support to graph performance statistics from many applic
Different applications support a variety of ways collect data: by direct connection to the application, snmpd extend, or [the agent](Agent-Setup.md).
1. [Apache](#apache) - SNMP extend, Agent
1. [BIND9/named](#bind9-aka-named) - Agent
1. [BIND9/named](#bind9-aka-named) - SNMP extend, Agent
1. [DHCP Stats](#dhcp-stats) - SNMP extend
1. [EXIM Stats](#exim-stats) - SNMP extend
1. [Fail2ban](#fail2ban) - SNMP extend
@ -67,31 +67,72 @@ extend apache /etc/snmp/apache-stats.py
2. On the device page in Librenms, edit your host and check the `Apache` under the Applications tab.
### BIND9 aka named
##### Agent
[Install the agent](Agent-Setup.md) on this device if it isn't already and copy the `bind` script to `/usr/lib/check_mk_agent/local/`
Create stats file with appropriate permissions:
1: Create stats file with appropriate permissions:
```shell
~$ touch /etc/bind/named.stats
~$ chown bind:bind /etc/bind/named.stats
~$ touch /var/run/named/stats
~$ chown bind:bind /var/run/named/stats
```
Change `user:group` to the user and group that's running bind/named.
Bind/named configuration:
2: Bind/named configuration:
```text
options {
...
statistics-file "/etc/bind/named.stats";
statistics-file "/var/run/named/stats";
zone-statistics yes;
...
};
```
Restart your bind9/named after changing the configuration.
Verify that everything works by executing `rndc stats && cat /etc/bind/named.stats`.
In case you get a `Permission Denied` error, make sure you chown'ed correctly.
3: Restart your bind9/named after changing the configuration.
Note: if you change the path you will need to change the path in `scripts/agent-local/bind`.
4: Verify that everything works by executing `rndc stats && cat /var/run/named/stats`. In case you get a `Permission Denied` error, make sure you chown'ed correctly.
5: Also be aware that this file is appended to each time `rndc stats` is called. Given this it is suggested you setup file rotation for it. Alternatively you can also set zero_stats to 1 in the config.
6: The script for this also requires the Perl module File::ReadBackwards. On FreeBSD this is available as p5-File-ReadBackwards and on linux as perl-File-ReadBackwards in CentOS/Redhat and libfile-readbackwards-perl Debian/Ubuntu. If it is not available, it can be installed by `cpan -i File::ReadBackwards`.
7: You may possible need to configure the agent/extend script as well.
The config file's path defaults to the same path as the script, but with .config appended. So if the script is located at `/etc/snmp/bind`, the config file will be `/etc/snmp/bind.config`. Alternatively you can also specific a config via `-c $file`.
Anything starting with a # is comment. The format for variables is $variable=$value. Empty lines are ignored. Spaces and tabes at either the start or end of a line are ignored.
The variables are as below.
```
rndc = The path to rndc. Default: /usr/bin/env rndc
call_rndc = A 0/1 boolean on weather to call rndc stats. Suggest to set to 0 if using netdata. Default: 1
stats_file = The path to the named stats file. Default: /var/run/named/stats
agent = A 0/1 boolean for if this is being used as a LibreNMS agent or not. Default: 0
zero_stats = A 0/1 boolean for if the stats file should be zeroed first. Default: 0 (1 if guessed)
```
If you want to guess at the configuration, call it with -g and it will print out what it thinks
it should be.
8: On the device page in Librenms, edit your host and check `BIND` under the Applications tab.
##### SNMP Extend
1: Copy the shell script, postgres, to the desired host (the host must be added to LibreNMS devices) (wget https://github.com/librenms/librenms-agent/raw/master/snmp/bind -O /etc/snmp/bind)
2: Make the script executable (chmod +x /etc/snmp/bind)
3: Edit your snmpd.conf file and add:
```
extend bind /etc/snmp/bind
```
4: Restart snmpd on the host in question.
##### Agent
1: [Install the agent](Agent-Setup.md) on this device if it isn't already and copy the script to `/usr/lib/check_mk_agent/local/bind` via `wget https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/bind -O /usr/lib/check_mk_agent/local/bind`
2: Run `chmod +x /usr/lib/check_mk_agent/local/bind`
3: Set the variable 'agent' to '1' in the config.
### DHCP Stats

View File

@ -0,0 +1,29 @@
<?php
$name = 'bind';
$app_id = $app['app_id'];
$unit_text = 'In Hash Table';
$colours = 'psychedelic';
$dostack = 0;
$printtotal = 0;
$addarea = 1;
$transparency = 15;
$rrd_filename = rrd_name($device['hostname'], array('app', 'bind', $app['app_id'], 'adb'));
$rrd_list=array();
if (rrdtool_check_rrd_exists($rrd_filename)) {
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'Addresses',
'ds' => 'aiht',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'Names',
'ds' => 'niht',
);
} else {
d_echo('RRD "'.$rrd_filename.'" not found');
}
require 'includes/graphs/generic_multi_line.inc.php';

View File

@ -0,0 +1,29 @@
<?php
$name = 'bind';
$app_id = $app['app_id'];
$unit_text = 'Table Size';
$colours = 'psychedelic';
$dostack = 0;
$printtotal = 0;
$addarea = 1;
$transparency = 15;
$rrd_filename = rrd_name($device['hostname'], array('app', 'bind', $app['app_id'], 'adb'));
$rrd_list=array();
if (rrdtool_check_rrd_exists($rrd_filename)) {
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'Address',
'ds' => 'ahts',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'Name',
'ds' => 'nhts',
);
} else {
d_echo('RRD "'.$rrd_filename.'" not found');
}
require 'includes/graphs/generic_multi_line.inc.php';

View File

@ -0,0 +1,29 @@
<?php
$name = 'bind';
$app_id = $app['app_id'];
$unit_text = 'per second';
$colours = 'psychedelic';
$dostack = 0;
$printtotal = 0;
$addarea = 1;
$transparency = 15;
$rrd_filename = rrd_name($device['hostname'], array('app', 'bind', $app['app_id'], 'cache'));
$rrd_list=array();
if (rrdtool_check_rrd_exists($rrd_filename)) {
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'Mem Exhaustion',
'ds' => 'crddtme',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'TTL Expiration',
'ds' => 'crddtte',
);
} else {
d_echo('RRD "'.$rrd_filename.'" not found');
}
require 'includes/graphs/generic_multi_line.inc.php';

View File

@ -0,0 +1,34 @@
<?php
$name = 'bind';
$app_id = $app['app_id'];
$unit_text = 'Heap Memory';
$colours = 'psychedelic';
$dostack = 0;
$printtotal = 0;
$addarea = 1;
$transparency = 15;
$rrd_filename = rrd_name($device['hostname'], array('app', 'bind', $app['app_id'], 'cache'));
$rrd_list=array();
if (rrdtool_check_rrd_exists($rrd_filename)) {
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'Total',
'ds' => 'chmt',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'In Use',
'ds' => 'chmiu',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'Highest In Use',
'ds' => 'chhmiu',
);
} else {
d_echo('RRD "'.$rrd_filename.'" not found');
}
require 'includes/graphs/generic_multi_line.inc.php';

View File

@ -0,0 +1,39 @@
<?php
$name = 'bind';
$app_id = $app['app_id'];
$unit_text = 'per second';
$colours = 'psychedelic';
$dostack = 0;
$printtotal = 0;
$addarea = 1;
$transparency = 15;
$rrd_filename = rrd_name($device['hostname'], array('app', 'bind', $app['app_id'], 'cache'));
$rrd_list=array();
if (rrdtool_check_rrd_exists($rrd_filename)) {
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'Hits',
'ds' => 'ch',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'Misses',
'ds' => 'cm',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'Hits Frm Qry',
'ds' => 'chfq',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'Misses Frm Qry',
'ds' => 'cmfq',
);
} else {
d_echo('RRD "'.$rrd_filename.'" not found');
}
require 'includes/graphs/generic_multi_line.inc.php';

View File

@ -0,0 +1,34 @@
<?php
$name = 'bind';
$app_id = $app['app_id'];
$unit_text = 'Tree Memory';
$colours = 'psychedelic';
$dostack = 0;
$printtotal = 0;
$addarea = 1;
$transparency = 15;
$rrd_filename = rrd_name($device['hostname'], array('app', 'bind', $app['app_id'], 'cache'));
$rrd_list=array();
if (rrdtool_check_rrd_exists($rrd_filename)) {
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'Total',
'ds' => 'ctmt',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'In Use',
'ds' => 'ctmiu',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'Highest In Use',
'ds' => 'cthmiu',
);
} else {
d_echo('RRD "'.$rrd_filename.'" not found');
}
require 'includes/graphs/generic_multi_line.inc.php';

View File

@ -0,0 +1,108 @@
<?php
/*
* Copyright (C) 2015 Daniel Preussker <f0o@devilcode.org>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your 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/>.
*/
/*
* Bind9 Query Graph
* @author Daniel Preussker <f0o@devilcode.org>
* @copyright 2015 f0o, LibreNMS
* @license GPL
* @package LibreNMS
* @subpackage Graphs
*/
$unitlen = 10;
$bigdescrlen = 9;
$smalldescrlen = 9;
$dostack = 0;
$printtotal = 0;
$unit_text = 'query/sec';
$colours = 'psychedelic';
$rrd_list = array();
$rrd_filename = rrd_name($device['hostname'], array('app', 'bind', $app['app_id']));
$array = array(
'any',
'a',
'aaaa',
'cname',
'mx',
'ns',
'ptr',
'soa',
'srv',
'spf',
);
if (rrdtool_check_rrd_exists($rrd_filename)) {
foreach ($array as $ds) {
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => strtoupper($ds),
'ds' => $ds,
);
}
} else {
echo "file missing: $file";
}
$rrd_filename = rrd_name($device['hostname'], array('app', 'bind', $app['app_id'], 'incoming'));
$array = array(
'afsdb',
'apl',
'caa',
'cdnskey',
'cds',
'cert',
'dhcid',
'dlv',
'dnskey',
'ds',
'ipseckey',
'key',
'kx',
'loc',
'naptr',
'nsec',
'nsec3',
'nsec3param',
'rrsig',
'rp',
'sig',
'sshfp',
'ta',
'tkey',
'tlsa',
'tsig',
'txt',
'uri',
'dname',
'axfr',
'ixfr',
'opt',
);
if (rrdtool_check_rrd_exists($rrd_filename)) {
foreach ($array as $ds) {
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => strtoupper($ds),
'ds' => $ds,
);
}
} else {
echo "file missing: $file";
}
require 'includes/graphs/generic_multi_line.inc.php';

View File

@ -0,0 +1,71 @@
<?php
$unitlen = 10;
$bigdescrlen = 9;
$smalldescrlen = 9;
$dostack = 0;
$printtotal = 0;
$unit_text = 'query/sec';
$colours = 'psychedelic';
$rrd_list = array();
$rrd_filename = rrd_name($device['hostname'], array('app', 'bind', $app['app_id'], 'outgoing'));
$array = array(
'any',
'a',
'aaaa',
'cname',
'mx',
'ns',
'ptr',
'soa',
'srv',
'spf',
'afsdb',
'apl',
'caa',
'cdnskey',
'cds',
'cert',
'dhcid',
'dlv',
'dnskey',
'ds',
'ipseckey',
'key',
'kx',
'loc',
'naptr',
'nsec',
'nsec3',
'nsec3param',
'rrsig',
'rp',
'sig',
'sshfp',
'ta',
'tkey',
'tlsa',
'tsig',
'txt',
'uri',
'dname',
'axfr',
'ixfr',
'opt',
);
if (rrdtool_check_rrd_exists($rrd_filename)) {
foreach ($array as $ds) {
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => strtoupper($ds),
'ds' => $ds,
);
}
} else {
echo "file missing: $file";
}
require 'includes/graphs/generic_multi_line.inc.php';

View File

@ -0,0 +1,65 @@
<?php
$name = 'bind';
$app_id = $app['app_id'];
$unit_text = 'per second';
$colours = 'psychedelic';
$dostack = 0;
$printtotal = 0;
$addarea = 1;
$transparency = 15;
$rrd_filename = rrd_name($device['hostname'], array('app', 'bind', $app['app_id'], 'resolver'));
$rrd_list=array();
if (rrdtool_check_rrd_exists($rrd_filename)) {
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'NXDOMAIN',
'ds' => 'nr',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'SERVFAIL',
'ds' => 'sr',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'FORMERR',
'ds' => 'fr',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'REFUSED',
'ds' => 'rr',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'EDNS(0) qry fl',
'ds' => 'eqf',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'Trnctd Rcvd',
'ds' => 'trr',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'Retry',
'ds' => 'qr',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'Timeout',
'ds' => 'qt',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'Lame Dele.',
'ds' => 'ldr',
);
} else {
d_echo('RRD "'.$rrd_filename.'" not found');
}
require 'includes/graphs/generic_multi_line.inc.php';

View File

@ -0,0 +1,40 @@
<?php
$name = 'bind';
$app_id = $app['app_id'];
$unit_text = 'quiries/sec';
$colours = 'psychedelic';
$dostack = 0;
$printtotal = 0;
$addarea = 1;
$transparency = 15;
$rrd_filename = rrd_name($device['hostname'], array('app', 'bind', $app['app_id'], 'resolver'));
$rrd_list=array();
if (rrdtool_check_rrd_exists($rrd_filename)) {
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'IPv4 NS Ftchd',
'ds' => 'i4naf',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'IPv6 NS Ftchd',
'ds' => 'i6naf',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'IPv4 Failed',
'ds' => 'i4naff',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'IPv6 Failed',
'ds' => 'i6naff',
);
} else {
d_echo('RRD "'.$rrd_filename.'" not found');
}
require 'includes/graphs/generic_multi_line.inc.php';

View File

@ -0,0 +1,40 @@
<?php
$name = 'bind';
$app_id = $app['app_id'];
$unit_text = 'quiries/sec';
$colours = 'psychedelic';
$dostack = 0;
$printtotal = 0;
$addarea = 1;
$transparency = 15;
$rrd_filename = rrd_name($device['hostname'], array('app', 'bind', $app['app_id'], 'resolver'));
$rrd_list=array();
if (rrdtool_check_rrd_exists($rrd_filename)) {
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'IPv4 Sent',
'ds' => 'i4qs',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'IPv6 Sent',
'ds' => 'i6qs',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'IPv4 Rcvd',
'ds' => 'i4rr',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'IPv6 Rcvd',
'ds' => 'i6rr',
);
} else {
d_echo('RRD "'.$rrd_filename.'" not found');
}
require 'includes/graphs/generic_multi_line.inc.php';

View File

@ -0,0 +1,72 @@
<?php
$unitlen = 10;
$bigdescrlen = 9;
$smalldescrlen = 9;
$dostack = 0;
$printtotal = 0;
$unit_text = 'RR sets';
$colours = 'psychedelic';
$rrd_list = array();
$rrd_filename = rrd_name($device['hostname'], array('app', 'bind', $app['app_id'], 'rrnegative'));
$array = array(
'any',
'a',
'aaaa',
'cname',
'mx',
'ns',
'ptr',
'soa',
'srv',
'spf',
'afsdb',
'apl',
'caa',
'cdnskey',
'cds',
'cert',
'dhcid',
'dlv',
'dnskey',
'ds',
'ipseckey',
'key',
'kx',
'loc',
'naptr',
'nsec',
'nsec3',
'nsec3param',
'rrsig',
'rp',
'sig',
'sshfp',
'ta',
'tkey',
'tlsa',
'tsig',
'txt',
'uri',
'dname',
'nxdomain',
'axfr',
'ixfr',
'opt',
);
if (rrdtool_check_rrd_exists($rrd_filename)) {
foreach ($array as $ds) {
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => '!'.strtoupper($ds),
'ds' => $ds,
);
}
} else {
echo "file missing: $file";
}
require 'includes/graphs/generic_multi_line.inc.php';

View File

@ -0,0 +1,72 @@
<?php
$unitlen = 13;
$bigdescrlen = 9;
$smalldescrlen = 9;
$dostack = 0;
$printtotal = 0;
$unit_text = 'RR sets';
$colours = 'psychedelic';
$rrd_list = array();
$rrd_filename = rrd_name($device['hostname'], array('app', 'bind', $app['app_id'], 'rrpositive'));
$array = array(
'any',
'a',
'aaaa',
'cname',
'mx',
'ns',
'ptr',
'soa',
'srv',
'spf',
'afsdb',
'apl',
'caa',
'cdnskey',
'cds',
'cert',
'dhcid',
'dlv',
'dnskey',
'ds',
'ipseckey',
'key',
'kx',
'loc',
'naptr',
'nsec',
'nsec3',
'nsec3param',
'rrsig',
'rp',
'sig',
'sshfp',
'ta',
'tkey',
'tlsa',
'tsig',
'txt',
'uri',
'dname',
'nxdomain',
'axfr',
'ixfr',
'opt',
);
if (rrdtool_check_rrd_exists($rrd_filename)) {
foreach ($array as $ds) {
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => strtoupper($ds),
'ds' => $ds,
);
}
} else {
echo "file missing: $file";
}
require 'includes/graphs/generic_multi_line.inc.php';

View File

@ -0,0 +1,50 @@
<?php
$name = 'bind';
$app_id = $app['app_id'];
$unit_text = 'RTT in ms/sec';
$colours = 'psychedelic';
$dostack = 0;
$printtotal = 0;
$addarea = 1;
$transparency = 15;
$rrd_filename = rrd_name($device['hostname'], array('app', 'bind', $app['app_id'], 'resolver'));
$rrd_list=array();
if (rrdtool_check_rrd_exists($rrd_filename)) {
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => '<10',
'ds' => 'rttl10',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => '10-100',
'ds' => 'rtt10t100',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => '100-500',
'ds' => 'rtt100t500',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => '500-800',
'ds' => 'rtt500t800',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => '800-1600',
'ds' => 'rtt800t1600',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => '>1600',
'ds' => 'rttg1600',
);
} else {
d_echo('RRD "'.$rrd_filename.'" not found');
}
require 'includes/graphs/generic_multi_line.inc.php';

View File

@ -0,0 +1,44 @@
<?php
$name = 'bind';
$app_id = $app['app_id'];
$unit_text = 'per second';
$colours = 'psychedelic';
$dostack = 0;
$printtotal = 0;
$addarea = 1;
$transparency = 15;
$rrd_filename = rrd_name($device['hostname'], array('app', 'bind', $app['app_id'], 'server'));
$rrd_list=array();
if (rrdtool_check_rrd_exists($rrd_filename)) {
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'Auth Qry Rej',
'ds' => 'aqr',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'Rec Qry Rej',
'ds' => 'rqr',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'Trnctd Rsp Snt',
'ds' => 'trs',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'Oth Qry Fail',
'ds' => 'oqf',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'Qry Dropped',
'ds' => 'qd',
);
} else {
d_echo('RRD "'.$rrd_filename.'" not found');
}
require 'includes/graphs/generic_multi_line.inc.php';

View File

@ -0,0 +1,59 @@
<?php
$name = 'bind';
$app_id = $app['app_id'];
$unit_text = 'per second';
$colours = 'psychedelic';
$dostack = 0;
$printtotal = 0;
$addarea = 1;
$transparency = 15;
$rrd_filename = rrd_name($device['hostname'], array('app', 'bind', $app['app_id'], 'server'));
$rrd_list=array();
if (rrdtool_check_rrd_exists($rrd_filename)) {
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'IPv4 Req',
'ds' => 'i4rr',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'IPv6 Req',
'ds' => 'i6rr',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'TCP Req',
'ds' => 'trr',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'TCP Qry',
'ds' => 'tqr',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'UDP Qry',
'ds' => 'uqr',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'With EDNS(0)',
'ds' => 'rwer',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'Other EDNS',
'ds' => 'oeor',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'Dup. Qry',
'ds' => 'dqr',
);
} else {
d_echo('RRD "'.$rrd_filename.'" not found');
}
require 'includes/graphs/generic_multi_line.inc.php';

View File

@ -0,0 +1,59 @@
<?php
$name = 'bind';
$app_id = $app['app_id'];
$unit_text = 'per second';
$colours = 'psychedelic';
$dostack = 0;
$printtotal = 0;
$addarea = 1;
$transparency = 15;
$rrd_filename = rrd_name($device['hostname'], array('app', 'bind', $app['app_id'], 'server'));
$rrd_list=array();
if (rrdtool_check_rrd_exists($rrd_filename)) {
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'Successful',
'ds' => 'qrisa',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'Authoritative',
'ds' => 'qriaa',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'Non Authoritative',
'ds' => 'qrinaa',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'NX RR Set',
'ds' => 'qrin',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'SERVFAIL',
'ds' => 'qris',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'NXDOMAIN',
'ds' => 'qrind',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'With EDNS(0)',
'ds' => 'rwes',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'Caused Rec',
'ds' => 'qcr',
);
} else {
d_echo('RRD "'.$rrd_filename.'" not found');
}
require 'includes/graphs/generic_multi_line.inc.php';

View File

@ -0,0 +1,29 @@
<?php
$name = 'bind';
$app_id = $app['app_id'];
$unit_text = 'accepted/sec';
$colours = 'psychedelic';
$dostack = 0;
$printtotal = 0;
$addarea = 1;
$transparency = 15;
$rrd_filename = rrd_name($device['hostname'], array('app', 'bind', $app['app_id'], 'sockets'));
$rrd_list=array();
if (rrdtool_check_rrd_exists($rrd_filename)) {
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'TCP/IPv4',
'ds' => 'ti4ca',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'TCP/IPv6',
'ds' => 'ti6ca',
);
} else {
d_echo('RRD "'.$rrd_filename.'" not found');
}
require 'includes/graphs/generic_multi_line.inc.php';

View File

@ -0,0 +1,45 @@
<?php
$name = 'bind';
$app_id = $app['app_id'];
$unit_text = 'active sockets';
$colours = 'psychedelic';
$dostack = 0;
$printtotal = 0;
$addarea = 1;
$transparency = 15;
$rrd_filename = rrd_name($device['hostname'], array('app', 'bind', $app['app_id'], 'sockets'));
$rrd_list=array();
if (rrdtool_check_rrd_exists($rrd_filename)) {
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'UDP/IPv4',
'ds' => 'ui4sa',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'UDP/IPv6',
'ds' => 'ui6sa',
);
# This appears to be buggy on various versions of BIND named and acts as a counter instead.
# $rrd_list[]=array(
# 'filename' => $rrd_filename,
# 'descr' => 'TCP/IPv4',
# 'ds' => 'ti4sa',
# );
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'TCP/IPv6',
'ds' => 'ti6sa',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'Raw',
'ds' => 'rsa',
);
} else {
d_echo('RRD "'.$rrd_filename.'" not found');
}
require 'includes/graphs/generic_multi_line.inc.php';

View File

@ -0,0 +1,39 @@
<?php
$name = 'bind';
$app_id = $app['app_id'];
$unit_text = 'failures / sec.';
$colours = 'psychedelic';
$dostack = 0;
$printtotal = 0;
$addarea = 1;
$transparency = 15;
$rrd_filename = rrd_name($device['hostname'], array('app', 'bind', $app['app_id'], 'sockets'));
$rrd_list=array();
if (rrdtool_check_rrd_exists($rrd_filename)) {
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'UDP/IPv4',
'ds' => 'ui4sbf',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'UDP/IPv6',
'ds' => 'ui6sbf',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'TCP/IPv4',
'ds' => 'ti4sbf',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'TCP/IPv6',
'ds' => 'ti6sbf',
);
} else {
d_echo('RRD "'.$rrd_filename.'" not found');
}
require 'includes/graphs/generic_multi_line.inc.php';

View File

@ -0,0 +1,39 @@
<?php
$name = 'bind';
$app_id = $app['app_id'];
$unit_text = 'failures / sec.';
$colours = 'psychedelic';
$dostack = 0;
$printtotal = 0;
$addarea = 1;
$transparency = 15;
$rrd_filename = rrd_name($device['hostname'], array('app', 'bind', $app['app_id'], 'sockets'));
$rrd_list=array();
if (rrdtool_check_rrd_exists($rrd_filename)) {
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'UDP/IPv4',
'ds' => 'ui4scf',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'UDP/IPv6',
'ds' => 'ui6scf',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'TCP/IPv4',
'ds' => 'ti4scf',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'TCP/IPv6',
'ds' => 'ti6scf',
);
} else {
d_echo('RRD "'.$rrd_filename.'" not found');
}
require 'includes/graphs/generic_multi_line.inc.php';

View File

@ -0,0 +1,39 @@
<?php
$name = 'bind';
$app_id = $app['app_id'];
$unit_text = 'closed / sec.';
$colours = 'psychedelic';
$dostack = 0;
$printtotal = 0;
$addarea = 1;
$transparency = 15;
$rrd_filename = rrd_name($device['hostname'], array('app', 'bind', $app['app_id'], 'sockets'));
$rrd_list=array();
if (rrdtool_check_rrd_exists($rrd_filename)) {
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'UDP/IPv4',
'ds' => 'ui4sc',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'UDP/IPv6',
'ds' => 'ui6sc',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'TCP/IPv4',
'ds' => 'ti4sc',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'TCP/IPv6',
'ds' => 'ti6sc',
);
} else {
d_echo('RRD "'.$rrd_filename.'" not found');
}
require 'includes/graphs/generic_multi_line.inc.php';

View File

@ -0,0 +1,59 @@
<?php
$name = 'bind';
$app_id = $app['app_id'];
$unit_text = 'errors / sec';
$colours = 'psychedelic';
$dostack = 0;
$printtotal = 0;
$addarea = 1;
$transparency = 15;
$rrd_filename = rrd_name($device['hostname'], array('app', 'bind', $app['app_id'], 'sockets'));
$rrd_list=array();
if (rrdtool_check_rrd_exists($rrd_filename)) {
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'UDP/IPv4 send',
'ds' => 'ui4se',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'UDP/IPv6 send',
'ds' => 'ui6se',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'TCP/IPv4 send',
'ds' => 'ti4se',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'TCP/IPv6 send',
'ds' => 'ti6se',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'UDP/IPv4 recv',
'ds' => 'ui4re',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'UDP/IPv6 recv',
'ds' => 'ui6re',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'TCP/IPv4 recv',
'ds' => 'ti4re',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'TCP/IPv6 recv',
'ds' => 'ti6re',
);
} else {
d_echo('RRD "'.$rrd_filename.'" not found');
}
require 'includes/graphs/generic_multi_line.inc.php';

View File

@ -0,0 +1,39 @@
<?php
$name = 'bind';
$app_id = $app['app_id'];
$unit_text = 'establish/sec';
$colours = 'psychedelic';
$dostack = 0;
$printtotal = 0;
$addarea = 1;
$transparency = 15;
$rrd_filename = rrd_name($device['hostname'], array('app', 'bind', $app['app_id'], 'sockets'));
$rrd_list=array();
if (rrdtool_check_rrd_exists($rrd_filename)) {
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'UDP/IPv4',
'ds' => 'ui4ce',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'UDP/IPv6',
'ds' => 'ui6ce',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'TCP/IPv4',
'ds' => 'ti4ce',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'TCP/IPv6',
'ds' => 'ti6ce',
);
} else {
d_echo('RRD "'.$rrd_filename.'" not found');
}
require 'includes/graphs/generic_multi_line.inc.php';

View File

@ -0,0 +1,44 @@
<?php
$name = 'bind';
$app_id = $app['app_id'];
$unit_text = 'opened / sec.';
$colours = 'psychedelic';
$dostack = 0;
$printtotal = 0;
$addarea = 1;
$transparency = 15;
$rrd_filename = rrd_name($device['hostname'], array('app', 'bind', $app['app_id'], 'sockets'));
$rrd_list=array();
if (rrdtool_check_rrd_exists($rrd_filename)) {
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'UDP/IPv4',
'ds' => 'ui4so',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'UDP/IPv6',
'ds' => 'ui6so',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'TCP/IPv4',
'ds' => 'ti4so',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'TCP/IPv6',
'ds' => 'ti6so',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'Raw',
'ds' => 'rso',
);
} else {
d_echo('RRD "'.$rrd_filename.'" not found');
}
require 'includes/graphs/generic_multi_line.inc.php';

View File

@ -228,6 +228,24 @@ $graphs['unbound'] = array(
'queries',
);
$graphs['bind'] = array(
'incoming',
'outgoing',
'rr_positive',
'rr_negative',
'rtt',
'resolver_failure',
'resolver_qrs',
'resolver_naf',
'server_received',
'server_results',
'server_issues',
'cache_hm',
'adb_in',
'sockets_active',
'sockets_errors',
);
$graphs['smart'] = array(
'id5',
'id10',

View File

@ -22,10 +22,38 @@
* @license GPL
* @package LibreNMS
* @subpackage Apps
* @updated in 2017 by Zane C. Bowers-Hadley <vvelox@vvelox.net>
*/
global $config;
$graphs = array('bind_queries' => 'Queries');
$graphs = array(
'bind_incoming' => 'Incoming',
'bind_outgoing' => 'Outgoing',
'bind_rr_positive' => 'RR Sets Positive',
'bind_rr_negative' => 'RR Sets Negative',
'bind_rtt' => 'Resolver RTT',
'bind_resolver_failure' => 'Resolver Failures',
'bind_resolver_qrs' => 'Resolver Quiries Sent/Received',
'bind_resolver_naf' => 'NS Query Status',
'bind_server_received' => 'Server Queries/Requests Received',
'bind_server_results' => 'Server Results',
'bind_server_issues' => 'Server Issues',
'bind_cache_hm' => 'Cache Hits & Misses',
'bind_cache_tree' => 'Cache Tree Memory',
'bind_cache_heap' => 'Cache Heap Memory',
'bind_cache_deleted' => 'Cache Record Deletion',
'bind_adb_size' => 'Address & Name Hash Table Size',
'bind_adb_in' => 'Address & Name In Hash Table',
'bind_sockets_active' => 'Active Sockets',
'bind_sockets_errors' => 'Socket Errors Per Second',
'bind_sockets_opened' => 'Opened Sockets Per Second',
'bind_sockets_closed' => 'Closed Sockets Per Second',
'bind_sockets_bf' => 'Socket Bind Failures Per Second',
'bind_sockets_cf' => 'Socket Connect Failures Per Second',
'bind_sockets_established' => 'Connections Established Per Second',
);
foreach ($graphs as $key => $text) {
$graph_type = $key;
$graph_array['height'] = '100';
@ -33,7 +61,15 @@ foreach ($graphs as $key => $text) {
$graph_array['to'] = $config['time']['now'];
$graph_array['id'] = $app['app_id'];
$graph_array['type'] = 'application_'.$key;
echo "<h3>$text</h3><tr bgcolor='$row_colour'><td colspan=5>";
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 '</td></tr>';
echo '</div>';
echo '</div>';
echo '</div>';
}

View File

@ -338,7 +338,6 @@ $config['graph_colours']['mega']=array_merge(
$config['graph_colours']['mixed']
);
// Map colors
$config['network_map_legend'] = array(
'0' => '#aeaeae',

View File

@ -1,102 +1,666 @@
<?php
/*
* Copyright (C) 2015 Daniel Preussker <f0o@devilcode.org>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your 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/>.
*/
/*
* Bind9 Statistics
* @author Daniel Preussker <f0o@devilcode.org>
* @copyright 2015 f0o, LibreNMS
* @license GPL
* @package LibreNMS
* @subpackage Polling
*/
use LibreNMS\RRD\RrdDefinition;
$name = 'bind';
$app_id = $app['app_id'];
if (!empty($agent_data['app'][$name]) && $app_id > 0) {
echo ' bind ';
$bind = $agent_data['app'][$name];
$bind_parsed = array();
$prefix = '';
update_application($app, $bind);
foreach (explode("\n", $bind) as $line) {
$pattern = '/^\+\+ ([^+]+) \+\+$/';
preg_match($pattern, $line, $matches);
if (!empty($matches)) {
$prefix = str_replace(' ', '_', strtolower($matches[1]));
$view = $item = $cnt = '';
}
echo ' bind ';
$pattern = '/^\[View: (\w+)(| .*)\]/';
preg_match($pattern, $line, $matches);
if (!empty($matches)) {
if ($matches[1] == 'default') {
continue;
} else {
$view = $matches[1];
}
}
if (!empty($agent_data['app'][$name])) {
$bind = $agent_data['app'][$name];
} else {
$name = 'bind';
$app_id = $app['app_id'];
$options = '-O qv';
$mib = 'NET-SNMP-EXTEND-MIB';
$oid = 'nsExtendOutputFull.4.98.105.110.100';
$bind = snmp_get($device, $oid, $options, $mib);
}
update_application($app, $bind);
$pattern = '/^\[(.*)\]$/';
preg_match($pattern, $line, $matches);
if (!empty($matches)) {
$prefix = $matches[1];
}
list ($incoming, $outgoing, $server, $resolver, $cache, $rrsets, $adb, $sockets) = explode("\n", $bind);
$pattern = '/^\s+(\d+) ([^\n]+)/';
preg_match($pattern, $line, $matches);
if (!empty($matches)) {
$cnt = str_replace(' ', '_', strtolower($matches[1]));
$item = str_replace(' ', '_', strtolower($matches[2]));
if (!empty($view)) {
$bind_parsed[$prefix][$view][$item] = $cnt;
} else {
$bind_parsed[$prefix][$item] = $cnt;
}
}
}//end foreach
//
// INCOMING PROCESSING
//
list ($a, $aaaa, $afsdb, $apl, $caa, $cdnskey, $cds, $cert, $cname, $dhcid, $dlv, $dnskey, $ds, $ipseckey, $key, $kx,
$loc, $mx, $naptr, $ns, $nsec, $nsec3, $nsec3param, $ptr, $rrsig, $rp, $sig, $soa, $srv, $sshfp, $ta, $tkey, $tlsa,
$tsig, $txt, $uri, $dname, $any, $axfr, $ixfr, $opt, $spf) = explode(',', $incoming);
$rrd_name = array('app', $name, $app_id);
$rrd_def = RrdDefinition::make()
->addDataset('any', 'COUNTER', 0, 125000000000)
->addDataset('a', 'COUNTER', 0, 125000000000)
->addDataset('aaaa', 'COUNTER', 0, 125000000000)
->addDataset('cname', 'COUNTER', 0, 125000000000)
->addDataset('mx', 'COUNTER', 0, 125000000000)
->addDataset('ns', 'COUNTER', 0, 125000000000)
->addDataset('ptr', 'COUNTER', 0, 125000000000)
->addDataset('soa', 'COUNTER', 0, 125000000000)
->addDataset('srv', 'COUNTER', 0, 125000000000)
->addDataset('spf', 'COUNTER', 0, 125000000000);
$rrd_name = array('app', $name, $app_id);
$rrd_def = RrdDefinition::make()
->addDataset('any', 'DERIVE', 0)
->addDataset('a', 'DERIVE', 0)
->addDataset('aaaa', 'DERIVE', 0)
->addDataset('cname', 'DERIVE', 0)
->addDataset('mx', 'DERIVE', 0)
->addDataset('ns', 'DERIVE', 0)
->addDataset('ptr', 'DERIVE', 0)
->addDataset('soa', 'DERIVE', 0)
->addDataset('srv', 'DERIVE', 0)
->addDataset('spf', 'DERIVE', 0);
$fields = array(
'any' => ((int)$bind_parsed['incoming_queries']['any']),
'a' => ((int)$bind_parsed['incoming_queries']['a']),
'aaaa' => ((int)$bind_parsed['incoming_queries']['aaaa']),
'cname' => ((int)$bind_parsed['incoming_queries']['cname']),
'mx' => ((int)$bind_parsed['incoming_queries']['mx']),
'ns' => ((int)$bind_parsed['incoming_queries']['ns']),
'ptr' => ((int)$bind_parsed['incoming_queries']['ptr']),
'soa' => ((int)$bind_parsed['incoming_queries']['soa']),
'srv' => ((int)$bind_parsed['incoming_queries']['srv']),
'spf' => ((int)$bind_parsed['incoming_queries']['spf']),
);
$fields = array(
'any' => $any,
'a' => $a,
'aaaa' => $aaaa,
'cname' => $cname,
'mx' => $mx,
'ns' => $ns,
'ptr' => $ptr,
'soa' => $soa,
'srv' => $srv,
'spf' => $spf,
);
$tags = compact('name', 'app_id', 'rrd_name', 'rrd_def');
data_update($device, 'app', $tags, $fields);
}//end if
$tags = array('name' => $name, 'app_id' => $app_id, 'rrd_def' => $rrd_def, 'rrd_name' => $rrd_name);
data_update($device, 'app', $tags, $fields);
$rrd_name = array('app', $name, $app_id, 'incoming');
$rrd_def = RrdDefinition::make()
->addDataset('afsdb', 'DERIVE', 0)
->addDataset('apl', 'DERIVE', 0)
->addDataset('caa', 'DERIVE', 0)
->addDataset('cdnskey', 'DERIVE', 0)
->addDataset('cds', 'DERIVE', 0)
->addDataset('cert', 'DERIVE', 0)
->addDataset('dhcid', 'DERIVE', 0)
->addDataset('dlv', 'DERIVE', 0)
->addDataset('dnskey', 'DERIVE', 0)
->addDataset('ds', 'DERIVE', 0)
->addDataset('ipseckey', 'DERIVE', 0)
->addDataset('key', 'DERIVE', 0)
->addDataset('kx', 'DERIVE', 0)
->addDataset('loc', 'DERIVE', 0)
->addDataset('naptr', 'DERIVE', 0)
->addDataset('nsec', 'DERIVE', 0)
->addDataset('nsec3', 'DERIVE', 0)
->addDataset('nsec3param', 'DERIVE', 0)
->addDataset('rrsig', 'DERIVE', 0)
->addDataset('rp', 'DERIVE', 0)
->addDataset('sig', 'DERIVE', 0)
->addDataset('sshfp', 'DERIVE', 0)
->addDataset('ta', 'DERIVE', 0)
->addDataset('tkey', 'DERIVE', 0)
->addDataset('tlsa', 'DERIVE', 0)
->addDataset('tsig', 'DERIVE', 0)
->addDataset('txt', 'DERIVE', 0)
->addDataset('uri', 'DERIVE', 0)
->addDataset('dname', 'DERIVE', 0)
->addDataset('axfr', 'DERIVE', 0)
->addDataset('ixfr', 'DERIVE', 0)
->addDataset('opt', 'DERIVE', 0);
$fields = array(
'afsdb' => $afsdb,
'apl' => $apl,
'caa' => $caa,
'cdnskey' => $cdnskey,
'cds' => $cds,
'cert' => $cert,
'dhcid' => $dhcid,
'dlv' => $dlv,
'dnskey' => $dnskey,
'ds' => $ds,
'ipseckey' => $ipseckey,
'key' => $key,
'kx' => $kx,
'loc' => $loc,
'naptr' => $naptr,
'nsec' => $nsec,
'nsec3' => $nsec3,
'nsec3param' => $nsec3param,
'rrsig' => $rrsig,
'rp' => $rp,
'sig' => $sig,
'sshfp' => $sshfp,
'ta' => $ta,
'tkey' => $tkey,
'tlsa' => $tlsa,
'tsig' => $tsig,
'txt' => $txt,
'uri' => $uri,
'dname' => $dname,
'axfr' => $axfr,
'ixfr' => $ixfr,
'opt' => $opt,
);
$tags = array('name' => $name, 'app_id' => $app_id, 'rrd_def' => $rrd_def, 'rrd_name' => $rrd_name);
data_update($device, 'app', $tags, $fields);
//
// OUTGOING PROCESSING
//
list ($a, $aaaa, $afsdb, $apl, $caa, $cdnskey, $cds, $cert, $cname, $dhcid, $dlv, $dnskey, $ds, $ipseckey, $key, $kx,
$loc, $mx, $naptr, $ns, $nsec, $nsec3, $nsec3param, $ptr, $rrsig, $rp, $sig, $soa, $srv, $sshfp, $ta, $tkey, $tlsa,
$tsig, $txt, $uri, $dname, $any, $axfr, $ixfr, $opt, $spf) = explode(',', $outgoing);
$rrd_name = array('app', $name, $app_id, 'outgoing');
$rrd_def = RrdDefinition::make()
->addDataset('any', 'DERIVE', 0)
->addDataset('a', 'DERIVE', 0)
->addDataset('aaaa', 'DERIVE', 0)
->addDataset('cname', 'DERIVE', 0)
->addDataset('mx', 'DERIVE', 0)
->addDataset('ns', 'DERIVE', 0)
->addDataset('ptr', 'DERIVE', 0)
->addDataset('soa', 'DERIVE', 0)
->addDataset('srv', 'DERIVE', 0)
->addDataset('spf', 'DERIVE', 0)
->addDataset('afsdb', 'DERIVE', 0)
->addDataset('apl', 'DERIVE', 0)
->addDataset('caa', 'DERIVE', 0)
->addDataset('cdnskey', 'DERIVE', 0)
->addDataset('cds', 'DERIVE', 0)
->addDataset('cert', 'DERIVE', 0)
->addDataset('dhcid', 'DERIVE', 0)
->addDataset('dlv', 'DERIVE', 0)
->addDataset('dnskey', 'DERIVE', 0)
->addDataset('ds', 'DERIVE', 0)
->addDataset('ipseckey', 'DERIVE', 0)
->addDataset('key', 'DERIVE', 0)
->addDataset('kx', 'DERIVE', 0)
->addDataset('loc', 'DERIVE', 0)
->addDataset('naptr', 'DERIVE', 0)
->addDataset('nsec', 'DERIVE', 0)
->addDataset('nsec3', 'DERIVE', 0)
->addDataset('nsec3param', 'DERIVE', 0)
->addDataset('rrsig', 'DERIVE', 0)
->addDataset('rp', 'DERIVE', 0)
->addDataset('sig', 'DERIVE', 0)
->addDataset('sshfp', 'DERIVE', 0)
->addDataset('ta', 'DERIVE', 0)
->addDataset('tkey', 'DERIVE', 0)
->addDataset('tlsa', 'DERIVE', 0)
->addDataset('tsig', 'DERIVE', 0)
->addDataset('txt', 'DERIVE', 0)
->addDataset('uri', 'DERIVE', 0)
->addDataset('dname', 'DERIVE', 0)
->addDataset('axfr', 'DERIVE', 0)
->addDataset('ixfr', 'DERIVE', 0)
->addDataset('opt', 'DERIVE', 0);
$fields = array(
'any' => $any,
'a' => $a,
'aaaa' => $aaaa,
'cname' => $cname,
'mx' => $mx,
'ns' => $ns,
'ptr' => $ptr,
'soa' => $soa,
'srv' => $srv,
'spf' => $spf,
'afsdb' => $afsdb,
'apl' => $apl,
'caa' => $caa,
'cdnskey' => $cdnskey,
'cds' => $cds,
'cert' => $cert,
'dhcid' => $dhcid,
'dlv' => $dlv,
'dnskey' => $dnskey,
'ds' => $ds,
'ipseckey' => $ipseckey,
'key' => $key,
'kx' => $kx,
'loc' => $loc,
'naptr' => $naptr,
'nsec' => $nsec,
'nsec3' => $nsec3,
'nsec3param' => $nsec3param,
'rrsig' => $rrsig,
'rp' => $rp,
'sig' => $sig,
'sshfp' => $sshfp,
'ta' => $ta,
'tkey' => $tkey,
'tlsa' => $tlsa,
'tsig' => $tsig,
'txt' => $txt,
'uri' => $uri,
'dname' => $dname,
'axfr' => $axfr,
'ixfr' => $ixfr,
'opt' => $opt,
);
$tags = array('name' => $name, 'app_id' => $app_id, 'rrd_def' => $rrd_def, 'rrd_name' => $rrd_name);
data_update($device, 'app', $tags, $fields);
//
// SERVER PROCESSING
//
list ($i4rr, $i6rr, $rwer, $trr, $aqr, $rqr, $rs, $trs, $rwes, $qrisa, $qriaa, $qrinaa, $qrin, $qris, $qrind,
$qcr, $dqr, $oqf, $uqr, $tqr, $oeor, $qd) = explode(',', $server);
$rrd_name = array('app', $name, $app_id, 'server');
$rrd_def = RrdDefinition::make()
->addDataset('i4rr', 'DERIVE', 0)
->addDataset('i6rr', 'DERIVE', 0)
->addDataset('rwer', 'DERIVE', 0)
->addDataset('trr', 'DERIVE', 0)
->addDataset('aqr', 'DERIVE', 0)
->addDataset('rqr', 'DERIVE', 0)
->addDataset('rs', 'DERIVE', 0)
->addDataset('trs', 'DERIVE', 0)
->addDataset('rwes', 'DERIVE', 0)
->addDataset('qrisa', 'DERIVE', 0)
->addDataset('qriaa', 'DERIVE', 0)
->addDataset('qrinaa', 'DERIVE', 0)
->addDataset('qrin', 'DERIVE', 0)
->addDataset('qris', 'DERIVE', 0)
->addDataset('qrind', 'DERIVE', 0)
->addDataset('qcr', 'DERIVE', 0)
->addDataset('dqr', 'DERIVE', 0)
->addDataset('oqf', 'DERIVE', 0)
->addDataset('uqr', 'DERIVE', 0)
->addDataset('tqr', 'DERIVE', 0)
->addDataset('oeor', 'DERIVE', 0)
->addDataset('qd', 'DERIVE', 0);
$fields = array(
'i4rr' => $i4rr,
'i6rr' => $i6rr,
'rwer' => $rwer,
'trr' => $trr,
'aqr' => $aqr,
'rqr' => $rqr,
'rs' => $rs,
'trs' => $trs,
'rwes' => $rwes,
'qrisa' => $qrisa,
'qriaa' => $qriaa,
'qrinaa' => $qrinaa,
'qrin' => $qrin,
'qris' => $qris,
'qrind' => $qrind,
'qcr' => $qcr,
'dqr' => $dqr,
'oqf' => $oqf,
'uqr' => $uqr,
'tqr' => $tqr,
'oeor' => $oeor,
'qd' => $qd,
);
$tags = array('name' => $name, 'app_id' => $app_id, 'rrd_def' => $rrd_def, 'rrd_name' => $rrd_name);
data_update($device, 'app', $tags, $fields);
//
// RESOLVER PROCESSING
//
list ($i4qs, $i6qs, $i4rr, $i6rr, $nr, $sr, $fr, $eqf, $trr, $ldr, $qr, $qt, $i4naf, $i6naf,
$i4naff, $i6naff, $rttl10, $rtt10t100, $rtt100t500, $rtt500t800, $rtt800t1600, $rttg1600,
$bs, $rr) = explode(',', $resolver);
$rrd_name = array('app', $name, $app_id, 'resolver');
$rrd_def = RrdDefinition::make()
->addDataset('i4qs', 'DERIVE', 0)
->addDataset('i6qs', 'DERIVE', 0)
->addDataset('i4rr', 'DERIVE', 0)
->addDataset('i6rr', 'DERIVE', 0)
->addDataset('nr', 'DERIVE', 0)
->addDataset('sr', 'DERIVE', 0)
->addDataset('fr', 'DERIVE', 0)
->addDataset('eqf', 'DERIVE', 0)
->addDataset('trr', 'DERIVE', 0)
->addDataset('ldr', 'DERIVE', 0)
->addDataset('qr', 'DERIVE', 0)
->addDataset('qt', 'DERIVE', 0)
->addDataset('i4naf', 'DERIVE', 0)
->addDataset('i6naf', 'DERIVE', 0)
->addDataset('i4naff', 'DERIVE', 0)
->addDataset('i6naff', 'DERIVE', 0)
->addDataset('rttl10', 'DERIVE', 0)
->addDataset('rtt10t100', 'DERIVE', 0)
->addDataset('rtt100t500', 'DERIVE', 0)
->addDataset('rtt500t800', 'DERIVE', 0)
->addDataset('rtt800t1600', 'DERIVE', 0)
->addDataset('rttg1600', 'DERIVE', 0)
->addDataset('bs', 'GAUGE', 0)
->addDataset('rr', 'DERIVE', 0);
$fields = array(
'i4qs' => $i4qs,
'i6qs' => $i6qs,
'i4rr' => $i4rr,
'i6rr' => $i6rr,
'nr' => $nr,
'sr' => $sr,
'fr' => $fr,
'eqf' => $eqf,
'trr' => $trr,
'ldr' => $ldr,
'qr' => $qr,
'qt' => $qt,
'i4naf' => $i4naf,
'i6naf' => $i6naf,
'i4naff' => $i4naff,
'i6naff' => $i6naff,
'rttl10' => $rttl10,
'rtt10t100' => $rtt10t100,
'rtt100t500' => $rtt100t500,
'rtt500t800' => $rtt500t800,
'rtt800t1600' => $rtt800t1600,
'rttg1600' => $rttg1600,
'bs' => $bs,
'rr' => $rr,
);
$tags = array('name' => $name, 'app_id' => $app_id, 'rrd_def' => $rrd_def, 'rrd_name' => $rrd_name);
data_update($device, 'app', $tags, $fields);
//
// CACHE PROCESSING
//
list ($ch, $cm, $chfq, $cmfq, $crddtme, $crddtte, $cdn, $cdhb, $ctmt, $ctmiu, $cthmiu,
$chmt, $chmiu, $chhmiu) = explode(',', $cache);
$rrd_name = array('app', $name, $app_id, 'cache');
$rrd_def = RrdDefinition::make()
->addDataset('ch', 'DERIVE', 0)
->addDataset('cm', 'DERIVE', 0)
->addDataset('chfq', 'DERIVE', 0)
->addDataset('cmfq', 'DERIVE', 0)
->addDataset('crddtme', 'DERIVE', 0)
->addDataset('crddtte', 'DERIVE', 0)
->addDataset('cdn', 'GAUGE', 0)
->addDataset('cdhb', 'GAUGE', 0)
->addDataset('ctmt', 'GAUGE', 0)
->addDataset('ctmiu', 'GAUGE', 0)
->addDataset('cthmiu', 'GAUGE', 0)
->addDataset('chmt', 'GAUGE', 0)
->addDataset('chmiu', 'GAUGE', 0)
->addDataset('chhmiu', 'GAUGE', 0);
$fields = array(
'ch' => $ch,
'cm' => $cm,
'chfq' => $chfq,
'cmfq' => $cmfq,
'crddtme' => $crddtme,
'crddtte' => $crddtte,
'cdn' => $cdn,
'cdhb' => $cdhb,
'ctmt' => $ctmt,
'ctmiu' => $ctmiu,
'cthmiu' => $cthmiu,
'chmt' => $chmt,
'chmiu' => $chmiu,
'chhmiu' => $chhmiu,
);
$tags = compact('name', 'app_id', 'rrd_name', 'rrd_def');
data_update($device, 'app', $tags, $fields);
//
// ADB PROCESSING
//
list ($ahts, $aiht, $nhts, $niht) = explode(',', $adb);
$rrd_name = array('app', $name, $app_id, 'adb');
$rrd_def = RrdDefinition::make()
->addDataset('ahts', 'GAUGE', 0)
->addDataset('aiht', 'GAUGE', 0)
->addDataset('nhts', 'GAUGE', 0)
->addDataset('niht', 'GAUGE', 0);
$fields = array(
'ahts' => $ahts,
'aiht' => $aiht,
'nhts' => $nhts,
'niht' => $niht
);
$tags = array('name' => $name, 'app_id' => $app_id, 'rrd_def' => $rrd_def, 'rrd_name' => $rrd_name);
data_update($device, 'app', $tags, $fields);
//
// SOCKETS PROCESSING
//
list ($ui4so, $ui6so, $ti4so, $ti6so, $rso, $ui4sc, $ui6sc, $ti4sc, $ti6sc, $ui4sbf, $ti4sbf, $ui6sbf, $ti6sbf,
$ui4scf, $ti4scf, $ui6scf, $ti6scf, $ui4ce, $ti4ce, $ui6ce, $ti6ce, $ti4ca, $ti6ca, $ui4se, $ti4se, $ui6se,
$ti6se, $ui4re, $ti4re, $ui6re, $ti6re, $ui4sa, $ui6sa, $ti4sa, $ti6sa, $rsa) = explode(',', $sockets);
$rrd_name = array('app', $name, $app_id, 'sockets');
$rrd_def = RrdDefinition::make()
->addDataset('ui4so', 'DERIVE', 0)
->addDataset('ui6so', 'DERIVE', 0)
->addDataset('ti4so', 'DERIVE', 0)
->addDataset('ti6so', 'DERIVE', 0)
->addDataset('rso', 'DERIVE', 0)
->addDataset('ui4sc', 'DERIVE', 0)
->addDataset('ui6sc', 'DERIVE', 0)
->addDataset('ti4sc', 'DERIVE', 0)
->addDataset('ti6sc', 'DERIVE', 0)
->addDataset('ui4sbf', 'DERIVE', 0)
->addDataset('ti4sbf', 'DERIVE', 0)
->addDataset('ui6sbf', 'DERIVE', 0)
->addDataset('ti6sbf', 'DERIVE', 0)
->addDataset('ui4scf', 'DERIVE', 0)
->addDataset('ti4scf', 'DERIVE', 0)
->addDataset('ui6scf', 'DERIVE', 0)
->addDataset('ti6scf', 'DERIVE', 0)
->addDataset('ui4ce', 'DERIVE', 0)
->addDataset('ti4ce', 'DERIVE', 0)
->addDataset('ui6ce', 'DERIVE', 0)
->addDataset('ti6ce', 'DERIVE', 0)
->addDataset('ti4ca', 'DERIVE', 0)
->addDataset('ti6ca', 'DERIVE', 0)
->addDataset('ui4se', 'DERIVE', 0)
->addDataset('ti4se', 'DERIVE', 0)
->addDataset('ui6se', 'DERIVE', 0)
->addDataset('ti6se', 'DERIVE', 0)
->addDataset('ui4re', 'DERIVE', 0)
->addDataset('ti4re', 'DERIVE', 0)
->addDataset('ui6re', 'DERIVE', 0)
->addDataset('ti6re', 'DERIVE', 0)
->addDataset('ui4sa', 'GAUGE', 0)
->addDataset('ui6sa', 'GAUGE', 0)
->addDataset('ti4sa', 'GAUGE', 0)
->addDataset('ti6sa', 'GAUGE', 0)
->addDataset('rsa', 'GAUGE', 0);
$fields = array(
'ui4so' => $ui4so,
'ui6so' => $ui6so,
'ti4so' => $ti4so,
'ti6so' => $ti6so,
'rso' => $rso,
'ui4sc' => $ui4sc,
'ui6sc' => $ui6sc,
'ti4sc' => $ti4sc,
'ti6sc' => $ti6sc,
'ui4sbf' => $ui4sbf,
'ti4sbf' => $ti4sbf,
'ui6sbf' => $ui6sbf,
'ti6sbf' => $ti6sbf,
'ui4scf' => $ui4scf,
'ti4scf' => $ti4scf,
'ui6scf' => $ui6scf,
'ti6scf' => $ti6scf,
'ui4ce' => $ui4ce,
'ti4ce' => $ti4ce,
'ui6ce' => $ui6ce,
'ti6ce' => $ti6ce,
'ti4ca' => $ti4ca,
'ti6ca' => $ti6ca,
'ui4se' => $ui4se,
'ti4se' => $ti4se,
'ui6se' => $ui6se,
'ti6se' => $ti6se,
'ui4re' => $ui4re,
'ti4re' => $ti4re,
'ui6re' => $ui6re,
'ti6re' => $ti6re,
'ui4sa' => $ui4sa,
'ui6sa' => $ui6sa,
'ti4sa' => $ti4sa,
'ti6sa' => $ti6sa,
'rsa' => $ti6sa,
);
$tags = array('name' => $name, 'app_id' => $app_id, 'rrd_def' => $rrd_def, 'rrd_name' => $rrd_name);
data_update($device, 'app', $tags, $fields);
//
// RR SETS PROCESSING
//
list ($a, $aaaa, $afsdb, $apl, $caa, $cdnskey, $cds, $cert, $cname, $dhcid, $dlv, $dnskey, $ds, $ipseckey, $key, $kx,
$loc, $mx, $naptr, $ns, $nsec, $nsec3, $nsec3param, $ptr, $rrsig, $rp, $sig, $soa, $srv, $sshfp, $ta, $tkey, $tlsa,
$tsig, $txt, $uri, $dname, $nxdomain, $any, $axfr, $ixfr, $opt, $spf, $nota, $notaaaa, $notafsdb, $notapl, $notcaa, $notcdnskey,
$notcds, $notcert, $notcname, $notdhcid, $notdlv, $notdnskey, $notds, $notipseckey, $notkey, $notkx, $notloc, $notmx,
$notnaptr, $notns, $notnsec, $notnsec3, $notnsec3param, $notptr, $notrrsig, $notrp, $notsig, $notsoa, $notsrv,
$notsshfp, $notta, $nottkey, $nottlsa, $nottsig, $nottxt, $noturi, $notdname, $notnxdomain, $notany, $notaxfr, $notixfr, $notopt,
$notspf) = explode(',', $rrsets);
$rrd_def = RrdDefinition::make()
->addDataset('any', 'GAUGE', 0)
->addDataset('a', 'GAUGE', 0)
->addDataset('aaaa', 'GAUGE', 0)
->addDataset('cname', 'GAUGE', 0)
->addDataset('mx', 'GAUGE', 0)
->addDataset('ns', 'GAUGE', 0)
->addDataset('ptr', 'GAUGE', 0)
->addDataset('soa', 'GAUGE', 0)
->addDataset('srv', 'GAUGE', 0)
->addDataset('spf', 'GAUGE', 0)
->addDataset('afsdb', 'GAUGE', 0)
->addDataset('apl', 'GAUGE', 0)
->addDataset('caa', 'GAUGE', 0)
->addDataset('cdnskey', 'GAUGE', 0)
->addDataset('cds', 'GAUGE', 0)
->addDataset('cert', 'GAUGE', 0)
->addDataset('dhcid', 'GAUGE', 0)
->addDataset('dlv', 'GAUGE', 0)
->addDataset('dnskey', 'GAUGE', 0)
->addDataset('ds', 'GAUGE', 0)
->addDataset('ipseckey', 'GAUGE', 0)
->addDataset('key', 'GAUGE', 0)
->addDataset('kx', 'GAUGE', 0)
->addDataset('loc', 'GAUGE', 0)
->addDataset('naptr', 'GAUGE', 0)
->addDataset('nsec', 'GAUGE', 0)
->addDataset('nsec3', 'GAUGE', 0)
->addDataset('nsec3param', 'GAUGE', 0)
->addDataset('rrsig', 'GAUGE', 0)
->addDataset('rp', 'GAUGE', 0)
->addDataset('sig', 'GAUGE', 0)
->addDataset('sshfp', 'GAUGE', 0)
->addDataset('ta', 'GAUGE', 0)
->addDataset('tkey', 'GAUGE', 0)
->addDataset('tlsa', 'GAUGE', 0)
->addDataset('tsig', 'GAUGE', 0)
->addDataset('txt', 'GAUGE', 0)
->addDataset('uri', 'GAUGE', 0)
->addDataset('dname', 'GAUGE', 0)
->addDataset('nxdomain', 'GAUGE', 0)
->addDataset('axfr', 'GAUGE', 0)
->addDataset('ixfr', 'GAUGE', 0)
->addDataset('opt', 'GAUGE', 0);
//first handle the positive
$rrd_name = array('app', $name, $app_id, 'rrpositive');
$fields = array(
'any' => $any,
'a' => $a,
'aaaa' => $aaaa,
'cname' => $cname,
'mx' => $mx,
'ns' => $ns,
'ptr' => $ptr,
'soa' => $soa,
'srv' => $srv,
'spf' => $spf,
'afsdb' => $afsdb,
'apl' => $apl,
'caa' => $caa,
'cdnskey' => $cdnskey,
'cds' => $cds,
'cert' => $cert,
'dhcid' => $dhcid,
'dlv' => $dlv,
'dnskey' => $dnskey,
'ds' => $ds,
'ipseckey' => $ipseckey,
'key' => $key,
'kx' => $kx,
'loc' => $loc,
'naptr' => $naptr,
'nsec' => $nsec,
'nsec3' => $nsec3,
'nsec3param' => $nsec3param,
'rrsig' => $rrsig,
'rp' => $rp,
'sig' => $sig,
'sshfp' => $sshfp,
'ta' => $ta,
'tkey' => $tkey,
'tlsa' => $tlsa,
'tsig' => $tsig,
'txt' => $txt,
'uri' => $uri,
'dname' => $dname,
'nxdomain' => $nxdomain,
'axfr' => $axfr,
'ixfr' => $ixfr,
'opt' => $opt,
);
$tags = array('name' => $name, 'app_id' => $app_id, 'rrd_def' => $rrd_def, 'rrd_name' => $rrd_name);
data_update($device, 'app', $tags, $fields);
// now handle the negative
$rrd_name = array('app', $name, $app_id, 'rrnegative');
$fields = array(
'any' => $notany,
'a' => $nota,
'aaaa' => $notaaaa,
'cname' => $notcname,
'mx' => $notmx,
'ns' => $notns,
'ptr' => $notptr,
'soa' => $notsoa,
'srv' => $notsrv,
'spf' => $notspf,
'afsdb' => $notafsdb,
'apl' => $notapl,
'caa' => $notcaa,
'cdnskey' => $notcdnskey,
'cds' => $notcds,
'cert' => $notcert,
'dhcid' => $notdhcid,
'dlv' => $notdlv,
'dnskey' => $notdnskey,
'ds' => $notds,
'ipseckey' => $notipseckey,
'key' => $notkey,
'kx' => $notkx,
'loc' => $notloc,
'naptr' => $notnaptr,
'nsec' => $notnsec,
'nsec3' => $notnsec3,
'nsec3param' => $notnsec3param,
'rrsig' => $notrrsig,
'rp' => $notrp,
'sig' => $notsig,
'sshfp' => $notsshfp,
'ta' => $notta,
'tkey' => $nottkey,
'tlsa' => $nottlsa,
'tsig' => $nottsig,
'txt' => $nottxt,
'uri' => $noturi,
'dname' => $notdname,
'nxdomin'=> $notnxdomain,
'axfr' => $notaxfr,
'ixfr' => $notixfr,
'opt' => $notopt,
);
$tags = array('name' => $name, 'app_id' => $app_id, 'rrd_def' => $rrd_def, 'rrd_name' => $rrd_name);
data_update($device, 'app', $tags, $fields);