Re: Problem with external commands
"Tom DE BLENDE" <[email protected]>
| Newsgroups | gmane.network.netsaint.user |
|---|---|
| Organization | DHL GCC |
| Message-ID | <[email protected]> |
This one works fine with Bash.
[root@netsaint libexec]# cat /usr/local/netsaint/etc/downtime.sh
#!/bin/sh
# Script to re-submit downtime after restart
# Get EPOCH Time via perl
TIME=`perl -e 'print time();'`
# Get the hosts that all ready have down time from the log file
DOWNTIME=`grep SCHEDULE_HOST_DOWNTIME
/usr/local/netsaint/var/netsaint.log |
awk -F: '{print $2}'| sort -u`
# Do one host at a time
for LOOP in `echo $DOWNTIME`
do
# Work out the ENDTIME of that hosts downtime
ENDTIME=`echo $LOOP | awk -F\; '{print $4}'`
# If the time now and END time is less then process it
if [ $TIME -le $ENDTIME ]
then
echo "[$TIME] $LOOP" > /usr/local/netsaint/var/rw/netsaint.cmd
echo "[$TIME] $LOOP"
fi
done
Jens Kruse wrote:
>
> Hi Atle, hi all!
>
> Someone did sent me a script that will "rebuild" our scheduled downtimes
> upon reload.
>
> Sorry, it somehow disappeared from my screens, you could pls. send this
> again?
>
> * I don't remember who sent this to me (tom, Stanley?)
> * I don't remember the name of the script
> * I remember that it was a ksh or tcsh script
>
> I already converted it to our needs (bash) but I can't find anymore ...
>
> Thank you very much for your help in advance,
>
> Jens
>
> Atle Veka wrote:
> > On Mon, 19 Aug 2002, Jens Kruse wrote:
> >
> >
> >>Hi *,
> >>
> >>I mailed this problem already, got some hints, but we still have
> >>problems with it ...
> >>
> >>When we set external commands, i.e. acknowledgements or downtimes, it
> >>sometimes is accepted and executed, but sometimes not.
> >>I can see that the i.e. ack-request gets piped to the command file
> >>netsaint.cmd, but some jobs don't appear within netsaint.log within the
> >>next 15 Minutes or so and are not executed ...
> >>
> >>Does anyone have clue what might be wrong?
> >
> >
> > No idea what might be wrong, sounds really strange to me. Have you tried
> > compiling with debug support and running netsaint from the command line
> > (either watching stdout or piping it to a file)?
> >
> >
> >
> >>A second question: Is there any trick to set i.e. acknowledgments
> >>persistent, so that it won't disappear after a reload of the netsaint
> >>configuration (we have to actualize our configuration quite often ...)?
> >
> >
> > In Netsaint this is not possible without your own trickery, I think
> > someone has scripts that will "rebuild" your scheduled downtimes upon
> > reload. I do believe this is fixed in Nagios however. :)
> >
> >
> > Hope this helps,
> >
> > Atle
> > -
> > Flying Crocodile Inc, Unix Systems Administrator
> >
>
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf