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
Last revisionBoth sides next revision
blog:display_nagios_status_on_the_desktop_using_conky [2010-06-23 08:20] brbblog:display_nagios_status_on_the_desktop_using_conky [2010-06-23 08:32] brb
Line 4: Line 4:
  
 How to use it:  How to use it: 
-  * copy-paste the code below into a script file, e.g. $HOME/bin/nagiosmon.sh, and make it executable with chmod +x+  * copy-paste the [[:blogfiles:nagiosmon.sh]] script into a file, e.g. $HOME/bin/nagiosmon.sh, and make it executable with chmod +x
   * 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}''
  
-<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:
-  * http://dieter.plaetinck.be/nagios_monitoring_in_your_desktop_panel_aka_Xfce_Genmon_panel_plugin_rules+  * http://dieter.plaetinck.be/nagios_monitoring_in_your_desktop_panel_aka_Xfce_Genmon_panel_plugin_rules#comment-5914
  
  
blog/display_nagios_status_on_the_desktop_using_conky.txt · Last modified: 2010-06-23 08:34 by brb