LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 11-16-2009, 03:13 AM   #1
c_parapat
LQ Newbie
 
Registered: Sep 2009
Location: Indonesia
Distribution: Centos, OpenSuSE, and MAC OS X
Posts: 6

Rep: Reputation: 0
Exclamation Not receive sms alert from nagios with gammu


Dear all,
I have some trouble that make me confuse with sms alert from nagios. I try to configure the commands.cfg, but i can not receive every alert from nagios. Only the email that i receive. Would you help me to try to solve this issue ? Here is some of my detail script from "commands.cfg" ;


# 'notify-host-by-email' command definition
define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "Hallo Sir.. I need your help\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}

# 'notify-service-by-email' command definition
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}

# 'notify-host-by-sms'
define command{
command_name notify-host-by-sms
command_line /usr/bin/printf "%b" "Svc:$SERVICEDESC$ Host:$HOSTALIAS$ Addr:$HOSTADDRESS$ State:$SERVICESTATES$ Date:$SHORTDATETIME$" | /usr/bin/gammu --sendsms TEXT $CONTACTPAGER$
}

# 'notify-service-by-sms'
define command{
command_name notify-service-by-sms
command_line /usr/bin/printf "%b" "Svc:$SERVICEDESC$ Host:$HOSTALIAS$ Addr:$HOSTADDRESS$ State:$SERVICESTATES$ Date:$SHORTDATETIME$" | /usr/bin/gammu --sendsms TEXT $CONTACTPAGER$
}

And here is my example of my configuration for host ;


define service{
use local-service ; Name of service template to use
host_name mac
contact_groups admins-sms
service_description PING
max_check_attempts 5
normal_check_interval 15
retry_check_interval 3
notification_options w,u,c,r
check_period 24x7
notification_interval 30
notification_period 24x7
check_command check_ping!100.0,20%!500.0,60%

And my configuration from "contacts.cfg" file ;

define contact{
contact_name nagiosadmin ; 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 u,c,r
host_notification_options d,u,r
host_notification_commands notify-host-by-sms,notify-host-by-email
service_notification_commands notify-host-by-sms,notify-host-by-email ; notify-by-sms-direct,host-notify-by-sms
email example@example.com ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
pager +6281358585810 ; notify host via sms
}

define contactgroup{
contactgroup_name admins
alias Nagios Administrators
members nagiosadmin
}

define contactgroup{
contactgroup_name admins-sms
alias Nagios Administrators
members nagiosadmin
}

When i try to check nagios with command :
# nagios -v /etc/nagios/nagios.cfg
There is no error. Btw, i'm using gammu to send sms. And it works to send sms.

Thanks before,

Regards me.

Last edited by c_parapat; 11-16-2009 at 03:18 AM.
 
Old 11-16-2009, 03:28 PM   #2
centosboy
Senior Member
 
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by c_parapat View Post
Dear all,
I have some trouble that make me confuse with sms alert from nagios. I try to configure the commands.cfg, but i can not receive every alert from nagios. Only the email that i receive. Would you help me to try to solve this issue ? Here is some of my detail script from "commands.cfg" ;


# 'notify-host-by-email' command definition
define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "Hallo Sir.. I need your help\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}

# 'notify-service-by-email' command definition
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}

# 'notify-host-by-sms'
define command{
command_name notify-host-by-sms
command_line /usr/bin/printf "%b" "Svc:$SERVICEDESC$ Host:$HOSTALIAS$ Addr:$HOSTADDRESS$ State:$SERVICESTATES$ Date:$SHORTDATETIME$" | /usr/bin/gammu --sendsms TEXT $CONTACTPAGER$
}

# 'notify-service-by-sms'
define command{
command_name notify-service-by-sms
command_line /usr/bin/printf "%b" "Svc:$SERVICEDESC$ Host:$HOSTALIAS$ Addr:$HOSTADDRESS$ State:$SERVICESTATES$ Date:$SHORTDATETIME$" | /usr/bin/gammu --sendsms TEXT $CONTACTPAGER$
}

