Added TinyDNS (djbdns) Graphs & Application.

Data obtained by tinystats (http://www.morettoni.net/tinystats.en.html) via check_mk
This commit is contained in:
f0o
2015-01-17 19:27:44 +00:00
parent 56596d03f3
commit dd6f1f63ff
8 changed files with 306 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
<?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/>. */
/**
* TinyDNS DNSSec Graph
* @author Daniel Preussker <f0o@devilcode.org>
* @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");
?>

View File

@@ -0,0 +1,48 @@
<?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/>. */
/**
* TinyDNS Error Graph
* @author Daniel Preussker <f0o@devilcode.org>
* @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");
?>

View File

@@ -0,0 +1,48 @@
<?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/>. */
/**
* TinyDNS Other Graph
* @author Daniel Preussker <f0o@devilcode.org>
* @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");
?>

View File

@@ -0,0 +1,51 @@
<?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/>. */
/**
* TinyDNS Query Graph
* @author Daniel Preussker <f0o@devilcode.org>
* @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");
?>

View File

@@ -0,0 +1,38 @@
<?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/>. */
/**
* TinyDNS Application
* @author Daniel Preussker <f0o@devilcode.org>
* @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 "<h3>$text</h3><tr bgcolor='$row_colour'><td colspan=5>";
include("includes/print-graphrow.inc.php");
echo "</td></tr>";
}
?>

View File

@@ -0,0 +1,53 @@
<?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/>. */
/**
* TinyDNS Statistics
* @author Daniel Preussker <f0o@devilcode.org>
* @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']);
}
?>

View File

@@ -43,6 +43,7 @@ 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 == "tinydns") { $sa = "app"; $sb = "tinydns"; }
# if ($section == "drbd") { $sa = "app"; $sb = "drbd"; }
if (!empty($sa) && !empty($sb))

18
scripts/agent-local/tinydns Executable file
View File

@@ -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 <http://www.gnu.org/licenses/>.
echo "<<<tinydns>>>"
head -n1 /service/dns/log/main/tinystats/tinystats.out