User Tools

Site Tools


blog:display_nagios_status_on_the_desktop_using_conky

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
blog:display_nagios_status_on_the_desktop_using_conky [2010-06-23 08:29] brbblog:display_nagios_status_on_the_desktop_using_conky [2010-06-23 08:31] brb
Line 7: Line 7:
   * add the call to nagiosmon in your .conkyrc file:\\ ''${execpi 53 $HOME/bin/nagiosmon.sh}''   * add the call to nagiosmon in your .conkyrc file:\\ ''${execpi 53 $HOME/bin/nagiosmon.sh}''
  
-<file>nagiosmon.sh</file> +[[:blogfiles:nagiosmon.sh]]
-<code bash> +
- +
-#!/bin/bash +
-+
-# Written by Dieter Plaetinck +
-# Updated by Bernhard Brunner: output for conky +
-+
-# Licensed under the GPL V3 +
-# See gnu.org/licenses/gpl-3.0.html +
-+
-# works for Nagios 2.x or nagios 3.x +
-URL=http://nagiosserver/nagios3/cgi-bin/tac.cgi +
-USERNAME=nagiosadmin +
-PASSWORD=<nagiosadminpassword> +
- +
-PAGE=$(curl -s -k -u $USERNAME:$PASSWORD $URL) +
-#echo $PAGE +
- +
-HOSTS_DOWN=$( echo -e "$PAGE" | grep "hoststatustypes=4' class='hostHeader'" | awk '{print $5}' | cut -c 20-) +
-HOSTS_UNREACHABLE=$( echo -e "$PAGE" | grep "hoststatustypes=8' class='hostHeader'" | awk '{print $5}' | cut -c 20-) +
-HOSTS_UP=$( echo -e "$PAGE" | grep "hoststatustypes=2' class='hostHeader'" | awk '{print $5}' | cut -c 20-) +
-HOSTS_PENDING=$( echo -e "$PAGE" | grep "hoststatustypes=1' class='hostHeader'" | awk '{print $5}' | cut -c 20-) +
-  +
-SERVICES_CRIT=$( echo -e "$PAGE" | grep "servicestatustypes=16' class='serviceHeader'" | awk '{print $5}' | cut -c 23-) +
-SERVICES_WARN=$( echo -e "$PAGE" | grep "servicestatustypes=4' class='serviceHeader'" | awk '{print $5}' | cut -c 23-) +
-SERVICES_UNKNOWN=$( echo -e "$PAGE" | grep "servicestatustypes=8' class='serviceHeader'" | awk '{print $5}' | cut -c 23-) +
-SERVICES_OK=$( echo -e "$PAGE" | grep "servicestatustypes=2' class='serviceHeader'" | awk '{print $5}' | cut -c 23-) +
-SERVICES_PENDING=$( echo -e "$PAGE" | grep "servicestatustypes=1' class='serviceHeader'" | awk '{print $5}' | cut -c 23-) +
- +
-if [[ "$HOSTS_DOWN" == "" ]] +
-then +
-  echo '${font Radio Space:size=13}${color red}Nagios:DOWN${color}${font}' +
-else  +
-  if [[ $(($HOSTS_DOWN + $SERVICES_CRIT)) > 0 ]] +
-  then +
-    echo '${font Radio Space:size=13}${color red}Nagios:ERROR${color}${font}' +
-  else +
-    if [[ $SERVICES_WARN > 0 ]] +
-    then +
-      echo '${font Radio Space:size=12}${color orange}Nagios:Warn${color}${font}' +
-    else +
-      echo '${font Radio Space:size=11}${color }Nagios:OK${color}${font}' +
-    fi +
-  fi +
-fi +
- +
-</code>+
  
 Ref: Ref:
blog/display_nagios_status_on_the_desktop_using_conky.txt · Last modified: 2010-06-23 08:34 by brb