Munin Plugins for Asterisk

gvagenas
Posts: 8
Member Since:
2006-06-21

Hi everybody.

I just found out some really intresting plugins of Munin for the Asterisk. They contain IAX, SIP, Voicemail, Active channels and conferences.

Soon i will come back with details and impressions.

Sorry i forgot the link to the plugins : http://rodolphe.quiedeville.org/munin-asterisk.fr.html

--

George.



cosmicwombat
Posts: 1173
Member Since:
2006-05-31
Re: Munin Plugins for Asterisk

Where do you place them?

Robert.

--

Robert Keller - Chief Technologist at large
The VoIP Experience
Open Telephony Training Seminar



gvagenas
Posts: 8
Member Since:
2006-06-21
Re: Munin Plugins for Asterisk

Robert,

Here is a quick tutorial i prepared. Probably can be better but here is what i did and i had the plugins up and ready within few minutes:

In order to install these plugins to the Munin system you have to do the followings:

1. Copy the files to the /usr/share/munin/plugins directory
2. Fix the file permisions with : chmod 755 ./asterisk
3. For each and every asterisk plugin do the following : ln -s /usr/share/munin/plugin/asterisk_name /etc/munin/plugins/asterisk_name
4. Install the Perl Net::Telnet module (needs make, make install. Look the README file)
5. Using the FreePBX, create a new Asterisk Manager giving him all Read & Write access, for example
* manager name: munin123
* manager secret: 123456789
6. To each and every plugin file you must change the username and secret settings as bellow:
* Old settings:
my $username = $ENV{'username'};
my $secret = $ENV{'secret'};
* New settings:
my $username = 'munin123';
my $secret = '123456789';
7. Restart munin-node using */etc/init.d/munin-node restart
8. Wait for the munin to refresh

If somebody thinks that there is a better way to do it please share.

Thanks
George

--

George.



TheShniz
Posts: 213
Member Since:
2006-06-01
Re: Munin Plugins for Asterisk

Got some instructions? Where's the ReadMe?

Quote:
Install the Perl Net::Telnet module (needs make, make install. Look the README file)

Got everything else done, but obviously not working w/out the Perl module installed.

::UPDATED::

I went ahead and did this...

perl -MCPAN -e "install Net::Telnet"

...while the command seems to have worked, nothing new is showing in Munin itself (even after restart)

Problem: Operator Error? ... Any idea?
- J



gvagenas
Posts: 8
Member Since:
2006-06-21
Re: Munin Plugins for Asterisk

The Net::Telnet module can be downloaded from :
http://search.cpan.org/~jrogers/Net-Telnet-3.03/lib/Net/Telnet.pm

About your problem:

Make sure that the /var/www/html/munin directory must be owned by munin:munin (chown -R munin:munin /var/www/html/munin)

Then make sure that you have make correct all the links (using the ln -s .... step) to the directory /etc/munin/plugins

Then check all the asterisk scripts if they have the correct username and secret for the Asterisk manager.

Last wait a little bit for the munin to run again. You should have it.

