1

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?

Raul Chiarella
  • 518
  • 1
  • 8
  • 25
  • Please check manager interface debug with your script. There are no easy way say what is problem. Considering quality of that script i even can't say if it should work or not. – arheops Mar 04 '20 at 18:03
  • Hello! Thanks for answering. I looked more into the code and debugged it like you said... Runned everything manually without using the script... Looks like there was a outdate variable that expected a message that changed on other versions of Asterisk. I changed it and now it works like a charm: [Uploaded on imgur so you can see](https://i.imgur.com/azS5EvC.png) Thanks man, if you want to answer i'll mark as the answer for it have a nice day – Raul Chiarella Mar 06 '20 at 20:05

2 Answers2

0

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.

Raul Chiarella
  • 518
  • 1
  • 8
  • 25
-2

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.

Steve Shipway
  • 3,754
  • 3
  • 22
  • 39