Parent Directory
|
Revision Log
Making scripts more flexible
1 | #!/bin/sh |
2 | # Script to submit SCHEDULE_HOST_DOWNTIME command to Nagios |
3 | |
4 | now=`date +%s` |
5 | commandfile='/var/log/nagios/rw/nagios.cmd' |
6 | host=$1 |
7 | duration=${2:-7200} |
8 | ack=${3:-Scheduled downtime for $host} |
9 | user=${4:-$(whoami)@$(hostname -s)} |
10 | |
11 | # ensure message and user contain sane values (no ; or newline) |
12 | ack=$(echo $ack | tr -d '[:cntrl:][;]') |
13 | user=$(echo $user | tr -d '[:cntrl:][;]') |
14 | |
15 | then=`expr $now + $duration` |
16 | |
17 | /usr/bin/printf "[%lu] SCHEDULE_HOST_DOWNTIME;$host;$now;$then;1;0;$duration;$user;$ack\n" $now > $commandfile |
Name | Value |
---|---|
svn:keywords | id |
grid.support@nikhef.nl | ViewVC Help |
Powered by ViewVC 1.1.28 |