Monitor asterisk calls with MRTG

233 views Asked by At

I'm using mrtg to monitor cpu and network stats on my server. It all works fine... The one thing that i am not being able to make it work is asterisk - I'm using a script i found on: https://karlsbakk.net/asterisk/scripts/asterisk-mrtg

I configured accordingly to my servers information, and then proceed to generate the stats of concurrent calls on asterisk using mrtg ... But the following error occurs:

2020-03-04 10:34:36: WARNING: Could not get any data from external command '/etc/mrtg/bin/mrtgasterisk.pl -h localhost -1 SIP -2 IAX2'
Maybe the external command did not even start.

2020-03-04 10:34:36: WARNING: Problem with External get '/etc/mrtg/bin/mrtgasterisk.pl -h localhost -1 SIP -2 IAX2':
   Expected a Number for 'in' but nothing'

2020-03-04 10:34:36: WARNING: Problem with External get '/etc/mrtg/bin/mrtgasterisk.pl -h localhost -1 SIP -2 IAX2':
   Expected a Number for 'out' but nothing'

2020-03-04 10:34:36: ERROR: Target[asterisk][_IN_] ' $target->[2]{$mode} ' did not eval into defined data
2020-03-04 10:34:36: ERROR: Target[asterisk][_OUT_] ' $target->[2]{$mode} ' did not eval into defined data

Did anyone ever went through this and was able to resolve it?

2

There are 2 answers

0
Raul Chiarella On BEST ANSWER

Try the actions in the script manually via Telnet with Asterisk Manager, then if it works execute the script and debug it.

Turns out the the perl script was outdated, doing a debug and testing the actions made me help discover what was wrong and then fix it.

1
Steve Shipway On

This is the problem:

2020-03-04 10:34:36: WARNING: Could not get any data from external command '/etc/mrtg/bin/mrtgasterisk.pl -h localhost -1 SIP -2 IAX2'

Your script mrtgasterisk.pl is not completing correctly. Try running it interactively from the commandline and see if it outputs any helpful error messages. Possibly you are giving it the wrong parameters, or there are required modules not installed? All that MRTG knows is that the script is not running properly.