diff --git a/doc/Extensions/Agent-Setup.md b/doc/Extensions/Agent-Setup.md index 296ba1790..cf8a2508b 100644 --- a/doc/Extensions/Agent-Setup.md +++ b/doc/Extensions/Agent-Setup.md @@ -35,3 +35,57 @@ mkdir -p /usr/lib/check_mk_agent/plugins /usr/lib/check_mk_agent/local * Then under Applications, enable the apps that you plan to monitor. * Wait, in around 10 minutes you should start seeing data in your graphs under Apps for the device. +## Application Specific Configuration + +### BIND9/named + +Create stats file with appropriate permissions: +```shell +~$ touch /etc/bind/named.stats +~$ chown bind:bind /etc/bind/named.stats +``` +Change `user:group` to the user and group that's running bind/named. + +Bind/named configuration: +```text +options { + ... + statistics-file "/etc/bind/named.stats"; + zone-statistics yes; + ... +}; +``` +Restart your bind9/named after changing the configuration. + +Verify that everything works by executing `rdnc stats && cat /etc/bind/named.stats`. +In case you get a `Permission Denied` error, make sure you chown'ed correctly. + +Note: if you change the path you will need to change the path in `scripts/agent-local/bind`. + +### TinyDNS/djbdns + +__Installation__: + +1. Get tinystats sources from http://www.morettoni.net/tinystats.en.html +2. Compile like as advised. + _Note_: In case you get `Makefile:9: *** missing separator. Stop.`, compile manually using: + * With IPv6: `gcc -Wall -O2 -fstack-protector -DWITH_IPV6 -o tinystats tinystats.c` + * Without IPv6: `gcc -Wall -O2 -fstack-protector -o tinystats tinystats.c` +3. Install into prefered path, like `/usr/bin/`. + +__Configuration__: + +_Note_: In this part we assume that you use DJB's [Daemontools](http://cr.yp.to/daemontools.html) to start/stop tinydns. +And that your tinydns-instance is located in `/service/dns`, adjust this path if necesary. + +1. Replace your _log_'s `run` file, typically located in `/service/dns/log/run` with: + ``` + #!/bin/sh + + exec setuidgid dnslog tinystats ./main/tinystats/ multilog t n3 s250000 ./main/ + ``` +2. Create tinystats directory and chown: + `mkdir /service/dns/log/main/tinystats && chown dnslog:nofiles /service/dns/log/main/tinystats` +3. Restart TinyDNS and Daemontools: `/etc/init.d/svscan restart` + _Note_: Some say `svc -t /service/dns` is enough, on my install (Gentoo) it doesnt rehook the logging and I'm forced to restart it entirely. + diff --git a/html/includes/graphs/application/bind_queries.inc.php b/html/includes/graphs/application/bind_queries.inc.php new file mode 100644 index 000000000..985e720e7 --- /dev/null +++ b/html/includes/graphs/application/bind_queries.inc.php @@ -0,0 +1,50 @@ + + * 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 . */ + +/** + * Bind9 Query Graph + * @author Daniel Preussker + * @copyright 2015 f0o, LibreNMS + * @license GPL + * @package LibreNMS + * @subpackage Graphs + */ + +include("includes/graphs/common.inc.php"); + +$i = 0; +$scale_min = 0; +$nototal = 1; +$unit_text = "Query/sec"; +$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/app-bind-".$app['app_id'].".rrd"; +$array = array( 'any', 'a', 'aaaa', 'cname', 'mx', 'ns', 'ptr', 'soa', 'srv', 'spf' ); +$colours = "merged"; +$rrd_list = array(); + +$config['graph_colours']['merged'] = array_merge($config['graph_colours']['greens'], $config['graph_colours']['blues']); + +if( is_file($rrd_filename) ) { + foreach( $array as $ds ) { + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = strtoupper($ds); + $rrd_list[$i]['ds'] = $ds; + $i++; + } +} else { + echo "file missing: $file"; +} + +include("includes/graphs/generic_multi_simplex_seperated.inc.php"); +?> diff --git a/html/includes/graphs/application/tinydns_dnssec.inc.php b/html/includes/graphs/application/tinydns_dnssec.inc.php new file mode 100644 index 000000000..14b4c8136 --- /dev/null +++ b/html/includes/graphs/application/tinydns_dnssec.inc.php @@ -0,0 +1,49 @@ + + * 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 . */ + +/** + * TinyDNS DNSSec Graph + * @author Daniel Preussker + * @copyright 2015 f0o, LibreNMS + * @license GPL + * @package LibreNMS + * @subpackage Graphs + */ + +include("includes/graphs/common.inc.php"); + +$i = 0; +$scale_min = 0; +$nototal = 1; +$unit_text = "Query/sec"; +$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/app-tinydns-".$app['app_id'].".rrd"; +//$array = explode(":","hinfo:rp:sig:key:axfr:total"); +$array = array( "key", "sig" ); +$colours = "mixed"; +$rrd_list = array(); + +if( is_file($rrd_filename) ) { + foreach( $array as $ds ) { + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = strtoupper($ds); + $rrd_list[$i]['ds'] = $ds; + $i++; + } +} else { + echo "file missing: $file"; +} + +include("includes/graphs/generic_multi_simplex_seperated.inc.php"); +?> diff --git a/html/includes/graphs/application/tinydns_errors.inc.php b/html/includes/graphs/application/tinydns_errors.inc.php new file mode 100644 index 000000000..6cec421c9 --- /dev/null +++ b/html/includes/graphs/application/tinydns_errors.inc.php @@ -0,0 +1,48 @@ + + * 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 . */ + +/** + * TinyDNS Error Graph + * @author Daniel Preussker + * @copyright 2015 f0o, LibreNMS + * @license GPL + * @package LibreNMS + * @subpackage Graphs + */ + +include("includes/graphs/common.inc.php"); + +$i = 0; +$scale_min = 0; +$nototal = 1; +$unit_text = "Query/sec"; +$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/app-tinydns-".$app['app_id'].".rrd"; +$array = array( "notauth", "notimpl", "badclass", "noquery" ); +$colours = "oranges"; +$rrd_list = array(); + +if( is_file($rrd_filename) ) { + foreach( $array as $ds ) { + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = strtoupper($ds); + $rrd_list[$i]['ds'] = $ds; + $i++; + } +} else { + echo "file missing: $file"; +} + +include("includes/graphs/generic_multi_simplex_seperated.inc.php"); +?> diff --git a/html/includes/graphs/application/tinydns_other.inc.php b/html/includes/graphs/application/tinydns_other.inc.php new file mode 100644 index 000000000..b7c08f88e --- /dev/null +++ b/html/includes/graphs/application/tinydns_other.inc.php @@ -0,0 +1,48 @@ + + * 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 . */ + +/** + * TinyDNS Other Graph + * @author Daniel Preussker + * @copyright 2015 f0o, LibreNMS + * @license GPL + * @package LibreNMS + * @subpackage Graphs + */ + +include("includes/graphs/common.inc.php"); + +$i = 0; +$scale_min = 0; +$nototal = 1; +$unit_text = "Query/sec"; +$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/app-tinydns-".$app['app_id'].".rrd"; +$array = array( "other", "hinfo", "rp", "axfr" ); +$colours = "mixed"; +$rrd_list = array(); + +if( is_file($rrd_filename) ) { + foreach( $array as $ds ) { + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = strtoupper($ds); + $rrd_list[$i]['ds'] = $ds; + $i++; + } +} else { + echo "file missing: $file"; +} + +include("includes/graphs/generic_multi_simplex_seperated.inc.php"); +?> diff --git a/html/includes/graphs/application/tinydns_queries.inc.php b/html/includes/graphs/application/tinydns_queries.inc.php new file mode 100644 index 000000000..2d2b03ebe --- /dev/null +++ b/html/includes/graphs/application/tinydns_queries.inc.php @@ -0,0 +1,51 @@ + + * 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 . */ + +/** + * TinyDNS Query Graph + * @author Daniel Preussker + * @copyright 2015 f0o, LibreNMS + * @license GPL + * @package LibreNMS + * @subpackage Graphs + */ + +include("includes/graphs/common.inc.php"); + +$i = 0; +$scale_min = 0; +$nototal = 1; +$unit_text = "Query/sec"; +$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/app-tinydns-".$app['app_id'].".rrd"; +//$array = explode(":","hinfo:rp:sig:key:axfr:total"); +$array = array( "any", "a", "aaaa", "cname", "mx", "ns", "ptr", "soa", "txt" ); +$colours = "merged"; +$rrd_list = array(); + +$config['graph_colours']['merged'] = array_merge($config['graph_colours']['greens'], $config['graph_colours']['blues']); + +if( is_file($rrd_filename) ) { + foreach( $array as $ds ) { + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = strtoupper($ds); + $rrd_list[$i]['ds'] = $ds; + $i++; + } +} else { + echo "file missing: $file"; +} + +include("includes/graphs/generic_multi_simplex_seperated.inc.php"); +?> diff --git a/html/index.php b/html/index.php index 4268fe230..46ceedac6 100755 --- a/html/index.php +++ b/html/index.php @@ -291,22 +291,23 @@ if (is_array($pagetitle)) echo(""); } ?> + + diff --git a/html/pages/about.inc.php b/html/pages/about.inc.php index 4b795cc45..f8b0f99f4 100644 --- a/html/pages/about.inc.php +++ b/html/pages/about.inc.php @@ -19,7 +19,6 @@ $git_log = `git log -10`;
-

