feature: Improve Freeswitch agent: add ability to get data via snmp and graph more data (#7549)

* Add ability to get Freeswitch application data via snmp

On your Freeswitch server install the script from
https://github.com/librenms/librenms-agent/blob/master/agent-local/freeswitch
into /etc/snmp, make it executable and adjust it to your installation.
Configure your snmpd to use the sript as an extension. For example on Debian
add the following line to your /etc/snmp/snmpd.conf:

extend freeswitch /etc/snmp/freeswitch

Activate the Freeswitch application for your server on your LibreNMS server.
it should now start to receive data from your Freeswitch server via snmp.

* Graph "Calls" and "Channels" of Freeswitch agent

The Freeswitch agent sends Calls and Channels count and they weren't graphed
up to now.  This is especially useful in settings where the Freeswitch
server does not act as a Gateway and thus the agent does not sent
Incoming and Outgoing Call numbers.

* Cleanup commented code and add myself to authors
This commit is contained in:
Joel Kociolek
2017-10-26 13:27:11 +03:00
committed by Neil Lathwood
parent 51ba934e11
commit bc3d1ed47e
6 changed files with 38 additions and 2 deletions

View File

@@ -208,6 +208,7 @@ LibreNMS contributors:
- Mike Williams <mike@mgww.net> (network-guy)
- Rob J. Epping <librenms@renf.us> (robje)
- Frank Petrilli <frank@petril.li> (frankpetrilli)
- Joel Kociolek <joel@kociolek.org> (lejoko)
Observium was written by:
- Adam Armstrong

View File

@@ -0,0 +1,14 @@
<?php
require 'includes/graphs/common.inc.php';
$scale_min = 0;
$ds = 'calls';
$colour_area = '9DDA52';
$colour_line = '2EAC6D';
$colour_area_max = 'FFEE99';
$graph_max = 10000;
$unit_text = 'Calls';
$rrd_filename = rrd_name($device['hostname'], array('app', 'freeswitch', 'stats', $app['app_id']));
require 'includes/graphs/generic_simplex.inc.php';

View File

@@ -0,0 +1,14 @@
<?php
require 'includes/graphs/common.inc.php';
$scale_min = 0;
$ds = 'channels';
$colour_area = '9DDA52';
$colour_line = '2EAC6D';
$colour_area_max = 'FFEE99';
$graph_max = 10000;
$unit_text = 'Channels';
$rrd_filename = rrd_name($device['hostname'], array('app', 'freeswitch', 'stats', $app['app_id']));
require 'includes/graphs/generic_simplex.inc.php';

View File

@@ -129,6 +129,8 @@ $graphs['fail2ban'] = array(
$graphs['freeswitch'] = array(
'peak',
'calls',
'channels',
'callsIn',
'callsOut',
);

View File

@@ -4,6 +4,8 @@ global $config;
$graphs = array(
'freeswitch_peak' => 'Freeswitch - Peak Calls',
'freeswitch_calls' => 'Freeswitch - Calls',
'freeswitch_channels' => 'Freeswitch - Channels',
'freeswitch_callsIn' => 'Freeswitch - Inbound Calls',
'freeswitch_callsOut' => 'Freeswitch - Outbound Calls'
);

View File

@@ -8,8 +8,11 @@ if (!empty($agent_data[$name])) {
$rawdata = $agent_data[$name];
update_application($app, $rawdata);
} else {
echo "Freeswitch Missing";
return;
$options = '-O qv';
$oid = '.1.3.6.1.4.1.8072.1.3.2.4.1.2.10.102.114.101.101.115.119.105.116.99.104';
$rawdata = snmp_walk($device, $oid, $options);
$rawdata = str_replace("<<<freeswitch>>>\n", '', $rawdata);
update_application($app, $rawdata);
}
# Format Data
$lines = explode("\n", $rawdata);