/[pdpsoft]/trunk/nl.nikhef.ndpf.tools/nagios-cmdline-tools/bin/service_down.sh
ViewVC logotype

Diff of /trunk/nl.nikhef.ndpf.tools/nagios-cmdline-tools/bin/service_down.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 744 by ronalds, Fri Sep 4 13:01:35 2009 UTC revision 745 by ronalds, Fri Sep 4 14:13:32 2009 UTC
# Line 2  Line 2 
2  # shell script to submit a SCHEDULE_SVC_DOWNTIME command to Nagios.  # shell script to submit a SCHEDULE_SVC_DOWNTIME command to Nagios.
3    
4  now=`date +%s`  now=`date +%s`
 then=`expr $now + 7200`  
5  commandfile='/var/log/nagios/rw/nagios.cmd'  commandfile='/var/log/nagios/rw/nagios.cmd'
6  host=$1  host=$1
7  service=$2  service=$2
8    duration=${3:-7200}
9    ack=${4:-Scheduled downtime for $service}
10    user=${5:-$(whoami)@$(hostname -s)}
11    
12  /usr/bin/printf "[%lu] SCHEDULE_SVC_DOWNTIME;$host;$service;$now;$then;1;0;7200;root on nincom;Scheduled downtime for $service\n" $now > $commandfile  # ensure message and user contain sane values (no ; or newline)
13    ack=$(echo $ack | tr -d '[:cntrl:][;]')
14    user=$(echo $user | tr -d '[:cntrl:][;]')
15    
16    then=`expr $now + $duration`
17    
18    /usr/bin/printf "[%lu] SCHEDULE_SVC_DOWNTIME;$host;$service;$now;$then;1;0;$duration;$user;$ack\n" $now > $commandfile

Legend:
Removed from v.744  
changed lines
  Added in v.745

grid.support@nikhef.nl
ViewVC Help
Powered by ViewVC 1.1.28