And here is my example of my configuration for host ;


define service{
use local-service ; Name of service template to use
host_name mac
contact_groups admins-sms
service_description PING
max_check_attempts 5
normal_check_interval 15
retry_check_interval 3
notification_options w,u,c,r
check_period 24x7
notification_interval 30
notification_period 24x7
check_command check_ping!100.0,20%!500.0,60%

And my configuration from "contacts.cfg" file ;

define contact{
contact_name nagiosadmin ; 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 u,c,r
host_notification_options d,u,r
host_notification_commands notify-host-by-sms,notify-host-by-email
service_notification_commands notify-host-by-sms,notify-host-by-email ; notify-by-sms-direct,host-notify-by-sms
email example@example.com ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
pager +6281358585810 ; notify host via sms
}

define contactgroup{
contactgroup_name admins
alias Nagios Administrators
members nagiosadmin
}

define contactgroup{
contactgroup_name admins-sms
alias Nagios Administrators
members nagiosadmin
}

When i try to check nagios with command :
# nagios -v /etc/nagios/nagios.cfg
There is no error. Btw, i'm using gammu to send sms. And it works to send sms.

Thanks before,

Regards me.
what does the nagios log say, and does the notifications option in the nagios web interface show notify-by-sms
 
Old 11-16-2009, 11:22 PM   #3
c_parapat
LQ Newbie
 
Registered: Sep 2009
Location: Indonesia
Distribution: Centos, OpenSuSE, and MAC OS X
Posts: 6

Original Poster
Rep: Reputation: 0
I try to reconfiguration in contacts.cfg, be here;

###########
define contact{
contact_name nagiosadmin ; 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 w,u,c,r
host_notification_options d,u,r
host_notification_commands notify-host-by-email,notify-host-by-sms
service_notification_commands notify-service-by-email,notify-service-by-sms ; notify-by-sms-direct,host-notify-by-sms
email example@example.com ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
pager +6281358585810 ; notify host via sms
}


define contact{
contact_name alertsms
use generic-contact
alias Nagios alert SMS
service_notification_commands notify-service-by-sms
pager +6281358585810
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options n
host_notification_commands notify-host-by-sms
}
##########
define contactgroup{
contactgroup_name admins
alias Nagios Administrators
members nagiosadmin
}

define contactgroup{
contactgroup_name admins-sms
alias Nagios Administrators
members nagiosadmin,alertsms
}

When i try to see the log, here is the output :

static-host:/etc/nagios/objects # tail /var/log/nagios/nagios.log
[1258451163] Finished daemonizing... (New PID=12382)
[1258451213] SERVICE NOTIFICATION: alertsms;mac;Root Partition;CRITICAL;notify-service-by-sms;DISK CRITICAL - free space: / 125 MB (1% inode=32%):
[1258451213] SERVICE NOTIFICATION: nagiosadmin;mac;Root Partition;CRITICAL;notify-service-by-sms;DISK CRITICAL - free space: / 125 MB (1% inode=32%):
[1258451213] SERVICE NOTIFICATION: nagiosadmin;mac;Root Partition;CRITICAL;notify-service-by-email;DISK CRITICAL - free space: / 125 MB (1% inode=32%):

Last edited by c_parapat; 11-17-2009 at 12:37 AM.
 
  


Reply



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
Nagios SMS gateway sci3ntist Linux - Server 3 09-27-2009 04:24 PM
please tell me how can configure linux alert come to mobile sms mwchaudhry Linux - Software 2 03-19-2009 05:50 AM
Gammu unable to read sms from inbox ochienged Linux - Software 0 09-05-2008 12:21 PM
Need Software that send alert like text sms via bluetooth hayat Linux - Software 0 04-25-2006 07:08 AM
OFFTOPIC how to receive sms on pc ALInux General 1 08-22-2005 04:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 07:57 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration