Index: scripts/agent-local/asterisk =================================================================== --- scripts/agent-local/asterisk (revision 0) +++ scripts/agent-local/asterisk (revision 0) @@ -0,0 +1,28 @@ +#!/bin/bash + +####### Asterisk Telephony Server +if [ -a /usr/sbin/asterisk ] +then + echo '<<>>' + CORECHANNELS=`asterisk -rx 'core show channels' | tail -2` + ACTIVECHAN=$(echo $CORECHANNELS | grep channels | cut -d' ' -f1) + ACTIVECALL=$(echo $CORECHANNELS | grep calls | cut -d' ' -f1) + IAXCHANNELS=$(asterisk -rx 'iax2 show channels' | tail -1 | cut -d' ' -f1) + SIPCHANNELS=$(asterisk -rx 'sip show channels' | tail -1 | cut -d' ' -f1) + SIPPEERS=`asterisk -rx 'sip show peers' | tail -1` + SIPTOTALPEERS=$(echo $SIPPEERS | cut -d' ' -f1) + SIPONLINE=$(echo $SIPPEERS | grep -o '[0-9]* online' | head -1 | cut -d' ' -f1) + IAXPEERS=`asterisk -rx 'iax2 show peers' | tail -1` + IAXTOTALPEERS=$(echo $IAXPEERS | cut -d' ' -f1) + IAXONLINE=$(echo $IAXPEERS | grep -o '[0-9]* online' | head -1 | cut -d' ' -f1) + + echo $ACTIVECHAN + echo $ACTIVECALL + echo $IAXCHANNELS + echo $SIPCHANNELS + echo $SIPTOTALPEERS + echo $SIPONLINE + echo $IAXTOTALPEERS + echo $IAXONLINE + +fi Property changes on: scripts/agent-local/asterisk ___________________________________________________________________ Added: svn:executable + * Index: html/pages/device/apps/asterisk.inc.php =================================================================== --- html/pages/device/apps/asterisk.inc.php (revision 0) +++ html/pages/device/apps/asterisk.inc.php (revision 0) @@ -0,0 +1,33 @@ + 'Active Peers', + 'asterisk_activecall' => 'Active Calls'); + +foreach ($graphs as $key => $text) +{ + $graph_type = $key; + $graph_array['to'] = $config['time']['now']; + $graph_array['id'] = $app['app_id']; + $graph_array['type'] = "application_".$key; + + echo('

'.$text.'

'); + + echo(""); + + include("includes/print-graphrow.inc.php"); + + echo(""); +} + +?> Index: html/includes/graphs/application/asterisk_peers.inc.php =================================================================== --- html/includes/graphs/application/asterisk_peers.inc.php (revision 0) +++ html/includes/graphs/application/asterisk_peers.inc.php (revision 0) @@ -0,0 +1,46 @@ + array('descr' => 'SIP Peers', 'colour' => '750F7DFF'), + 'sippeersonline' => array('descr' => 'SIP Peers Active', 'colour' => '00FF00FF'), + 'iaxpeers' => array('descr' => 'IAX Peers', 'colour' => '4444FFFF'), + 'iaxpeersonline' => array('descr' => 'IAX Peers Active', 'colour' => '157419FF'), +); + +$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: $file"); } + +$colours = "mixed"; +$nototal = 0; +$unit_text = "Peers"; + +include("includes/graphs/generic_multi_line.inc.php"); + +#include("includes/graphs/generic_multi_simplex_seperated.inc.php"); + +?> Property changes on: html/includes/graphs/application/asterisk_peers.inc.php ___________________________________________________________________ Added: svn:executable + * Index: html/includes/graphs/application/asterisk_activecall.inc.php =================================================================== --- html/includes/graphs/application/asterisk_activecall.inc.php (revision 0) +++ html/includes/graphs/application/asterisk_activecall.inc.php (revision 0) @@ -0,0 +1,46 @@ + array('descr' => 'Active Channels', 'colour' => '750F7DFF'), + 'activecall' => array('descr' => 'Active Calls', 'colour' => '00FF00FF'), + 'iaxchannels' => array('descr' => 'IAX Channels', 'colour' => '4444FFFF'), + 'sipchannels' => array('descr' => 'SIP Channels', 'colour' => '157419FF'), +); + +$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: $file"); } + +$colours = "mixed"; +$nototal = 0; +$unit_text = "Channels"; + +include("includes/graphs/generic_multi_line.inc.php"); + +#include("includes/graphs/generic_multi_simplex_seperated.inc.php"); + +?> Property changes on: html/includes/graphs/application/asterisk_activecall.inc.php ___________________________________________________________________ Added: svn:executable + * Index: includes/polling/applications/asterisk.inc.php =================================================================== --- includes/polling/applications/asterisk.inc.php (revision 0) +++ includes/polling/applications/asterisk.inc.php (revision 0) @@ -0,0 +1,34 @@ + Index: includes/polling/unix-agent.inc.php =================================================================== --- includes/polling/unix-agent.inc.php (revision 4037) +++ includes/polling/unix-agent.inc.php (working copy) @@ -68,6 +68,7 @@ if ($section == "postfix_qshape") { $sa = "app"; $sb = "postfix_qshape"; } if ($section == "postfix_mailgraph") { $sa = "app"; $sb = "postfix_mailgraph"; } # if ($section == "drbd") { $sa = "app"; $sb = "drbd"; } + if ($section == "asterisk") { $sa = "app"; $sb = "asterisk"; } # Workaround for older script where we didn't split into 3 possible parts yet if ($section == "app-powerdns-recursor") { $sa = "app"; $sb = "powerdns-recursor"; $sc = ""; } @@ -176,6 +177,17 @@ } } + // Asterisk + if (!empty($agent_data['app']['asterisk'])) + { + $app_found['asterisk'] = TRUE; + if (dbFetchCell("SELECT COUNT(*) FROM `applications` WHERE `device_id` = ? AND `app_type` = ?", array($device['device_id'], 'asterisk')) == "0") + { + echo("Found new application 'Asterisk'\n"); + dbInsert(array('device_id' => $device['device_id'], 'app_type' => 'asterisk'), 'applications'); + } + } + // DRBD if (!empty($agent_data['drbd'])) { Index: includes/definitions.inc.php =================================================================== --- includes/definitions.inc.php (revision 4037) +++ includes/definitions.inc.php (working copy) @@ -1427,7 +1427,8 @@ 'power' => 'W', 'voltage' => 'V', 'temperature' => 'C', - 'dbm' => 'dBm'); + 'dbm' => 'dBm', + 'status' => ''); // FIXME - different icons for power/volt/current