Does /usr/bin/mail exist? How about /usr/bin/printf?
Chandresh Suthar wrote:
Dear All,
I am able to send mails to my persoanl email id by "mail" command.
But notification is not going. I have configured sendmail. I am not
even receiving mails on local system at [EMAIL PROTECTED] ( I tried).
I am even not getting any error messages in logs of nagios.
I am using solaris 8. Pls also suggest how we can specify subject as
in solaris i did n't find option of specifying subject.
contacts.cfg
define contact{
contact_name nagios
alias Nagios Admin
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,u,r
service_notification_commands notify-by-email
host_notification_commands host-notify-by-email
email [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
}
hostgroups.cfg
define hostgroup{
hostgroup_name solaris-boxes
alias Solaris Servers
contact_groups solaris-admins
members Blaze
}
contactgroups.cfg
define contactgroup{
contactgroup_name solaris-admins
alias Solaris Administrators
members nagios
}
define host{
name generic-host ; The name of
this host template - referenced in other host definition
s, used for template recursion/resolution
notifications_enabled 1 ; Host notifications
are enabled
event_handler_enabled 1 ; Host event handler
is enabled
flap_detection_enabled 1 ; Flap detection is
enabled
process_perf_data 1 ; Process performance
data
retain_status_information 1 ; Retain status
information across program restarts
retain_nonstatus_information 1 ; Retain non-status
information across program restarts
register 0 ; DONT REGISTER THIS
DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
}
hosts.cfg
# 'Solaris' host definition
define host{
use generic-host ; Name of host
template to use
host_name Blaze
alias Solaris Server
address 10.8.217.251 <http://10.8.217.251>
check_command check-host-alive
max_check_attempts 10
notification_interval 480
notification_period 24x7
notification_options d,u,r
}
services.cfg
define service{
name generic-service ; The 'name'
of this service template, referenced in other service def
initions
active_checks_enabled 1 ; Active service
checks are enabled
passive_checks_enabled 1 ; Passive service
checks are enabled/accepted
parallelize_check 1 ; Active service
checks should be parallelized (disabling this can lead to maj
or performance problems)
obsess_over_service 1 ; We should obsess
over this service (if necessary)
check_freshness 0 ; Default is to NOT
check service 'freshness'
notifications_enabled 1 ; Service
notifications are enabled
event_handler_enabled 1 ; Service event
handler is enabled
flap_detection_enabled 1 ; Flap detection is
enabled
process_perf_data 1 ; Process performance data
retain_status_information 1 ; Retain status
information across program restarts
retain_nonstatus_information 1 ; Retain non-status
information across program restarts
register 0 ; DONT REGISTER THIS
DEFINITION - ITS NOT A REAL SERVICE, JUST A TEMPLATE!
}
# Service definition
define service{
use generic-service ; Name
of service template to use
host_name Blaze
service_description PING
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups solaris-admins
notification_interval 240
notification_period 24x7
notification_options c,r
check_command check_ping!100.0,20%!500.0,60%
}
misccommands.cfg
# 'notify-by-email' command definition
define command{
command_name notify-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: $DATETIME$\n\nAdditional
Info:\n\n$OUTPUT$" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ alert -
$HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}
# 'host-notify-by-email' command definition
define command{
command_name host-notify-by-email
command_line /usr/bin/printf "%b" "***** Nagios
*****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost:
$HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo:
$OUTPUT$\n\nDate/Time: $DATETIME$\n" | /usr/bin/mail -s "Host
$HOSTSTATE$ alert for $HOSTNAME$!" $CONTACTEMAIL$
}
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null