On 10/10/07, Richard Mohr <[EMAIL PROTECTED]> wrote: > On Mon, 2007-10-08 at 16:13 -0500, Terry wrote: > > On 10/5/07, Aidan Anderson <[EMAIL PROTECTED]> wrote: > > > Terry wrote: > > > > > > > > I have regular contacts set up, me for example. I want to get > > > > notified every 30 minutes indefinitely if a service is in a hard state > > > > of warning or critical. However, I want another contact to only get > > > > notified one time when that hard state is achieved. That's it. > > > > > [...] > > > I've just posted you another message before seeing this one. You want > > > to use host or service escalations to achieve this. I've briefly > > > explained in the previous post but if you need more help, just shout. > > > > > > Aidan > > > > > > > Thanks for your reply. It looks like for me to achieve this, I will > > need to create 2 escalations for every service. One for the single > > notification and the other for standard notifications. That seems > > like a lot of configuration. > > I think you can get by with one escalation. Configure the service's > contactgroup to include you and the other person. Then create a service > escalation that kicks in on the second notification and continues > indefinitely. Use the escalation to change the contactgroup to include > only you, and set the notification interval to 30 minutes. > > Does that fit your needs? > > -- > Rick Mohr > Systems Developer > Ohio Supercomputer Center > >
Rick, thanks for your reply. That would work but I don't want to create an explicit service escalation for every single service I have. I got this working with a very ugly notification script. It is a 5 minute script and I suck at scripting so be gentle. But it works. In a nutshell, it checks to see if the notification is the first notification. If it is, go ahead and send the email. However, if it is NOT the first notification, and the contact email address is our ticket system email address, exit 0. Also, I use sendEmail as my sending program http://caspian.dotconf.net/menu/Software/SendEmail/ The command in nagios is: define command{ command_name notify-by-email command_line /usr/bin/printf "%b" "Notification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /usr/lib/nagios/eventhandlers/notification $SERVICENOTIFICATIONNUMBER$ smtp.server.com [EMAIL PROTECTED] $CONTACTEMAIL$ "** $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" } Finally, here is the script: #!/usr/bin/perl $servicenotificationnumber = $ARGV[0]; $server = $ARGV[1]; $from = $ARGV[2]; $to = $ARGV[3]; $subject = "$ARGV[4]"; unless ($ARGV[1]) { print "ERROR: You need to specify some arguments like this:\n\n"; print q!/usr/bin/printf "%b" "$message" | /usr/lib/nagios/eventhandlers/notification 1 $server $from $to "$subject"!; print "\n"; exit 1; } @message = <STDIN>; if ($to =~ /[EMAIL PROTECTED]/i) { if ($servicenotificationnumber == 1) { send_email(); } } else { send_email(); } sub send_email { $output = `/usr/bin/printf "%b" "$message"`; `/usr/bin/sendEmail -s $server -f $from -t $to -u "$subject" -m "@message"`; } ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ 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