Welcome to It-Slav.Net blog
Peter Andersson
peter@it-slav.net

I've already got a female to worry about. Her name is the Enterprise.
-- Kirk, "The Corbomite Maneuver", stardate 1514.0

Do you want Nagios or op5 Monitor notifications to be sent by MSN? Follow the steps below to implement it.

This is a hint from my colleague Martin Kamijo, kudos to him 😛

Steps:

  • Create an email account that the Nagios or op5 Monitor system will use to send from. I used gmail.
  • Create the account at http://www.msn.com/
  • The Nagios/op5 Monitor MSN Account and the one you want to send to MUST have each other in the contacts list. I used Pidgin and also tested to send messages back and forth.
  • Download the script that will send the message and put it in an appropriate directory on your Nagios or op5 Monitor host.
  • Modify the script by change $login_id =’ and $passwd = to the newly created account.
  • Test the script to see if there is any perl modules that needs to be installed. I only needed Jcode so I installed it with #perl -MCPAN -e ‘install Jcode’
  • Send a test message by running: # ./notify_by_msn.pl “This is a test message” email@example.org
  • Yes I recieved the message, in my MSN client Pidgin.
  • Create the host and service notify command by editing misccommands.cfg and add the notify definitions below.
  • Create the contact and contactgroups, see below
  • Use your newly created contactgroup for your hosts and services you want.


If you want to use op5 webconfig instead of editing text files that works perfectly well.

The notify definitions in /opt/monitor/etc/misccommands.cfg

define command{
 command_name	notify-service-by-msn
 command_line $USER1$/custom//notify_by_msn.pl "[Nagios] $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
 }
define command{
 command_name	notify-host-by-msn
 command_line	$USER1$/custom/notify_by_msn.pl "[Nagios] $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$" $CONTACTEMAIL$
 }

Define your contact using the notify scripts /opt/monitor/etc/contacts.cfg

# contact 'peter_msn'
define contact{
 contact_name                   peter_msn
 alias                          peter_msn
 host_notifications_enabled     1
 service_notifications_enabled  1
 can_submit_commands            0
 retain_status_information      1
 retain_nonstatus_information   1
 host_notification_period       24x7
 service_notification_period    24x7
 host_notification_options      d,r
 service_notification_options   c,w,r
 host_notification_commands     notify-host-by-msn
 service_notification_commands  notify-service-by-msn
 contactgroups                  it-slav_msn
 email                          emailaccount@domain
 }

Define your contactgroup in /opt/monitor/etc/contactgroups.cfg

# contactgroup 'it-slav_msn'
define contactgroup{
 contactgroup_name              it-slav_msn
 alias                          it-slav_msn
 }

Links:



