Search code examples
asterisksnmpmrtg

Monitor asterisk calls with MRTG


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?


Solution

  • 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.