Here Script for Formatting Nagios Status Page for Mobile Devices
Anthony Pisano
its-sysadmin at fuller.edu
Tue Jan 13 18:32:04 CET 2009
I've created a script to solve the following problem we were having getting
System Status on our Mobile Devices. Feel free to use it if it will help
you as well.
Problem: We needed to be able to quickly view network status on our mobile
devices while leaving the Nagios server on our Internal Network.
Solution:
1. Create mobile Nagios user with Read only access on Nagios
2. Copy script to a server running apache on your DMZ
3. Setup Crontab to run script at an interval of your choosing.
Anthony Pisano
ITS - Systems Administrator
Fuller Theological Seminary
---------- nagiosmobile.sh
#!/bin/bash
# Pull the desired view (Currently set to any "All Problems") and save it to
the /tmp directory. Username and Password is set in command
wget --quiet
'https://user:password@nagios.fuller.edu/nagios/cgi-bin/status.cgi?host=all&
servicestatustypes=28&hoststatustypes=15' --no-check-certificate -O
/tmp/status
# Opens the above file and uses sed to remove all links and images to create
a very basic page (Note: This is one continuous line)
cat /tmp/status | sed -e '/<link rel="shortcut icon.*ico">/d; /<LINK
REL=.'stylesheet.*status.css.'><\/head>/d; /Produced by Nagios/d; /Updated
every/d; /http:\/\/www.nagios.org/d; /<TABLE BORDER=1 CELLPADDING=0
CELLSPACING=0 CLASS=.'linkBox.'>/,/<\/TABLE>/d' | sed -e "s/<TH
CLASS='status'>Host .*Status Information<\/TH>/BLAHBLAHBLAH/g" | sed -e
"s/BLAHBLAHBLAH/<TH CLASS='status'>Host\ \;<\/TH><TH
CLASS='status'>Service\ \;<\/TH><TH
CLASS='status'>Status\ \;<\/TH><TH CLASS='status'>Last
Check\ \;<\/TH><TH CLASS='status'>Duration\ \;<\/TH><TH
CLASS='status'>Attempt\ \;<\/TH><TH CLASS='status'>Status
Information<\/TH>/g" | sed -e "s/<A CLASS.*HREF.*'>/ /g; s/<\/A>/ /g" >
/tmp/status.html
# Copies resulting file to your webshare
cp /tmp/status.html /share/nagiosmobile.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20090113/a5b09e14/attachment.html>
-------------- next part --------------
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
-------------- next part --------------
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
More information about the Users
mailing list