[hobbit] creating a report of all the notifications sent by hobbit
Henrik Stoerner
henrik at hswn.dk
Tue Feb 6 22:46:58 CET 2007
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
More information about the Xymon
mailing list