mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
feature: Added exim-stats to applications #5008
This commit is contained in:
@@ -24,6 +24,7 @@ Different applications support a variety of ways collect data: by direct connect
|
|||||||
1. [Unbound](#unbound) - Agent
|
1. [Unbound](#unbound) - Agent
|
||||||
1. [UPS-nut](#ups-nut) - SNMP extend
|
1. [UPS-nut](#ups-nut) - SNMP extend
|
||||||
1. [UPS-apcups](#ups-apcups) - SNMP extend
|
1. [UPS-apcups](#ups-apcups) - SNMP extend
|
||||||
|
1. [EXIM Stats](#exim-stats) - SNMP extend
|
||||||
1. [Agent Setup](#agent-setup)
|
1. [Agent Setup](#agent-setup)
|
||||||
|
|
||||||
|
|
||||||
@@ -371,7 +372,21 @@ extend ups-apcups /etc/snmp/ups-apcups.sh
|
|||||||
4. Restart snmpd on your host
|
4. Restart snmpd on your host
|
||||||
5. On the device page in Librenms, edit your host and check the `UPS apcups` under the Applications tab.
|
5. On the device page in Librenms, edit your host and check the `UPS apcups` under the Applications tab.
|
||||||
|
|
||||||
|
### EXIM Stats
|
||||||
|
SNMP extend script to get your exim stats data into your host.
|
||||||
|
|
||||||
|
##### SNMP Extend
|
||||||
|
1. Copy the [exim stats](https://github.com/librenms/librenms-agent/blob/1c091800b713e26395796b5d5379421fc268a39b/snmp/exim-stats.sh) to `/etc/snmp/` (or any other suitable location) on your host.
|
||||||
|
2. Make the script executable: `chmod +x /etc/snmp/exim-stats.sh`
|
||||||
|
3. Edit your snmpd.conf file (usually `/etc/snmp/snmpd.conf`) and add:
|
||||||
|
```
|
||||||
|
extend exim-stats /etc/snmp/exim-stats.sh
|
||||||
|
```
|
||||||
|
4. If you are using sudo edit your sudo users (usually `visudo`) and add at the bottom:
|
||||||
|
```
|
||||||
|
snmp ALL=(ALL) NOPASSWD: /etc/snmp/exim-stats.sh, /usr/bin/exim*
|
||||||
|
```
|
||||||
|
5. Restart snmpd on your host
|
||||||
|
|
||||||
Agent Setup
|
Agent Setup
|
||||||
-----------
|
-----------
|
||||||
|
@@ -97,6 +97,9 @@ function nicecase($item)
|
|||||||
case 'gpsd':
|
case 'gpsd':
|
||||||
return 'GPSD';
|
return 'GPSD';
|
||||||
|
|
||||||
|
case 'exim-stats':
|
||||||
|
return 'EXIM Stats';
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return ucfirst($item);
|
return ucfirst($item);
|
||||||
}
|
}
|
||||||
|
54
html/includes/graphs/application/exim-stats_frozen.inc.php
Normal file
54
html/includes/graphs/application/exim-stats_frozen.inc.php
Normal 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';
|
54
html/includes/graphs/application/exim-stats_queue.inc.php
Normal file
54
html/includes/graphs/application/exim-stats_queue.inc.php
Normal 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';
|
@@ -94,6 +94,7 @@ $graphs['nfs-v3-stats'] = array(
|
|||||||
$graphs['os-updates'] = array(
|
$graphs['os-updates'] = array(
|
||||||
'packages',
|
'packages',
|
||||||
);
|
);
|
||||||
|
|
||||||
$graphs['dhcp-stats'] = array(
|
$graphs['dhcp-stats'] = array(
|
||||||
'stats',
|
'stats',
|
||||||
);
|
);
|
||||||
@@ -126,6 +127,11 @@ $graphs['gpsd'] = array(
|
|||||||
'mode',
|
'mode',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$graphs['exim-stats'] = array(
|
||||||
|
'frozen',
|
||||||
|
'queue'
|
||||||
|
);
|
||||||
|
|
||||||
print_optionbar_start();
|
print_optionbar_start();
|
||||||
|
|
||||||
echo "<span style='font-weight: bold;'>Apps</span> » ";
|
echo "<span style='font-weight: bold;'>Apps</span> » ";
|
||||||
|
46
html/pages/device/apps/exim-stats.inc.php
Normal file
46
html/pages/device/apps/exim-stats.inc.php
Normal 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>';
|
||||||
|
}
|
44
includes/polling/applications/exim-stats.inc.php
Normal file
44
includes/polling/applications/exim-stats.inc.php
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<?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>
|
||||||
|
*/
|
||||||
|
|
||||||
|
//NET-SNMP-EXTEND-MIB::nsExtendOutputFull."exim-stats"
|
||||||
|
$name = 'exim-stats';
|
||||||
|
$app_id = $app['app_id'];
|
||||||
|
$oid = '.1.3.6.1.4.1.8072.1.3.2.3.1.2.10.101.120.105.109.45.115.116.97.116.115';
|
||||||
|
$stats = snmp_get($device, $oid, '-Oqv');
|
||||||
|
|
||||||
|
echo ' '.$name;
|
||||||
|
|
||||||
|
list ($frozen, $queue) = explode("\n", $stats);
|
||||||
|
|
||||||
|
$rrd_name = array('app', $name, $app_id);
|
||||||
|
$rrd_def = array(
|
||||||
|
'DS:frozen:GAUGE:600:0:U',
|
||||||
|
'DS:queue:GAUGE:600:0:U'
|
||||||
|
);
|
||||||
|
|
||||||
|
$fields = array(
|
||||||
|
'frozen' => $frozen,
|
||||||
|
'queue' => $queue
|
||||||
|
);
|
||||||
|
|
||||||
|
$tags = compact('name', 'app_id', 'rrd_name', 'rrd_def');
|
||||||
|
data_update($device, 'app', $tags, $fields);
|
Reference in New Issue
Block a user