Monitor calls using MRTG

Hi! I’m trying to monitor calls using a MRTG script i found on this site:
https://karlsbakk.net/asterisk/scripts/asterisk-mrtg

But when i execute mrtg env the following error appears:

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

I already monitor CPU and network stats using mrtg, the only problem i’m having right now is with asterisk…

Does anyone ever came across this problem?

Run the command manually and share result here.

When i execute /etc/mrtg/bin//mrtgasterisk.pl -h localhost -1 SIP -2 IAX2 manually the commands returns nothing. There’s no output.

Ok, so i tried doing step by step on /etc/mrtg/bin//mrtgasterisk.pl doing prints along the code, and here’s what i found:

Commenting line 127 and 128 fixed the problem for me… Idk why. Maybe because it expects a different message from Asterisk Manager?
Commented lines ↓

# &unknown(“Unknown answer $response (wanted Message: something)”) unless (message =~ m/^Message:\s+(.*)/i);
# &unknown(“didn’t understand message $message”) unless ($1 =~ m/Channel status will follow/i);

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.