LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 07-04-2008, 08:28 AM   #1
packets
Member
 
Registered: Oct 2005
Posts: 282

Rep: Reputation: 30
help in nagios notification


I want to set nagios to send a txt message if there is a down or critical status. I setup a nagios for testing to another box instead of playing in the stable nagios that was runnin. I already have email notification but sometimes I don't open my email in midnight so I need an alert ans I choose sms. I have an officemate who have a linux box and setup a url where if I visit the url it will send a txt message. Here is the sample url:

http://x.x.x.x/testserver?page=sms_s...agios&NOEXPIRE

123456789 = sms contact number
testing = message of the sms

Now, I have setup in commands.cfg the ff:

define command{
command_name notify-by-txt
command_line /usr/bin/printf "%b" "Service: $SERVICEDESC$\nHost: $HOSTNAME$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\nInfo: $SERVICE
OUTPUT$\nDate: $LONGDATETIME$" |/usr/bin/links "http://x.x.x.x/testserver?page=sms_sendsmsmessage&multi_recipients=+123456789&smsmessage=$HOSTNAME&&username=nagios &NOEXPIRE &"
}

Then I set my contacts.cfg

define contact{
contact_name nagios-admin
alias Nagios Admin
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,r
service_notification_commands notify-by-txt
host_notification_commands notify-by-txt
pager http://x.x.x.x/testserver?page=sms_s...agios&NOEXPIRE
}

I see the logs in nagios the notify-by-txt but I don't receive a sms message. But when I command it via shell, I receive a sms message.

Could someone direct me to right commands in notification commands? Can I set a sample script just to test notification commands?
 
Old 07-04-2008, 10:17 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,470
Blog Entries: 54

Rep: Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900
If you substitute the variables and can execute
Code:
echo "Service: $SERVICEDESC$\nHost: $HOSTNAME$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\nInfo: $SERVICE
OUTPUT$\nDate: $LONGDATETIME$" | /usr/bin/links "http://x.x.x.x/testserver?page=sms_sendsmsmessage&multi_recipients=+123456789&smsmessage=$HOSTNAME&&username=nagios&NOEXPIRE"
from your shell OK *and* receive the messages till, then what does the server logs show?
 
Old 10-10-2008, 01:01 PM   #3
ncsuapex
Member
 
Registered: Dec 2004
Location: Raleigh, NC
Distribution: CentOS 2.6.18-53.1.4.el5
Posts: 770

Rep: Reputation: 43
well here is what I did to get nagios to send a txt message to my phone. I have a 3G iPhone with ATT service.



In my contacts.cfg file I have this

define contact{
contact_name nagiosauser ; Short name of user
use generic-contact ; Inherit default values from generic-contact template (defined above)
alias Nagios Admin ; Full name of user

email username@mydomain.com,1234567890@txt.att.net ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS, phone number ******
}



This sends a message both to my email and my phone. You'll have to check your phone service provider to get the correct domain to send it to. I had to test about 5 different domains for ATT till I found one that worked.




EDIT:

I *think* in order to send custom alerts to 2 people with different alert levels you would create another user with the htpasswd command just like you did with your nagios user. then define another contact in contacts.cfg like this:

define contact{
contact_name username; Short name of user
use generic-contact ; Inherit default values from generic-contact template (defined above)
alias Nagios Admin ; Full name of user

service_notification_period 24x7
host_notification_period 24x7
service_notification_options c
host_notification_options d
email 1234567890@txt.att.net ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
}



then in your contacts group in the same file you would add your new user


define contactgroup{
contactgroup_name admins
alias Nagios Administrators
members nagiosuser,username
}

Last edited by ncsuapex; 10-10-2008 at 01:16 PM. Reason: .
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
E-mail notification with Nagios Hiroyatamoto Linux - Newbie 7 06-30-2009 11:18 AM
NAGIOS notification ny101880 Linux - Newbie 14 01-04-2009 01:10 AM
Nagios E-mail notification Hiroyatamoto Linux - General 5 07-02-2008 03:55 AM
Nagios E-mail notification setup Hiroyatamoto Linux - Newbie 3 07-01-2008 04:30 PM


All times are GMT -5. The time now is 07:55 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration