> -----Original Message-----
> From: mike [mailto:lists01 at dds.uconn.edu]
> Sent: Wednesday, August 25, 2004 3:05 PM
> To: nagios-users at lists.sourceforge.net
> Subject: [Nagios-users] nagios screen saver? :-)
>
>
> we have a system set up that displays a nagios window 24x7. i'm
> wondering how hard it would be to create an X screen saver that floats
> a nagios summary around on the screen? :-)
I really liked this idea, so I put something together to do it:
#!/bin/bash
date
wget \
--http-user=username \
--http-passwd=password \
-O $HOME/nagios-dump \
'http://nsc-3.nacs.uci.edu/nagios/cgi-bin/status.cgi?hostgroup=strombrg%2Dmachines&style=overview' 2> /dev/null
links -dump-width 120 -dump $HOME/nagios-dump | \
egrep 'UP|DOWN|OK|WARNING|CRITICAL' | \
sed \
-e 's/\[[0-9]\]/ /g' \
-e 's/\[[0-9][0-9]\]/ /g' \
-e 's/\[[0-9][0-9][0-9]\]/ /g' \
-e 's/\[[0-9][0-9][0-9][0-9]\]/ /g' \
-e 's/|/ /g' \
-e 's/View.*$//' \
-e 's/This Host.*$//' \
-e 's/\(CRITICAL\)/======\1======/g' \
-e 's/\(DOWN\)/======\1======/g' | \
awk ' { if (NF == 4) { printf("%s %s %s %s\n",$1,$2,$3,$4)}; if (NF == 2) { printf("%s %s\n",$1,$2)} }'
# grep '^| \[' | \
# sed 's/\[[0-9]*\][0-9]*//g' | \
# awk ' { printf("%-40s %-5s %-5s %s\n",$2,$4,$6,$8) }'
echo '___________________________________________________________'
I'm calling it from:
starwars -root -program \
$HOME/bin/nagios-fortune -delay 0 \n\
...in $HOME/.xscreensaver.
BTW, some of those sed patterns are unnecessary, but they shouldn't hurt
things. I kind of changed approaches midstream, and then didn't clean
up afterward.
Also, here's a patch for starwars.c that makes it write lines containing
the strings "CRITICAL" and "DOWN" in red:
--- hacks/glx/starwars.c.t 2004-08-29 22:33:47.000000000 -0700
+++ hacks/glx/starwars.c 2004-08-30 18:48:08.708854472 -0700
@@ -940,7 +940,15 @@
if (fade_p)
{
double factor = 1.0 * i / sc->total_lines;
- glColor3f (factor, factor, 0.5 * factor);
+ if (strstr(line,"CRITICAL") == NULL &&
+ strstr(line,"DOWN") == NULL)
+ {
+ glColor3f (factor, factor, 0.5 * factor);
+ }
+ else
+ {
+ glColor3f (factor, 0.0, 0.0);
+ }
}
draw_string ((x + xoff) / sc->font_scale, y / sc->font_scale, line);
--
Dan Stromberg DCS/NACS/UCI