The scripts are really nice but there are bug in the code. For exampl e the asterisk_sippeers is looking to report the ms for each sip peer , but since Asterisk reports them like (33 ms) the script reads (33 and cannot recognize this value as integer.

I am working to debug them. Any volunteer to help here ???

--

George.



TheShniz
Posts: 213
Member Since:
2006-06-01
Re: Munin Plugins for Asterisk

Well, I redid everything a 2nd time... and I THOUGHT it worked as 'asterisk' was now listed with all the different things. I was just waiting for Munin to update. BUT, as soon as Munin updated itself, all traces of asterisk disappeared!

Okay, so now I'm a lil bit confused...

I double checked everything (again) for permissions and to make sure all files are where they should be (again). And everything is.

However, when I checked /etc/munin/plugins (where the links were to be made), I got a whole bunch of 'no such file' in both Putty and WinSCP. Now I'm no Linux guru, and I've never dealt w/ links before, but is this correct?

Here's a screenshot
http://www.edgeproductions.com/files/TheShniz/munin_no_such_file....

Anyways, for the lazy people, copy & paste (what I did):

ln -s /usr/share/munin/plugins/asterisk_channels /etc/munin/plugins/asterisk_channels
ln -s /usr/share/munin/plugins/asterisk_channelstypes /etc/munin/plugins/asterisk_channelstypes
ln -s /usr/share/munin/plugins/asterisk_codecs /etc/munin/plugins/asterisk_codecs
ln -s /usr/share/munin/plugins/asterisk_console /etc/munin/plugins/asterisk_console
ln -s /usr/share/munin/plugins/asterisk_iaxchannels /etc/munin/plugins/asterisk_iaxchannels
ln -s /usr/share/munin/plugins/asterisk_iaxlag /etc/munin/plugins/asterisk_iaxlag
ln -s /usr/share/munin/plugins/asterisk_iaxpeers /etc/munin/plugins/asterisk_iaxpeers
ln -s /usr/share/munin/plugins/asterisk_meetme /etc/munin/plugins/asterisk_meetme
ln -s /usr/share/munin/plugins/asterisk_meetme_ /etc/munin/plugins/asterisk_meetme_
ln -s /usr/share/munin/plugins/asterisk_meetmeusers /etc/munin/plugins/asterisk_meetmeusers
ln -s /usr/share/munin/plugins/asterisk_sipchannels /etc/munin/plugins/asterisk_sipchannels
ln -s /usr/share/munin/plugins/asterisk_sippeers /etc/munin/plugins/asterisk_sippeers
ln -s /usr/share/munin/plugins/asterisk_voicemail /etc/munin/plugins/asterisk_voicemail

1x step forward, 2x steps back?
- TheShniz



gvagenas
Posts: 8
Member Since:
2006-06-21
Re: Munin Plugins for Asterisk

I modified the asterisk_sippeers script that had a bug.

The change that must be done is, instead of :

$result = $result + 1 if ((split ' ',$line)[4] > 0);

it should be :

$result = $result + 1 if ((split ' ',$line)[4] =~ m/\([0-9]+/ ) or ((split ' ',$line)[5] =~ m/\([0-9]+/ );

It works for me and i think its fine....

I am looking around for other bugs also.

--

George.



TheShniz
Posts: 213
Member Since:
2006-06-01
Re: Munin Plugins for Asterisk

Alrighty, found out why the links weren't being created properly...

If you'll notice, the 's' was left off 'plugin' (should be plural) which I unwittingly copied from (easy mistake). Anyways, I've updated my previous post for lazy people... just copy & paste.

One lil 's' screwed it up:

Quote:
ln -s /usr/share/munin/plugin/asterisk_name /etc/munin/plugins/asterisk_name

SOoooooooooooooooo, I again THINK it's working... I'm waiting for some numbers to make sure. If it does, I'll be sure to paste my install notes 4 dummies.

Still working on it, & thanx for all this gvagenas!
- J



gvagenas
Posts: 8
Member Since:
2006-06-21
Re: Munin Plugins for Asterisk

You are welcome .

Just make sure that you make the correction on the asterisk_sippeers script because of the bug it has.

:-)

--

George.



TheShniz
Posts: 213
Member Since:
2006-06-01
Re: Munin Plugins for Asterisk

Yeah, I got that edit and all the 'asterisk' plugins are now showing, but unfortunatley none of them are reporting any values.

I've got another clean trixbox install coming back to me from a demo tomorrow, I'll prob try again on that machine.

Thinking it can only be either FreePBX username or the telnet module,
- J



TheShniz
Posts: 213
Member Since:
2006-06-01
Re: Munin Plugins for Asterisk

Well... here's my Munin Asterisk Plugins for Dummies Guide...

Unfortunately, I'm still not getting any values reported (even w/ the clean install 2nd system). Hopefully someone can look at what I've done and help me out!

Here it is, start to finish...
SEE LAST POST FOR COMPLETE TUTORIAL

cd /usr/src
wget <a href="http://rodolphe.quiedeville.org/hack/munin/asterisk-1.2/asterisk-munin.tar.gz" title="http://rodolphe.quiedeville.org/hack/munin/asterisk-1.2/asterisk-munin.tar.gz">http://rodolphe.quiedeville.org/hack/munin/asterisk-1.2/asterisk-...</a>
tar xvzf asterisk-munin.tar.gz
cd asterisk-munin
cp asterisk* /usr/share/munin/plugins
cd /usr/share/munin/plugins
chmod 755 ./asterisk*
ln -s /usr/share/munin/plugins/asterisk_channels /etc/munin/plugins/asterisk_channels
ln -s /usr/share/munin/plugins/asterisk_channelstypes /etc/munin/plugins/asterisk_channelstypes
ln -s /usr/share/munin/plugins/asterisk_codecs /etc/munin/plugins/asterisk_codecs
ln -s /usr/share/munin/plugins/asterisk_console /etc/munin/plugins/asterisk_console
ln -s /usr/share/munin/plugins/asterisk_iaxchannels /etc/munin/plugins/asterisk_iaxchannels
ln -s /usr/share/munin/plugins/asterisk_iaxlag /etc/munin/plugins/asterisk_iaxlag
ln -s /usr/share/munin/plugins/asterisk_iaxpeers /etc/munin/plugins/asterisk_iaxpeers
ln -s /usr/share/munin/plugins/asterisk_meetme /etc/munin/plugins/asterisk_meetme
ln -s /usr/share/munin/plugins/asterisk_meetme_ /etc/munin/plugins/asterisk_meetme_
ln -s /usr/share/munin/plugins/asterisk_meetmeusers /etc/munin/plugins/asterisk_meetmeusers
ln -s /usr/share/munin/plugins/asterisk_sipchannels /etc/munin/plugins/asterisk_sipchannels
ln -s /usr/share/munin/plugins/asterisk_sippeers /etc/munin/plugins/asterisk_sippeers
ln -s /usr/share/munin/plugins/asterisk_voicemail /etc/munin/plugins/asterisk_voicemail
cd /usr/src
wget <a href="http://search.cpan.org/CPAN/authors/id/J/JR/JROGERS/Net-Telnet-3.03.tar.gz" title="http://search.cpan.org/CPAN/authors/id/J/JR/JROGERS/Net-Telnet-3.03.tar.gz">http://search.cpan.org/CPAN/authors/id/J/JR/JROGERS/Net-Telnet-3....</a>
tar xvzf Net-Telnet-3.03.tar.gz
cd Net-Telnet-3.03
perl Makefile.PL
make
make test
make install
nano /etc/httpd/conf/httpd.conf
	Delete hardcoded admin access on line ~563:
		#Password protect /var/www/html/admin 
		<Directory /var/www/html/admin> 
		AuthType? Basic 
		AuthName? "Restricted Area"
		AuthUserFile? /usr/local/apache/passwd/wwwpasswd 
		Require user maint 
		</Directory>
/etc/init.d/httpd restart
nano /etc/amportal.conf
	Change line  ~51 from:
		AUTHTYPE=none
	to:
		AUTHTYPE=database
FreePBX > Setup > Administrators > {delete ALL administrators}
	( Login using username: admin, password: <blank> )
Create Administrator with ‘Admin Access’ to ‘All Sections’
Create username with ‘Admin Access’ to ‘All Sections’
Find and replace in each of the asterisk_<plugin> files:
	Change from:
		my $username = $ENV{'username'};
		my $secret   = $ENV{'secret'};
	to:
		my $username = 'username';
		my $secret   = 'password';
nano /usr/share/munin/plugins/asterisk_sippeers
	Change ~line 95, from:
		$result = $result + 1 if ((split ' ',$line)[4] > 0);
	to:
		$result = $result + 1 if ((split ' ',$line)[4] =~ m/\([0-9]+/ ) or ((split ' ',$line)[5] =~ m/\([0-9]+/ );
/etc/init.d/munin-node restart

Sorry, seems to have lost some formatting...

Any idea why it's not reporting any values?
- J



gvagenas
Posts: 8
Member Since:
2006-06-21
Re: Munin Plugins for Asterisk

Can you provide the log file of the Munin,

/var/log/munin/munin-node.log

--

George.



TheShniz
Posts: 213
Member Since:
2006-06-01
Re: Munin Plugins for Asterisk

Unsuprisingly, it says:

2006/06/29-04:05:08 Plugin "asterisk_whatever" exited with status 26624. ----
mailstats: /var/log/mail/statistics: Permission denied

or

2006/06/29-04:05:14 Plugin "asterisk_whatever" exited with status 26624. ----
read error: Connection reset by peer at /etc/munin/plugins/asterisk_whatever line 135

Did I misunderstand something on FreePBX maybe, or is it something else?

I completely removed all hardcoded usernames/passwords from /etc/httpd/conf/httpd.conf, set FreePBX to database, and created username: munin and password: no1here in Administrators module with access to 'All Sections'. I tested that the username worx by logging in as munin (which it does). Finally, I updated all plugin files with the new username & password.

I dunno...
- J



andrew
Posts: 1472
Member Since:
2006-05-30
Re: Munin Plugins for Asterisk

added perl-Net-Telnet to the yum server.

yum -y install perl-Net-Telnet



TheShniz
Posts: 213
Member Since:
2006-06-01
Re: Munin Plugins for Asterisk

No change.

As for the telnet module:
Originally I did this...

perl -MCPAN -e "install Net::Telnet"

Then I tried this...

cd /usr/src
wget http://search.cpan.org/CPAN/authors/id/J/JR/JROGERS/Net-Telnet-3....
tar xvzf Net-Telnet-3.03.tar.gz
cd Net-Telnet-3.03
perl Makefile.PL
make
make test
make install

Now I've tried this...

yum -y install perl-Net-Telnet

All 3x 'tries' completed succesfully, but alas I'm still here w/ no values reported. Have I bastardized perl, should I try on another clean install?

Any ideas?
- J



gvagenas
Posts: 8
Member Since:
2006-06-21
Re: Munin Plugins for Asterisk

Are you sure that the Asterisk manager setting are correct ?

Check manually the manager_additional.conf file. In this file you should have the setting for the username/password that you are using for the scripts to connect and retreive data from Asterisk...

Check this also.

--

George.



TheShniz
Posts: 213
Member Since:
2006-06-01
Re: Munin Plugins for Asterisk

d0h!

The manager_additional.conf is how I'm used to doing it w/ A@H for AstTapi and such, but when you said...

Quote:
5. Using the FreePBX, create a new Asterisk Manager giving him all Read & Write access, for example
* manager name: munin123
* manager secret: 123456789

...the only way you can do it in FreePBX with a password is by changing the AUTHTYPE to database and creating the user with all access, which is why I did this...

nano /etc/httpd/conf/httpd.conf
	Delete hardcoded admin access on line ~563:
		#Password protect /var/www/html/admin 
		<Directory /var/www/html/admin> 
		AuthType? Basic 
		AuthName? "Restricted Area"
		AuthUserFile? /usr/local/apache/passwd/wwwpasswd 
		Require user maint 
		</Directory>
/etc/init.d/httpd restart
nano /etc/amportal.conf
	Change line  ~51 from:
		AUTHTYPE=none
	to:
		AUTHTYPE=database
FreePBX > Setup > Administrators > {delete ALL administrators}
	( Login using username: admin, password: <blank> )
Create Administrator with ‘Admin Access’ to ‘All Sections’
Create username with ‘Admin Access’ to ‘All Sections’

...the problem with all of this, as you probably already know, is that by creating a user through FreePBX, it simply creates a record in the 'ampusers' table in the 'asterisk' database. Which is what I assumed it was supposed 2 B. Infact, manager_additional.conf didn't even exist and I had to create it. Once I did, it worx just as it should!

ugh... 'the road 2 truth has many turns'
- J



TheShniz
Posts: 213
Member Since:
2006-06-01
Re: Munin Plugins for Asterisk

Andrew, can you put this in the Documentation/Tutorials for everyone?
(can't post directly, it'd be nice if we could requiring admin approval - much like a CMS)

[size=x-large]Munin Asterisk Plugins Tutorial[/size]

MANUALLY CONFIGURED USER ACCESS: SEE LAST POST FOR AGI SETUP

cd /etc/asterisk/
nano manager_additional.conf
	[username]
	secret=password
	deny=0.0.0.0/0.0.0.0
	permit=127.0.0.1/255.255.255.0
	read=system,call,log,verbose,command,agent,user
	write=system,call,log,verbose,command,agent,user

cd /usr/src
wget <a href="http://rodolphe.quiedeville.org/hack/munin/asterisk-1.2/asterisk-munin.tar.gz" title="http://rodolphe.quiedeville.org/hack/munin/asterisk-1.2/asterisk-munin.tar.gz">http://rodolphe.quiedeville.org/hack/munin/asterisk-1.2/asterisk-...</a>
tar xvzf asterisk-munin.tar.gz
cd asterisk-munin
cp asterisk* /usr/share/munin/plugins
cd /usr/share/munin/plugins
chmod 755 ./asterisk*

Find and replace in each of the asterisk_<plugin> files:
	Change from:
		my $username = $ENV{'username'};
		my $secret   = $ENV{'secret'};
	to:
		my $username = 'username';
		my $secret   = 'password';
nano /usr/share/munin/plugins/asterisk_sippeers
	Change ~line 95, from:
		$result = $result + 1 if ((split ' ',$line)[4] > 0);
	to:
		$result = $result + 1 if ((split ' ',$line)[4] =~ m/\([0-9]+/ ) or ((split ' ',$line)[5] =~ m/\([0-9]+/ );

ln -s /usr/share/munin/plugins/asterisk_channels /etc/munin/plugins/asterisk_channels
ln -s /usr/share/munin/plugins/asterisk_channelstypes /etc/munin/plugins/asterisk_channelstypes
ln -s /usr/share/munin/plugins/asterisk_codecs /etc/munin/plugins/asterisk_codecs
ln -s /usr/share/munin/plugins/asterisk_console /etc/munin/plugins/asterisk_console
ln -s /usr/share/munin/plugins/asterisk_iaxchannels /etc/munin/plugins/asterisk_iaxchannels
ln -s /usr/share/munin/plugins/asterisk_iaxlag /etc/munin/plugins/asterisk_iaxlag
ln -s /usr/share/munin/plugins/asterisk_iaxpeers /etc/munin/plugins/asterisk_iaxpeers
ln -s /usr/share/munin/plugins/asterisk_meetme /etc/munin/plugins/asterisk_meetme
ln -s /usr/share/munin/plugins/asterisk_meetme_ /etc/munin/plugins/asterisk_meetme_
ln -s /usr/share/munin/plugins/asterisk_meetmeusers /etc/munin/plugins/asterisk_meetmeusers
ln -s /usr/share/munin/plugins/asterisk_sipchannels /etc/munin/plugins/asterisk_sipchannels
ln -s /usr/share/munin/plugins/asterisk_sippeers /etc/munin/plugins/asterisk_sippeers
ln -s /usr/share/munin/plugins/asterisk_voicemail /etc/munin/plugins/asterisk_voicemail

yum -y install perl-Net-Telnet

/etc/init.d/munin-node restart


mdruedal
Posts: 16
Member Since:
2006-06-01
Re: Munin Plugins for Asterisk

It could be awesome if installing this could be automatized, like an yum -y install munin-asteriskplugins.. or something like it..???

/Michael
:-D



amigliora
Posts: 11
Member Since:
2006-06-01
Re: Munin Plugins for Asterisk

I went through the last Tutorial, and I have some manager registration OK, and some other "unable to authenticate" messages.
I don't know why if I'm using the same username and password for all the plugins.

I have no data also in the munin asterisk plugings.

Please any direction to fix this issue?

Thanks



TheShniz
Posts: 213
Member Since:
2006-06-01
Re: Munin Plugins for Asterisk

Well...

If you've got no data coming up, then it can only be:
1.) Perl Telnet Module not installed properly
(3x diff ways, but the most recent post the easiest)
2.) Username/Password in manager_additional.conf don't match the plugin files. (Make sure the apostrophies are used)

If the Asterisk graphs aren't showing, or do but then disappear, then it can only be:
1.) plugin files not properly 'linked' to /etc/munin/plugins

The order of install doesn't really matter so much, and nothing will get screwed up... so I'd just tell you to rego through it all top to bottom to see if something is missing. I should note that I've tested this several times already on Trixbox 1.0 (all clean installs), but not 1.1. Now that 1.1.1 is out, I'll be making sure it worx hopefully by the end of this week.

Still not tried to figure out how to send email notifications when critical levels reached (like you can w/ NetMRG, very much need to).
- J



TheShniz
Posts: 213
Member Since:
2006-06-01
Re: Munin Plugins for Asterisk

Andrew repackaged these plugins with direct access through the AGI, w00t! I'd imagine these will be installed by default w/ the next release of Trixbox :)

All that's required now is:

[size=x-large]Munin Asterisk Plugins Tutorial[/size]

cd /usr/src
wget <a href="http://update.trixbox.org/asterisk-munin.tar.gz" title="http://update.trixbox.org/asterisk-munin.tar.gz">http://update.trixbox.org/asterisk-munin.tar.gz</a>
tar xvfz asterisk-munin.tar.gz
cd asterisk-munin
./install.sh

Tested on 1.1.1,
- J



jpe
Posts: 21
Member Since:
2006-06-01
Re: Munin Plugins for Asterisk

Thanks, You are the Shizzle Shnizzle.

--

---
If you think it's not a game, you've already lost.



dibble5504
Posts: 13
Member Since:
2008-01-02
Updated SIP Peers Monitoring script

I have added functionality to the asterisk_sippeers script and uploaded it to Munin Exchange. It now graphs the number of online & offline SIP Peers for Monitored and unmonitored peers.
http://www.paulmccormack.com/2009/10/27/monitoring-asterisk-peers...

Paul



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.