feature: Added exim-stats to applications #5008

This commit is contained in:
crcro
2017-01-20 10:47:13 +02:00
committed by Neil Lathwood
parent 81bde0b8da
commit a9a02a0f80
7 changed files with 222 additions and 0 deletions

View File

@@ -97,6 +97,9 @@ function nicecase($item)
case 'gpsd':
return 'GPSD';
case 'exim-stats':
return 'EXIM Stats';
default:
return ucfirst($item);
}

View File

@@ -0,0 +1,54 @@
<?php
/*
* 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 2017 crcro
* @author Cercel Valentin <crc@nuamchefazi.ro>
*/
require 'includes/graphs/common.inc.php';
$name = 'exim-stats';
$app_id = $app['app_id'];
$scale_min = 0;
$colours = 'mixed';
$unit_text = 'Frozen';
$unitlen = 18;
$bigdescrlen = 18;
$smalldescrlen = 18;
$dostack = 0;
$printtotal = 0;
$addarea = 1;
$transparency = 33;
$rrd_filename = rrd_name($device['hostname'], array('app', $name, $app_id));
$array = array(
'frozen' => array('descr' => 'Frozen emails','colour' => 'c13a38',),
);
$i = 0;
if (is_file($rrd_filename)) {
foreach ($array as $ds => $vars) {
$rrd_list[$i]['filename'] = $rrd_filename;
$rrd_list[$i]['descr'] = $vars['descr'];
$rrd_list[$i]['ds'] = $ds;
$rrd_list[$i]['colour'] = $vars['colour'];
$i++;
}
} else {
echo "file missing: $rrd_filename";
}
require 'includes/graphs/generic_v3_multiline.inc.php';

View File

@@ -0,0 +1,54 @@
<?php
/*
* 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 2017 crcro
* @author Cercel Valentin <crc@nuamchefazi.ro>
*/
require 'includes/graphs/common.inc.php';
$name = 'exim-stats';
$app_id = $app['app_id'];
$scale_min = 0;
$colours = 'mixed';
$unit_text = 'Queue';
$unitlen = 18;
$bigdescrlen = 18;
$smalldescrlen = 18;
$dostack = 0;
$printtotal = 0;
$addarea = 1;
$transparency = 33;
$rrd_filename = rrd_name($device['hostname'], array('app', $name, $app_id));
$array = array(
'frozen' => array('descr' => 'Queue emails','colour' => 'c13a38',),
);
$i = 0;
if (is_file($rrd_filename)) {
foreach ($array as $ds => $vars) {
$rrd_list[$i]['filename'] = $rrd_filename;
$rrd_list[$i]['descr'] = $vars['descr'];
$rrd_list[$i]['ds'] = $ds;
$rrd_list[$i]['colour'] = $vars['colour'];
$i++;
}
} else {
echo "file missing: $rrd_filename";
}
require 'includes/graphs/generic_v3_multiline.inc.php';

View File

@@ -94,6 +94,7 @@ $graphs['nfs-v3-stats'] = array(
$graphs['os-updates'] = array(
'packages',
);
$graphs['dhcp-stats'] = array(
'stats',
);
@@ -126,6 +127,11 @@ $graphs['gpsd'] = array(
'mode',
);
$graphs['exim-stats'] = array(
'frozen',
'queue'
);
print_optionbar_start();
echo "<span style='font-weight: bold;'>Apps</span> &#187; ";

View File

@@ -0,0 +1,46 @@
<?php
/*
* 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 2017 crcro
* @author Cercel Valentin <crc@nuamchefazi.ro>
*/
global $config;
$graphs = array(
'exim-stats_frozen' => 'Frozen',
'exim-stats_queue' => 'Queue'
);
foreach ($graphs as $key => $text) {
$graph_type = $key;
$graph_array['height'] = '100';
$graph_array['width'] = '215';
$graph_array['to'] = $config['time']['now'];
$graph_array['id'] = $app['app_id'];
$graph_array['type'] = 'application_'.$key;
echo '<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">'.$text.'</h3>
</div>
<div class="panel-body">
<div class="row">';
include 'includes/print-graphrow.inc.php';
echo '</div>';
echo '</div>';
echo '</div>';
}