Ever used soft phones that limit you to many many functions until you “unlock” them by purchasing a full version? Well, we all did and we too frown at those. Softphones such as Zoiper and X-Lite are amongst the famous ones but the lack functionalities on the free edition such as call conferencing, forwarding, sip TCP, sip TLS etc.
Well, after looking through *almost* all the soft phones found in this article http://www.venturevoip.com/news.php?rssid=2188, i found one that i would rate almost 9/10 for being FREE + its functionality.
Here’s Phonerlite, winner of the list of softphones (without IM, Video),
Yes, yes, it doesn’t have a fancy skin or 3D images here and there but this piece of software does all what those other free ones want you to pay money for. It lets you do conferencing, forwarding, sipTCP, sipTLS, IPv6, detailed log, phonebook and yes, STATISTICS to see how good/bad the current connection is in real time. Wow, now that’s just awesome.
Those in hurry to get it, here’s link for downloads http://www.phonerlite.de/download_en.htm
There’s a BETA which you can play around with and test. You can also run it straight off a portable device without any installs, with this file http://www.phoner.de/PhonerLite.paf.exe
Installation is pretty brain dead, straight forward. They even have a Wizard to setup your account. One thing it lacks is an automatic start but that isn’t much a hassle to do in Windows, just make a shortcut of the executable and drag it into the “Startup” menu in your START menus.
If you do try it and wonder how to conference its easy. When a call comes in, just hit the conference button, dial another extension or as many extensions as you wish and everyone’s conferencing.
To forward, if a call comes, dial another extension, drag and drop the current call to the intended recipient. Careful not to drag drop many calls, this software is not intended to replace a receptionist system such as FOP or a receptionist board.
Asterisk and Nagios enthusiasts, professionals and consultants based in Kuala Lumpur, Malaysia. Astiostech Sdn Bhd. Asterisk Malaysia. Nagios Malaysia.
Monday, November 16, 2009
Sunday, November 8, 2009
Nagios Receive SNMP Traps (with SNMPTT)
SNMPTT (SNMP Trap Translator) interacts with snmptrapd to receive traps and process them into Nagios by matching the IP of the trapping host to a host in Nagios and changing a passive check in Nagios to alert someone.
In the below guide:
[APC-UPS] –>send traps to–> [SNMPTRAPD –> SNMPTT –> NAGIOS]
Here’s a simple guide, adapted and made much more cut and dry (and a little more simpler) from the guide found here.
We use Nagios 3.20, SNMPTT 1.3beta2, Debian Lenny (5)
As usual, your feedback will mean a lot to us. Thanks!
Sanjay.
Download some pre-reqs
=======================
Main component is SNMP (and some snmp tools) so do this at the CLI
apt-get install snmp snmpd libsnmp-dev
SNMPTT setup starts
===================
1) apt-get install unzip
2) cd /usr/src
3) wget http://search.cpan.org/CPAN/authors/id/C/CH/CHORNY/Text-ParseWords-3.27.zip
4) unzip Text-ParseWords-3.27.zip
5) cd Text-ParseWords-3.27
6) perl Makefile.PL
7) make test
8) make install
9) perl -MCPAN -e shell
At the Perl CLI
install YAML
install Getopt::Long
install Config::IniFiles
install Time::HiRes
install Sys::Hostname
install Text::Balanced
install Sys::Syslog
install DBI
install DBD::mysql
install Crypt::DES
install Digest::MD5
install Digest::SHA1
install Digest::HMAC
install Net::SNMP
Download, install and configure snmptt (the magician)
=====================================================
10) cd /usr/src
11) wget http://downloads.sourceforge.net/project/snmptt/snmptt/snmptt_1.3beta2/snmptt_1.3beta2.tgz?use_mirror=nchc
12) tar -zxvf snmptt_1.3beta2.tgz
13) cd snmptt_1.3beta2
14) cp snmptthandler /usr/sbin
15) cp snmptt /usr/sbin
16) cp snmpttconvert /usr/sbin
17) cp snmpttconvertmib /usr/sbin
Configure snmptrapd to not log but send them to snmptt
======================================================
18) nano /etc/snmp/snmptrapd.conf
19) Enter the following lines in there
traphandle default /usr/sbin/snmptt
disableAuthorization yes
donotlogtraps yes
Configure and enable the snmptrapd as a service
===============================================
20a) nano /etc/default/snmpd and /etc/init.d/snmpd
TRAPDRUN=yes
TRAPDOPTS='-On -Lsd -p /var/run/snmptrapd.pid'
20b) /etc/init.d/snmpd start
21) netstat -an | grep "162"
>> Should see output
22) cd usr/src/snmptt_1.3beta2
23) cp snmptt.ini /etc/snmp
24) nano /etc/snmp/snmptt.ini, look for and change the following settings
net_snmp_perl_enable = 1
dns_enable=1
25) cd /usr/src/nagios-plugins-1.4.13/
26) mkdir /usr/local/nagios/libexec/eventhandlers
27) cd /usr/local/nagios/libexec/eventhandlers
28) wget
29) chmod +x submit_check_result
TESTING - Create sample to test
===============================
30) cd /usr/share/snmp/mibs
31) wget
32) snmpttconvertmib --in=PowerNet-MIB.mib --out=/etc/snmp/snmptt.conf.apcpower --exec='/usr/local/nagios/libexec/eventhandlers/submit_check_result $r TRAP 1'
Here, the line above, you can change TRAP to any name as long as it matches the Service name in Nagios and 1 is the alert type, 0=OK, 1=WARNING, 2=CRITICAL etc..
33) nano /etc/snmp/snmptt.ini
add the /etc/snmp/snmptt.conf.cpqpower in [TrapFiles], comment out snmptt.conf
Example: Here we added /etc/snmp/snmptt.conf.apcpower based on the snmpttconvertmib outputfile like above
[TrapFiles]
snmptt_conf_files = <<END
/etc/snmp/snmptt.conf.apcpower
END
Enable log rotation
=======================
34) nano /etc/logrotate.conf
This is for log rotation. Add the following line at the end
/var/log/snmp/snmptt.log /var/log/snmp/snmpttunknown.log
{
missingok
}
35) mkdir /var/log/snmptt
36) touch /var/log/snmptt/snmptt.log
37) touch /var/log/snmptt/snmpttunknown.log
Configuring hosts file
=======================
Traps send IP not name, so we must configure /etc/hosts to add the name and ip of the device sending traps to us
38) nano /etc/hosts
Add the following as sample
192.168.1.11 sanjaypc
>> Important! This name will be the same as your hosts.cfg file in nagios that will receive the traps
Send a sample trap: - Load the same MIBs into a program like ireasoning and send a trap to your nagios IP
=======================================================
39) tail -f /var/log/snmptt/snmptt.log
Sun Nov 8 09:09:11 2009 .1.3.6.1.4.1.318.0.5 WARNING "Status Events" 192.168.157.1 - APC UPS: On battery: The UPS has switched to battery backup power.
40) tail -f /var/log/messages --- Output (after configuring Nagios settings below - or at least have a host/service defined that matches sanjaypc and TRAP)
Nov 8 09:09:20 server1 nagios: PASSIVE SERVICE CHECK: sanjaypc;TRAP;1;APC UPS: On battery: The UPS has switched to battery backup power.
Configuring Nagios- Sample definitions
=====================================
trap-service template
=====================================
define service{
name generic-service
register 0
check_period 24x7
max_check_attempts 3
normal_check_interval 15
retry_check_interval 5
active_checks_enabled 1
passive_checks_enabled 0
parallelize_check 1
obsess_over_service 0
check_freshness 0
event_handler_enabled 0
flap_detection_enabled 0
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
notification_interval 60
notification_period 24x7
notification_options w,u,c,r
notifications_enabled 1
}
define service{
name trap-service
use generic-service
register 0
service_description TRAP
is_volatile 1
check_command check-host-alive
max_check_attempts 1
normal_check_interval 1
retry_check_interval 1
passive_checks_enabled 1
check_period none
notification_interval 0
contact_groups admins
}
Create service to host - NOTE: Hostname must match to /etc/hosts definition we created earlier
==================================================
define service{
host_name sanjaypc
use trap-service
contact_groups admins
}
41) Restart nagios
42) Send a trap again and check Nagios website, it should turn yellow [WARNING] and a notificaiton sent out
In the below guide:
[APC-UPS] –>send traps to–> [SNMPTRAPD –> SNMPTT –> NAGIOS]
Here’s a simple guide, adapted and made much more cut and dry (and a little more simpler) from the guide found here.
We use Nagios 3.20, SNMPTT 1.3beta2, Debian Lenny (5)
As usual, your feedback will mean a lot to us. Thanks!
Sanjay.
Download some pre-reqs
=======================
Main component is SNMP (and some snmp tools) so do this at the CLI
apt-get install snmp snmpd libsnmp-dev
SNMPTT setup starts
===================
1) apt-get install unzip
2) cd /usr/src
3) wget http://search.cpan.org/CPAN/authors/id/C/CH/CHORNY/Text-ParseWords-3.27.zip
4) unzip Text-ParseWords-3.27.zip
5) cd Text-ParseWords-3.27
6) perl Makefile.PL
7) make test
8) make install
9) perl -MCPAN -e shell
At the Perl CLI
install YAML
install Getopt::Long
install Config::IniFiles
install Time::HiRes
install Sys::Hostname
install Text::Balanced
install Sys::Syslog
install DBI
install DBD::mysql
install Crypt::DES
install Digest::MD5
install Digest::SHA1
install Digest::HMAC
install Net::SNMP
Download, install and configure snmptt (the magician)
=====================================================
10) cd /usr/src
11) wget http://downloads.sourceforge.net/project/snmptt/snmptt/snmptt_1.3beta2/snmptt_1.3beta2.tgz?use_mirror=nchc
12) tar -zxvf snmptt_1.3beta2.tgz
13) cd snmptt_1.3beta2
14) cp snmptthandler /usr/sbin
15) cp snmptt /usr/sbin
16) cp snmpttconvert /usr/sbin
17) cp snmpttconvertmib /usr/sbin
Configure snmptrapd to not log but send them to snmptt
======================================================
18) nano /etc/snmp/snmptrapd.conf
19) Enter the following lines in there
traphandle default /usr/sbin/snmptt
disableAuthorization yes
donotlogtraps yes
Configure and enable the snmptrapd as a service
===============================================
20a) nano /etc/default/snmpd and /etc/init.d/snmpd
TRAPDRUN=yes
TRAPDOPTS='-On -Lsd -p /var/run/snmptrapd.pid'
20b) /etc/init.d/snmpd start
21) netstat -an | grep "162"
>> Should see output
22) cd usr/src/snmptt_1.3beta2
23) cp snmptt.ini /etc/snmp
24) nano /etc/snmp/snmptt.ini, look for and change the following settings
net_snmp_perl_enable = 1
dns_enable=1
25) cd /usr/src/nagios-plugins-1.4.13/
26) mkdir /usr/local/nagios/libexec/eventhandlers
27) cd /usr/local/nagios/libexec/eventhandlers
28) wget
29) chmod +x submit_check_result
TESTING - Create sample to test
===============================
30) cd /usr/share/snmp/mibs
31) wget
32) snmpttconvertmib --in=PowerNet-MIB.mib --out=/etc/snmp/snmptt.conf.apcpower --exec='/usr/local/nagios/libexec/eventhandlers/submit_check_result $r TRAP 1'
Here, the line above, you can change TRAP to any name as long as it matches the Service name in Nagios and 1 is the alert type, 0=OK, 1=WARNING, 2=CRITICAL etc..
33) nano /etc/snmp/snmptt.ini
add the /etc/snmp/snmptt.conf.cpqpower in [TrapFiles], comment out snmptt.conf
Example: Here we added /etc/snmp/snmptt.conf.apcpower based on the snmpttconvertmib outputfile like above
[TrapFiles]
snmptt_conf_files = <<END
/etc/snmp/snmptt.conf.apcpower
END
Enable log rotation
=======================
34) nano /etc/logrotate.conf
This is for log rotation. Add the following line at the end
/var/log/snmp/snmptt.log /var/log/snmp/snmpttunknown.log
{
missingok
}
35) mkdir /var/log/snmptt
36) touch /var/log/snmptt/snmptt.log
37) touch /var/log/snmptt/snmpttunknown.log
Configuring hosts file
=======================
Traps send IP not name, so we must configure /etc/hosts to add the name and ip of the device sending traps to us
38) nano /etc/hosts
Add the following as sample
192.168.1.11 sanjaypc
>> Important! This name will be the same as your hosts.cfg file in nagios that will receive the traps
Send a sample trap: - Load the same MIBs into a program like ireasoning and send a trap to your nagios IP
=======================================================
39) tail -f /var/log/snmptt/snmptt.log
Sun Nov 8 09:09:11 2009 .1.3.6.1.4.1.318.0.5 WARNING "Status Events" 192.168.157.1 - APC UPS: On battery: The UPS has switched to battery backup power.
40) tail -f /var/log/messages --- Output (after configuring Nagios settings below - or at least have a host/service defined that matches sanjaypc and TRAP)
Nov 8 09:09:20 server1 nagios: PASSIVE SERVICE CHECK: sanjaypc;TRAP;1;APC UPS: On battery: The UPS has switched to battery backup power.
Configuring Nagios- Sample definitions
=====================================
trap-service template
=====================================
define service{
name generic-service
register 0
check_period 24x7
max_check_attempts 3
normal_check_interval 15
retry_check_interval 5
active_checks_enabled 1
passive_checks_enabled 0
parallelize_check 1
obsess_over_service 0
check_freshness 0
event_handler_enabled 0
flap_detection_enabled 0
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
notification_interval 60
notification_period 24x7
notification_options w,u,c,r
notifications_enabled 1
}
define service{
name trap-service
use generic-service
register 0
service_description TRAP
is_volatile 1
check_command check-host-alive
max_check_attempts 1
normal_check_interval 1
retry_check_interval 1
passive_checks_enabled 1
check_period none
notification_interval 0
contact_groups admins
}
Create service to host - NOTE: Hostname must match to /etc/hosts definition we created earlier
==================================================
define service{
host_name sanjaypc
use trap-service
contact_groups admins
}
41) Restart nagios
42) Send a trap again and check Nagios website, it should turn yellow [WARNING] and a notificaiton sent out
Nagios Send SNMP Traps
We hope this small guide can help you quickly setup your SNMP traps out to a remote management host.
First thing do ensure that your Nagios box has the snmptrap binary and perhaps all other associated SNMP binaries installed. If you haven’t a good start would be to use the following lines:
This guide was made using Nagios 3.2.0, Debian 5
Debians..
Redhats..
In Nagios, we setup to have SNMP traps to send out to a HP OpenView box in our customer’s corporate network. These traps are sent as Event Handlers in Nagios. You may try doing them as normal notifications (i guess, haven’t tested).
So, each time there’s a state change (e.g. from OK to Warning), you will get, beside the standard notifications, an event that triggers a snmp trap to a remote management host.
To make things simple, we use existing config definitions such as the original commands.cfg and the linux-services.cfg. The following guide attempt to send a trap when there’s more than 2 or 3 users logging onto the nagios (localhost) box.
First, edit the commands.cfg file and add the following lines. I will explain what these lines mean.
Simply copy paste everything and it should actually be single lines something like below;
The command name can be anything you wish, just as long it’s mentioned correctly in the _x_services.cfg files.
/usr/bin/snmptrap –v 2c –c public 192.168.2.22…
This is quite straightforward, here, we attempt to send SNMPv2 with the community string of public to the remote server 192.168.2.22.
…'' NAGIOS-NOTIFY-MIB::nSvcEvent nSvcHostname s "$HOSTNAME$" nSvcDesc s "$SERVICEDESC$" nSvcStateID i $SERVICESTATEID$ nSvcOutput s "$SERVICEOUTPUT$"
This part above firstly, feeds the Nagios MIBs so that we can use easy readable words such as NSvcDesc instead of OID numbers. It would be a good idea to give the Nagios MIBs to the 3rd party remote monitoring host as well.
[EDIT: UPDATE: – The Nagios MIB has a wrong definition or its actually meant for V2 of Nagios. Use this MIB which should work for V3]
The next few fields are completely up to you and what you wish Nagios to output to the trap receiver. In my case, $HOSTNAME$ – The monitored host, $SERVICEDESC$ – service description, $SERVICESTATEID$ – the Nagios state id like 0 for OK, 1 – for warning etc…and $SERVICEOUTPUT$ – The additional info field from the plug-in is sufficient. You may add more if you like where you deem necessary.
The Macros ($name$) are defined well in Nagios documentation. The n(typeID) are found in the MIB files, so do match them well. Some fields have been changed from Integer (i) to octect string (s) and this may cause your traps to fail. Whatever the case is, you can simulate the trap at the CLI such as
snmptrap -v 2c -c public 192.168.2.22 '' NAGIOS-NOTIFY-MIB::nSvcEvent nSvcStateID s “$SERVICESTATEID$”.
This will give errors as nSvcStateID in the MIB is expecting an Integer value, so changing to
nSvcStateID i $SERVICESTATEID$
Will then work. Etc..
Now, the command to execute and send traps out is ready. Now we tell which service/host is to execute this command in a state change (triggering the event handler).
Here’s a sample of my linux-services.cfg
NOTE: Check local users thresholds are normally much higher but for testing, i just made it warn at 2 users and critical at 3.
The only two parts i added from the normal service definition are;
event_handler send_snmptrap
event_handler_enabled 1
That’s all is needed for hosts or services to send traps out with the configured output as above when a state change happens.
send_snmptrap is the logical name i created for that command in commands.cfg. Well, that’s about it. Simple right? Now, just restart your nagios to enable the above configs.
/etc/init.d/nagios restart
And test the traps by sending a passive check in Nagios WEB UI to for example, Warning or Critical.
Also, if you would like to test receiving traps, i can recommend you the free iReasoning SNMP toolset. There’s a paid one if you like the rich features of this tool but the free one has limited functions.
Now, for iReasoning, launch the MIB Browser tool. Do load the Nagios MIB to make things much prettier. File >> Load MIBs and select Nagios-Notify-MIB. Now, click on Tools >> Trap Receiver.
In the remote management host value (in my case was 192.168.2.22) enter the IP where iReasoning is running. Ensure your windows firewall enables incoming port UDP 162 for snmptraps if you enable WF.
Trigger something and see it work. See sample from iReasoning below.
NOTE: Whenever you change something in the config files, remember to restart Nagios.
Please do comment and give further suggestions.
First thing do ensure that your Nagios box has the snmptrap binary and perhaps all other associated SNMP binaries installed. If you haven’t a good start would be to use the following lines:
This guide was made using Nagios 3.2.0, Debian 5
Debians..
apt-get install snmp snmpd libsnmp-dev |
yum install net-snmp net-snmp-utils net-snmp-devel –y |
So, each time there’s a state change (e.g. from OK to Warning), you will get, beside the standard notifications, an event that triggers a snmp trap to a remote management host.
To make things simple, we use existing config definitions such as the original commands.cfg and the linux-services.cfg. The following guide attempt to send a trap when there’s more than 2 or 3 users logging onto the nagios (localhost) box.
First, edit the commands.cfg file and add the following lines. I will explain what these lines mean.
define command{ command_name send_snmptrap command_line /usr/bin/snmptrap -v 2c -c public 192.168.2.22 '' NAGIOS-NOTIFY-MIB::nSvcEvent nSvcHostname s "$HOSTNAME$" nSvcDesc s "$SERVICEDESC$" nSvcStateID i $SERVICESTATEID$ nSvcOutput s "$SERVICEOUTPUT$" } |
The command name can be anything you wish, just as long it’s mentioned correctly in the _x_services.cfg files.
/usr/bin/snmptrap –v 2c –c public 192.168.2.22…
This is quite straightforward, here, we attempt to send SNMPv2 with the community string of public to the remote server 192.168.2.22.
…'' NAGIOS-NOTIFY-MIB::nSvcEvent nSvcHostname s "$HOSTNAME$" nSvcDesc s "$SERVICEDESC$" nSvcStateID i $SERVICESTATEID$ nSvcOutput s "$SERVICEOUTPUT$"
This part above firstly, feeds the Nagios MIBs so that we can use easy readable words such as NSvcDesc instead of OID numbers. It would be a good idea to give the Nagios MIBs to the 3rd party remote monitoring host as well.
[EDIT: UPDATE: – The Nagios MIB has a wrong definition or its actually meant for V2 of Nagios. Use this MIB which should work for V3]
The next few fields are completely up to you and what you wish Nagios to output to the trap receiver. In my case, $HOSTNAME$ – The monitored host, $SERVICEDESC$ – service description, $SERVICESTATEID$ – the Nagios state id like 0 for OK, 1 – for warning etc…and $SERVICEOUTPUT$ – The additional info field from the plug-in is sufficient. You may add more if you like where you deem necessary.
The Macros ($name$) are defined well in Nagios documentation. The n(typeID) are found in the MIB files, so do match them well. Some fields have been changed from Integer (i) to octect string (s) and this may cause your traps to fail. Whatever the case is, you can simulate the trap at the CLI such as
snmptrap -v 2c -c public 192.168.2.22 '' NAGIOS-NOTIFY-MIB::nSvcEvent nSvcStateID s “$SERVICESTATEID$”.
This will give errors as nSvcStateID in the MIB is expecting an Integer value, so changing to
nSvcStateID i $SERVICESTATEID$
Will then work. Etc..
Now, the command to execute and send traps out is ready. Now we tell which service/host is to execute this command in a state change (triggering the event handler).
Here’s a sample of my linux-services.cfg
define service{ use debian5-linuxservice host_name Nagios-Server service_description Current Users event_handler send_snmptrap event_handler_enabled 1 check_command check_local_users!2!3 } |
The only two parts i added from the normal service definition are;
event_handler send_snmptrap
event_handler_enabled 1
That’s all is needed for hosts or services to send traps out with the configured output as above when a state change happens.
send_snmptrap is the logical name i created for that command in commands.cfg. Well, that’s about it. Simple right? Now, just restart your nagios to enable the above configs.
/etc/init.d/nagios restart
And test the traps by sending a passive check in Nagios WEB UI to for example, Warning or Critical.
Also, if you would like to test receiving traps, i can recommend you the free iReasoning SNMP toolset. There’s a paid one if you like the rich features of this tool but the free one has limited functions.
Now, for iReasoning, launch the MIB Browser tool. Do load the Nagios MIB to make things much prettier. File >> Load MIBs and select Nagios-Notify-MIB. Now, click on Tools >> Trap Receiver.
In the remote management host value (in my case was 192.168.2.22) enter the IP where iReasoning is running. Ensure your windows firewall enables incoming port UDP 162 for snmptraps if you enable WF.
Trigger something and see it work. See sample from iReasoning below.
NOTE: Whenever you change something in the config files, remember to restart Nagios.
Please do comment and give further suggestions.
Subscribe to:
Posts (Atom)