14 Responses to “Send Nagios or op5 Monitor Notifications via MSN”

  1. ppcm Says:

    Hello there,

    Thanks for this howto. But when I try to send a message to a MSN account, nothing appends, no receive message, no error message.

    In debug mode, the following output is generated:

    TX: VER 0 MSNP8 CVR0
    RX: VER 0 MSNP8
    TX: CVR 1 0x0409 win 4.10 i386 MSNMSGR 5.0.0544 MSMSGS [mymsnsaccount]
    RX: CVR 1 7.0.0820 7.0.0820 7.0.0820 http://msgruser.dlservice.microsoft.com/download/9/7/6/976085F9-D0F8-4D96-9208-FC1B461CD3D7/Install_MSN_Messenger_DL.exe http://messenger.msn.com
    TX: USR 2 TWN I [mymsnsaccount]
    RX: XFR 2 NS 207.46.106.99:1863 0 65.54.239.141:1863
    TX: VER 3 MSNP8 CVR0
    RX: VER 3 MSNP8
    TX: CVR 4 0x0409 win 4.10 i386 MSNMSGR 5.0.0544 MSMSGS [mymsnsaccount]
    RX: CVR 4 7.0.0820 7.0.0820 7.0.0820 http://msgruser.dlservice.microsoft.com/download/9/7/6/976085F9-D0F8-4D96-9208-FC1B461CD3D7/Install_MSN_Messenger_DL.exe http://messenger.msn.com
    TX: USR 5 TWN I [mymsnsaccount]
    RX: USR 5 TWN S ct=1229083574,rver=5.5.4177.0,wp=FS_40SEC_0_COMPACT,lc=1033,id=507,ru=http:%2F%2Fmessenger.msn.com,tw=0,kpp=1,kv=4,ver=2.1.6000.1,rn=1lgjBfIL,tpf=b0735e3a873dfb5e75054465196398e0
    TX: USR 6 TWN S
    RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX: RX:
    […]

    Any idea?
    (old version of the protocol?)

    Thanks a lot

  2. peter Says:

    I’m sorry, I’ve made a typo, test:
    ./notify_by_msn.pl “This is a test message” email@example.org
    I will update the HowTo.

  3. nardo86 Says:

    Hi,
    i’ve a working nagios and i’ve configured the script like you wrote, but there is a proble: it work only 1 time in 3 or 4 sends..
    for example if i send:
    ./msnp_status.pl “hello1” “email@example.org”
    ./msnp_status.pl “hello2” “email@example.org”
    ./msnp_status.pl “hello3” “email@example.org”
    ./msnp_status.pl “hello4” “email@example.org”
    ./msnp_status.pl “hello5” “email@example.org”
    waiting 30 seconds from one to another i receive only hellos 1 and 2, but i see the nagios account become online all the 5 times!!

  4. peter Says:

    Here is an article describing howto use jabber instead of MSN.
    http://sanjaydalal.wordpress.com/2009/04/02/receiving-the-nagios-notifications-via-jabber/

  5. guiparm Says:

    hi,
    i don’t work with me.
    i see my contact logging but i dont receive this message.

  6. guiparm Says:

    yes.
    #./msnp_status.pl ‘hello’ myaddress@hotmail.com

    no error

    i see my contact logging but i dont receive this message

  7. guiparm Says:

    debug:
    ./msnp_status.pl ‘salut’ Myaddress1@hotmail.com
    TX: VER 0 MSNP8 CVR0
    RX: VER 0 MSNP8
    TX: CVR 1 0x0409 win 4.10 i386 MSNMSGR 5.0.0544 MSMSGS myadress2@hotmail.fr
    RX: CVR 1 1.0.0000 1.0.0000 1.0.0000 http://msgr.dlservice.microsoft.com http://download.live.com/?sku=messenger
    TX: USR 2 TWN I myaddress2@hotmail.fr
    RX: XFR 2 NS 207.46.124.222:1863 0 65.54.239.81:1863
    TX: VER 3 MSNP8 CVR0
    RX: VER 3 MSNP8
    TX: CVR 4 0x0409 win 4.10 i386 MSNMSGR 5.0.0544 MSMSGS myaddress2@hotmail.fr
    RX: CVR 4 1.0.0000 1.0.0000 1.0.0000 http://msgr.dlservice.microsoft.com http://download.live.com/?sku=messenger
    TX: USR 5 TWN I myaddress2@hotmail.fr
    RX: USR 5 TWN S ct=1240472455,rver=5.5.4177.0,wp=FS_40SEC_0_COMPACT,lc=1033,id=507,ru=http:%2F%2Fmessenger.msn.com,tw=0,kpp=1,kv=4,ver=2.1.6000.1,rn=1lgjBfIL,tpf=b0735e3a873dfb5e75054465196398e0
    TX: USR 6 TWN S t=9Xwx1wbD!HUQtouv6gP8JrlQZJF5RxDiLHUsDBIVqaVo4XgMmz45edRXj5oTt1AYdJ5ma8*JwQXfNteAZQKJWU!xe1tRLX!b2FaSotGQMecwf9GKN7Yk9seoOjMI&p=9M7WqLCdJEca23qCzbVKWiZCFdxg*1N0xHIoFqjT271Sj!S4v8
    RX: USR 6 OK myaddress2@hotmail.fr guillaume 1 0
    TX: SYN 7 0
    RX: MSG Hotmail Hotmail 515
    RX: MIME-Version: 1.0
    RX: Content-Type: text/x-msmsgsprofile; charset=UTF-8
    RX: LoginTime: 1240472456
    RX: EmailEnabled: 1
    RX: MemberIdHigh: 393216
    RX: MemberIdLow: -1834285079
    RX: lang_preference: 1036
    RX: preferredEmail:
    RX: country: FR
    RX: PostalCode:
    RX: Gender:

  8. guiparm Says:

    next :

    RX: Kid: 0
    RX: Age:
    RX: BDayPre:
    RX: Birthday:
    RX: Wallet:
    RX: Flags: 1073742915
    RX: sid: 507
    RX: MSPAuth: 9Xwx1wbD!HUQtouv6rlQZJF5RxDiLHUsDBIo4XgMmz45edRXj5oTt1AdJ5Gjphgkma8*JwQXfNteZQKJWU!xe1tRLX!b2FaSotGQMcwf9GKN7Yk9seoOjMI
    RX: ClientIP: X.X.X.X
    RX: ClientPort: 32670
    RX: MPOPEnabled: 0
    RX:
    RX: SYN 7 1 6 1
    TX: CHG 8 NLN
    RX: GTC A
    RX: BLP BL
    RX: PRP MBE N
    RX: LSG 0 Individuals 0
    RX: LST [mycontactlist]
    RX: UUX 0 0
    RX: MSG Hotmail Hotmail 219
    RX: MIME-Version: 1.0
    RX: Content-Type: text/x-msmsgsinitialemailnotification; charset=UTF-8
    RX:
    RX: Inbox-Unread: 0
    RX: Folders-Unread: 0
    RX: Inbox-URL: /cgi-bin/HoTMaiL
    RX: Folders-URL: /cgi-bin/folders
    RX: Post-URL: http://www.hotmail.com
    RX: NOT 338
    RX: To see your offline messages, get the latest version of Windows Live(TM) Messenger.CHG 8 NLN 4096
    Content-type: image/gif

  9. peter Says:

    I have no idea. Turn on debugging and se if you can find anything there.

  10. peter Says:

    I recommend you to contact the person that has developed msnp_status.pl.

  11. mrninni Says:

    hi, i’ve the same problem: the account logs, but the message doesn’t arrive.

  12. peter Says:

    I had so much problems with notify by MSN so I switched to Jabber instead, that works perfect.
    This is a real good example why proprietary protocols are bad and should be avoided.

  13. Nicola Says:

    Hej,
    to fix the problem where user sign in and no message showed just add 2 ” before and at the end of the text.

    from terminal:

    ./notify_by_msn “Message” recipient

Leave a Reply





Book reviews
FreePBX 2.5
Powerful Telephony Solutions






Asterisk 1.6
Build a feature rich telephony system with Asterisk






Learning NAGIOS 3.0





Cacti 0.8 Network Monitoring,
Monitor your network with ease!