[hobbit] creating a report of all the notifications sent by hobbit
Hubbard, Greg L
greg.hubbard at eds.com
Tue Feb 6 23:17:59 CET 2007
I knew it would be easy, but he wanted to be able to specify a time and
have it display all the entries that were NEWER (or maybe older), so
that it where it gets harder. Are there any shell shortcuts for data
comparisons? I haven't gotten the trusty "UNIX in a Nutshell" out
yet...
GLH
-----Original Message-----
From: Henrik Stoerner [mailto:henrik at hswn.dk]
Sent: Tuesday, February 06, 2007 3:47 PM
To: hobbit at hswn.dk
Subject: Re: [hobbit] creating a report of all the notifications sent by
hobbit
On Tue, Feb 06, 2007 at 03:02:51PM -0500, Tom Georgoulias wrote:
> Hubbard, Greg L wrote:
> >I bet you could write one in short order by using one of the existing
> >CGI's as a framework.
>
> Thought about using bb-eventlog.c, but I don't know much about C
> programming. I'll try and give it a shot anyway--can't hurt.
For a simpler approach, how about just scripting something that shows
the "notifications.log" file nicely on a HTML page ?
The notifications log is fairly simple: Entries look like this:
Thu Jan 11 18:17:52 2007 fenris.hswn.dk.cpu (172.16.10.254)
henrik at hswn.dk[121] 1168535872 200
Most fields are obvious; the "[121]" after the mail address is the
linenumber in hobbit-alerts.cfg that triggered this alert. "1168535872"
is the timestamp in Unix epoch form, same as what is on the start of the
line. "200" is the numeric service identifier, here it's for the "cpu"
status.
For the Hobbit "look", you can feed the content through bb-webpage.
So a quick hack would be:
#!/bin/sh
(echo "<table summary=Notifications border=1>"
echo "<tr><th align=left>Time</th><th align=left>Host.service</th><th
align=left>Recipient</th></tr>"
cat /var/log/hobbit/notifications.log | while read L do
set $L
echo "<tr>"
echo "<td>$1 $2 $3 $4 $5</td>"
echo "<td>$6</td>"
echo "<td>$8</td>"
echo "</tr>"
done
echo "</table>") | bbcmd bb-webpage
exit 0
Regards,
Henrik
To unsubscribe from the hobbit list, send an e-mail to
hobbit-unsubscribe at hswn.dk
More information about the Xymon
mailing list