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
blog:display_nagios_status_on_the_desktop_using_conky [2010-06-23 08:17] brbblog:display_nagios_status_on_the_desktop_using_conky [2010-06-23 08:34] (current) brb
Line 1: Line 1:
 ====== Display nagios status on the desktop using conky ====== ====== Display nagios status on the desktop using conky ======
  
-Conky is a lightweight system monitor which displays arbitrary information on the linux desktop. I wanted to display the nagios status not only in the firefox browser (using the recommended! "nagios checker" extension, but also from the desktop. I found a shell script which was written for xfce and adapted it to output conky compatible output. +Conky is a lightweight system monitor which displays arbitrary information on the linux desktop. I wanted to display the nagios status not only in the firefox browser (using the  "nagios checker" extension), but also from the desktop. I found a shell script which was written for xfce and adapted it to output conky compatible output. 
  
 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) +Ref: http://dieter.plaetinck.be/nagios_monitoring_in_your_desktop_panel_aka_Xfce_Genmon_panel_plugin_rules#comment-5914
-#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: +
-  * http://dieter.plaetinck.be/nagios_monitoring_in_your_desktop_panel_aka_Xfce_Genmon_panel_plugin_rules+
  
  
blog/display_nagios_status_on_the_desktop_using_conky.1277273876.txt.gz · Last modified: 2010-06-23 08:17 by brb