Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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$
}
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.
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$
}
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
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
}
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.