Add graphs to graphs menu page.

Use rrd_name() function
Add copyright headers
This commit is contained in:
Tony Murray
2016-06-09 00:40:04 -05:00
parent 2e23d14b98
commit 36818e7a52
8 changed files with 185 additions and 14 deletions

View File

@@ -1,5 +1,29 @@
<?php
$rrd = $config['rrd_dir'].'/'.$device['hostname'].'/app-rrdcached-'.$app['app_id'].'.rrd';
/**
* rrdcached.inc.php
*
* Generate the rrd file and verify it is valid
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2016 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
$rrd = rrd_name($device['hostname'], array('app', 'rrdcached', $app['app_id']));
if (is_file($rrd)) {
$rrd_filename = $rrd;
}

View File

@@ -1,4 +1,27 @@
<?php
/**
* rrdcached_events.inc.php
*
* Generates a combined graph of events for rrdcached
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2016 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
include 'rrdcached.inc.php';

View File

@@ -1,4 +1,27 @@
<?php
/**
* rrdcached_journal.inc.php
*
* Generates a graph of journal stats for rrdcached
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2016 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
include 'rrdcached.inc.php';
@@ -8,12 +31,12 @@ $rrd_list = array(
array(
'ds' => 'journal_rotate',
'filename' => $rrd_filename,
'descr' => 'Rotated',
'descr' => 'Journal Rotated',
),
array(
'ds' => 'journal_bytes',
'filename' => $rrd_filename,
'descr' => 'Bytes Written',
'descr' => 'Journal Bytes Written',
)
);

View File

@@ -1,4 +1,27 @@
<?php
/**
* rrdcached_queue_length.inc.php
*
* Generates a graph of the queue length for rrdcached
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2016 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
require 'rrdcached.inc.php';
require 'includes/graphs/common.inc.php';
@@ -9,6 +32,6 @@ $colour_area = 'F37900';
$colour_line = 'FFA700';
$colour_area_max = 'F78800';
$unit_text = 'Count';
$unit_text = 'Queue Length';
require 'includes/graphs/generic_simplex.inc.php';

View File

@@ -1,4 +1,27 @@
<?php
/**
* rrdcached_tree.inc.php
*
* Generates a graph of the tree stats for rrdcached
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2016 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
include 'rrdcached.inc.php';
@@ -8,12 +31,12 @@ $rrd_list = array(
array(
'ds' => 'tree_depth',
'filename' => $rrd_filename,
'descr' => 'Depth',
'descr' => 'Tree Depth',
),
array(
'ds' => 'tree_nodes_number',
'filename' => $rrd_filename,
'descr' => 'Nodes',
'descr' => 'Tree Nodes',
)
);

View File

@@ -33,6 +33,13 @@ $graphs['nginx'] = array(
'req',
);
$graphs['rrdcached'] = array(
'queue_length',
'events',
'tree',
'journal'
);
$graphs['bind'] = array('queries');
$graphs['tinydns'] = array(

View File

@@ -1,4 +1,27 @@
<?php
/**
* rrdcached.inc.php
*
* Shows the graphs for rrdcached apps
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2016 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
global $config;

View File

@@ -1,27 +1,52 @@
<?php
/**
* rrdcached.inc.php
*
* rrdcached application polling module
* Capable of collecting stats from the agent or via direct connection
* Only the default tcp port is supported, and unix sockets only work on localhost
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2016 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
echo ' rrdcached';
$data = "";
if($agent_data['app']['rrdcached']) {
if ($agent_data['app']['rrdcached']) {
$data = $agent_data['app']['rrdcached'];
} else {
d_echo("\nNo Agent Data. Attempting to connect directly to the rrdcached server ".$device['hostname'].":42217\n");
d_echo("\nNo Agent Data. Attempting to connect directly to the rrdcached server " . $device['hostname'] . ":42217\n");
$sock = fsockopen($device['hostname'], 42217, $errno, $errstr, 5);
if(!$sock && $device['hostname'] == 'localhost') {
if (!$sock && $device['hostname'] == 'localhost') {
if (file_exists('/var/run/rrdcached.sock')) {
$sock = fsockopen('unix:///var/run/rrdcached.sock');
} elseif (file_exists('/run/rrdcached.sock')) {
$sock = fsockopen('unix:///run/rrdcached.sock');
$sock = fsockopen('unix:///var/run/rrdcached.sock');
} elseif (file_exists('/run/rrdcached.sock')) {
$sock = fsockopen('unix:///run/rrdcached.sock');
} elseif (file_exists('/tmp/rrdcached.sock')) {
$sock = fsockopen('unix:///tmp/rrdcached.sock');
$sock = fsockopen('unix:///tmp/rrdcached.sock');
}
}
if($sock) {
if ($sock) {
fwrite($sock, "STATS\n");
$max = -1;
$count = 0;