License

 Copyright (C) 2006-2012 Adam Armstrong
@@ -37,11 +36,9 @@ 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/.
-   -

Statistics

@@ -71,10 +68,11 @@ $stat_vrf = dbFetchCell("SELECT COUNT(vrf_id) FROM `vrfs`"); $stat_vlans = dbFetchCell("SELECT COUNT(vlan_id) FROM `vlans`"); echo(" - +
+
- - + + @@ -109,9 +107,10 @@ echo("
Devices$stat_devices Ports$stat_ports Devices$stat_devices Ports$stat_ports
IPv4 Addresses$stat_ipv4_addy Toner$stat_toner
+
"); -print_optionbar_end(); ?> +?>
@@ -127,29 +126,30 @@ $mysql_version = dbFetchCell("SELECT version()"); $netsnmp_version = shell_exec($config['snmpget'] . " --version 2>&1"); $rrdtool_version = implode(" ",array_slice(explode(" ",shell_exec($config['rrdtool'] . " --version |head -n1")),1,1)); $schema_version = dbFetchCell("SELECT version FROM dbSchema"); -$git_log = `git log -10`; +$version = `git rev-parse --short HEAD`; -print_optionbar_start(NULL); echo(" - - - - - - - +
+
$project_name$project_version
DB Schema#$schema_version
Apache$apache_version
PHP$php_version
MySQL$mysql_version
RRDtool$rrdtool_version
+ + + + + +
Version$version
DB Schema#$schema_version
Apache$apache_version
PHP$php_version
MySQL$mysql_version
RRDtool$rrdtool_version
+
"); -print_optionbar_end(); ?>
LibreNMS is a community-based project. Please feel free to join us and contribute code, documentation, and bug reports:

- Web site | + Web site | + GitHub | Bug tracker | Mailing list | Twitter | @@ -160,12 +160,12 @@ print_optionbar_end();

-

The Team

+

The Team

Paul Gear Project Founder
Tyler Christiansen Developer
-

Acknowledgements

+

Acknowledgements

Observium Codebase for fork.
Mark James Silk Iconset.
diff --git a/html/pages/apps.inc.php b/html/pages/apps.inc.php index 751be33e1..1a20acc41 100644 --- a/html/pages/apps.inc.php +++ b/html/pages/apps.inc.php @@ -5,6 +5,8 @@ $graphs['drbd'] = array('disk_bits', 'network_bits', 'queue', 'unsynced'); $graphs['mysql'] = array('network_traffic', 'connections', 'command_counters', 'select_types'); $graphs['memcached'] = array('bits', 'commands', 'data', 'items'); $graphs['nginx'] = array('connections', 'req'); +$graphs['bind'] = array('queries'); +$graphs['tinydns'] = array('queries', 'errors', 'dnssec', 'other'); print_optionbar_start(); diff --git a/html/pages/device.inc.php b/html/pages/device.inc.php index b1a825f02..3ab398d49 100644 --- a/html/pages/device.inc.php +++ b/html/pages/device.inc.php @@ -82,6 +82,15 @@ if (device_permitted($vars['device']) || $check_device == $vars['device']) '); } + if (@dbFetchCell("SELECT 1 FROM processes WHERE device_id = '" . $device['device_id'] . "'") > '0') + { + echo('
  • + + Processes + +
  • '); + } + if (isset($config['collectd_dir']) && is_dir($config['collectd_dir'] . "/" . $device['hostname'] ."/")) { echo('
  • diff --git a/html/pages/device/apps/bind.inc.php b/html/pages/device/apps/bind.inc.php new file mode 100644 index 000000000..18b7447d0 --- /dev/null +++ b/html/pages/device/apps/bind.inc.php @@ -0,0 +1,38 @@ + + * 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 . */ + +/** + * Bind9 Application + * @author Daniel Preussker + * @copyright 2015 f0o, LibreNMS + * @license GPL + * @package LibreNMS + * @subpackage Apps + */ + +global $config; +$graphs = array('bind_queries' => 'Queries'); +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 "

    $text

    "; + include("includes/print-graphrow.inc.php"); + echo ""; +} +?> diff --git a/html/pages/device/apps/tinydns.inc.php b/html/pages/device/apps/tinydns.inc.php new file mode 100644 index 000000000..fcf2a6b64 --- /dev/null +++ b/html/pages/device/apps/tinydns.inc.php @@ -0,0 +1,38 @@ + + * 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 . */ + +/** + * TinyDNS Application + * @author Daniel Preussker + * @copyright 2015 f0o, LibreNMS + * @license GPL + * @package LibreNMS + * @subpackage Apps + */ + +global $config; +$graphs = array('tinydns_queries' => 'Queries', 'tinydns_errors' => 'Errors', 'tinydns_dnssec' => 'DNSSec', 'tinydns_other' => 'Other'); +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 "

    $text

    "; + include("includes/print-graphrow.inc.php"); + echo ""; +} +?> diff --git a/html/pages/device/processes.inc.php b/html/pages/device/processes.inc.php new file mode 100644 index 000000000..41fda9288 --- /dev/null +++ b/html/pages/device/processes.inc.php @@ -0,0 +1,98 @@ + + * 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 . */ + +/** + * Process Listing + * @author Daniel Preussker + * @copyright 2015 f0o, LibreNMS + * @license GPL + * @package LibreNMS + * @subpackage Pages + */ + +switch( $vars['order'] ) { + case "vsz": + $order = "`vsz`"; + break; + case "rss": + $order = "`rss`"; + break; + case "cputime": + $order = "`cputime`"; + break; + case "user": + $order = "`user`"; + break; + case "command": + $order = "`command`"; + break; + default: + $order = "`pid`"; + break; +} +if( $vars['by'] == "desc" ) { + $by = "desc"; +} else { + $by = "asc"; +} + +$heads = array( + 'PID' => '', + 'VSZ' => 'Virtual Memory', + 'RSS' => 'Resident Memory', + 'cputime' => '', + 'user' => '', + 'command' => '' +); + +echo "
    "; +foreach( $heads as $head=>$extra ) { + unset($lhead, $bhead); + $lhead = strtolower($head); + $bhead = 'asc'; + $icon = ""; + if( '`'.$lhead.'`' == $order ) { + $icon = " class='glyphicon glyphicon-chevron-"; + if( $by == 'asc' ) { + $bhead = 'desc'; + $icon .= 'up'; + } else { + $icon .= 'down'; + } + $icon .= "'"; + } + echo ''; +} +echo ""; + +foreach (dbFetchRows("SELECT * FROM `processes` WHERE `device_id` = ? ORDER BY ".$order." ".$by, array($device['device_id'])) as $entry) { + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; +} +echo"
     '; + if( !empty($extra) ) { + echo "$head"; + } else { + echo $head; + } + echo '
    '.$entry['pid'].''.format_si($entry['vsz']*1024).''.format_si($entry['rss']*1024).''.$entry['cputime'].''.$entry['user'].''.$entry['command'].'
    "; + +?> diff --git a/includes/defaults.inc.php b/includes/defaults.inc.php index 433e34b34..5fbc91e39 100644 --- a/includes/defaults.inc.php +++ b/includes/defaults.inc.php @@ -585,4 +585,6 @@ $config['dateformat']['time'] = "H:i:s"; $config['enable_clear_discovery'] = 1;// Set this to 0 if you want to disable the web option to rediscover devices +$config['enable_footer'] = 1;// Set this to 0 if you want to disable the footer copyright in the web interface + ?> diff --git a/includes/polling/applications/bind.inc.php b/includes/polling/applications/bind.inc.php new file mode 100644 index 000000000..299fdbc6b --- /dev/null +++ b/includes/polling/applications/bind.inc.php @@ -0,0 +1,79 @@ + + * 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 . */ + +/** + * Bind9 Statistics + * @author Daniel Preussker + * @copyright 2015 f0o, LibreNMS + * @license GPL + * @package LibreNMS + * @subpackage Polling + */ + +if( !empty($agent_data['app']['bind']) && $app['app_id'] > 0 ) { + echo " bind "; + $bind = $agent_data['app']['bind']; + $rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/app-bind-".$app['app_id'].".rrd"; + $bind_parsed = array(); + $prefix = ""; + foreach( explode("\n",$bind) as $line ) { + $pattern = '/^\+\+ ([^+]+) \+\+$/'; + preg_match($pattern, $line, $matches); + if( !empty($matches) ) { + $prefix = str_replace(" ","_",strtolower($matches[1])); + $view = $item = $cnt = ""; + } + $pattern = '/^\[View: (\w+)(| .*)\]/'; + preg_match($pattern, $line, $matches); + if( !empty($matches) ) { + if( $matches[1] == "default" ) { + continue; + } else { + $view = $matches[1]; + } + } + $pattern = '/^\[(.*)\]$/'; + preg_match($pattern, $line, $matches); + if( !empty($matches) ) { + $prefix = $matches[1]; + } + $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; + } + } + } + if( !is_file($rrd_filename) ) { + rrdtool_create($rrd_filename, "--step 300 \ + DS:any:COUNTER:600:0:125000000000 \ + DS:a:COUNTER:600:0:125000000000 \ + DS:aaaa:COUNTER:600:0:125000000000 \ + DS:cname:COUNTER:600:0:125000000000 \ + DS:mx:COUNTER:600:0:125000000000 \ + DS:ns:COUNTER:600:0:125000000000 \ + DS:ptr:COUNTER:600:0:125000000000 \ + DS:soa:COUNTER:600:0:125000000000 \ + DS:srv:COUNTER:600:0:125000000000 \ + DS:spf:COUNTER:600:0:125000000000 ".$config['rrd_rra']); + } + rrdtool_update($rrd_filename, "N:".((int) $bind_parsed['incoming_queries']['any']).":".((int) $bind_parsed['incoming_queries']['a']).":".((int) $bind_parsed['incoming_queries']['aaaa']).":".((int) $bind_parsed['incoming_queries']['cname']).":".((int) $bind_parsed['incoming_queries']['mx']).":".((int) $bind_parsed['incoming_queries']['ns']).":".((int) $bind_parsed['incoming_queries']['ptr']).":".((int) $bind_parsed['incoming_queries']['soa']).":".((int) $bind_parsed['incoming_queries']['srv']).":".((int) $bind_parsed['incoming_queries']['spf'])); +} +?> diff --git a/includes/polling/applications/tinydns.inc.php b/includes/polling/applications/tinydns.inc.php new file mode 100644 index 000000000..f676c35b5 --- /dev/null +++ b/includes/polling/applications/tinydns.inc.php @@ -0,0 +1,53 @@ + + * 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 . */ + +/** + * TinyDNS Statistics + * @author Daniel Preussker + * @copyright 2015 f0o, LibreNMS + * @license GPL + * @package LibreNMS + * @subpackage Polling + */ + +if( !empty($agent_data['app']['tinydns']) && $app['app_id'] > 0 ) { + echo " tinydns "; + $rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/app-tinydns-".$app['app_id'].".rrd"; + if( !is_file($rrd_filename) ) { + rrdtool_create($rrd_filename, "--step 300 \ + DS:a:COUNTER:600:0:125000000000 \ + DS:ns:COUNTER:600:0:125000000000 \ + DS:cname:COUNTER:600:0:125000000000 \ + DS:soa:COUNTER:600:0:125000000000 \ + DS:ptr:COUNTER:600:0:125000000000 \ + DS:hinfo:COUNTER:600:0:125000000000 \ + DS:mx:COUNTER:600:0:125000000000 \ + DS:txt:COUNTER:600:0:125000000000 \ + DS:rp:COUNTER:600:0:125000000000 \ + DS:sig:COUNTER:600:0:125000000000 \ + DS:key:COUNTER:600:0:125000000000 \ + DS:aaaa:COUNTER:600:0:125000000000 \ + DS:axfr:COUNTER:600:0:125000000000 \ + DS:any:COUNTER:600:0:125000000000 \ + DS:total:COUNTER:600:0:125000000000 \ + DS:other:COUNTER:600:0:125000000000 \ + DS:notauth:COUNTER:600:0:125000000000 \ + DS:notimpl:COUNTER:600:0:125000000000 \ + DS:badclass:COUNTER:600:0:125000000000 \ + DS:noquery:COUNTER:600:0:125000000000 ".$config['rrd_rra']); + } + rrdtool_update($rrd_filename, "N:".$agent_data['app']['tinydns']); +} +?> diff --git a/includes/polling/unix-agent.inc.php b/includes/polling/unix-agent.inc.php index b413501d8..a1ea028bf 100755 --- a/includes/polling/unix-agent.inc.php +++ b/includes/polling/unix-agent.inc.php @@ -43,6 +43,8 @@ if ($device['os_group'] == "unix") if ($section == "apache") { $sa = "app"; $sb = "apache"; } if ($section == "mysql") { $sa = "app"; $sb = "mysql"; } if ($section == "nginx") { $sa = "app"; $sb = "nginx"; } + if ($section == "bind") { $sa = "app"; $sb = "bind"; } + if ($section == "tinydns") { $sa = "app"; $sb = "tinydns"; } # if ($section == "drbd") { $sa = "app"; $sb = "drbd"; } if (!empty($sa) && !empty($sb)) @@ -82,13 +84,15 @@ if ($device['os_group'] == "unix") if (!empty($agent_data['ps'])) { echo("Processes: "); + dbDelete('processes', 'device_id = ?', array($device['device_id'])); foreach (explode("\n", $agent_data['ps']) as $process) { - $process = preg_replace("/\((.*),([0-9]*),([0-9]*),([0-9\.]*)\)\ (.*)/", "\\1|\\2|\\3|\\4|\\5", $process); - list($user, $vsz, $rss, $pcpu, $command) = explode("|", $process, 5); - $processlist[] = array('user' => $user, 'vsz' => $vsz, 'rss' => $rss, 'pcpu' => $pcpu, 'command' => $command); + $process = preg_replace("/\((.*),([0-9]*),([0-9]*),([0-9\:]*),([0-9]*)\)\ (.*)/", "\\1|\\2|\\3|\\4|\\5|\\6", $process); + list($user, $vsz, $rss, $cputime, $pid, $command) = explode("|", $process, 6); + if( !empty($command) ) { + dbInsert(array('device_id' => $device['device_id'], 'pid' => $pid, 'user' => $user, 'vsz' => $vsz, 'rss' => $rss, 'cputime' => $cputime, 'command' => $command), 'processes'); + } } - #print_r($processlist); echo("\n"); } diff --git a/scripts/agent-local/bind b/scripts/agent-local/bind new file mode 100755 index 000000000..75110d982 --- /dev/null +++ b/scripts/agent-local/bind @@ -0,0 +1,21 @@ +#!/bin/bash +# (c) 2015, 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 . + +stats="/etc/bind/named.stats" + +echo "<<>>" +> $stats +rndc stats && cat $stats + diff --git a/scripts/agent-local/tinydns b/scripts/agent-local/tinydns new file mode 100755 index 000000000..9c980a80c --- /dev/null +++ b/scripts/agent-local/tinydns @@ -0,0 +1,18 @@ +#!/bin/bash +# (c) 2015, 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 . + +echo "<<>>" +head -n1 /service/dns/log/main/tinystats/tinystats.out + diff --git a/sql-schema/039.sql b/sql-schema/039.sql new file mode 100644 index 000000000..c9f2c7a8f --- /dev/null +++ b/sql-schema/039.sql @@ -0,0 +1 @@ +CREATE TABLE IF NOT EXISTS `processes` ( `device_id` int(11) NOT NULL, `pid` int(255) NOT NULL, `vsz` int(255) NOT NULL, `rss` int(255) NOT NULL, `cputime` varchar(12) NOT NULL, `user` varchar(50) NOT NULL, `command` varchar(255) NOT NULL, KEY `device_id` (`device_id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;