Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| monitors:hardware_sensors [2013/06/27 21:56] – external edit 127.0.0.1 | monitors:hardware_sensors [2022/12/11 11:12] (current) – [Source] doktoil_makresh | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Hardware monitoring ====== | ====== Hardware monitoring ====== | ||
| - | ^ Author | [[ doctor@makelofine.org | Damien Martins ]] | | + | ^ Author |
| - | ^ Compatibility | Xymon 4.2.2/4.3.10 | | + | ^ Compatibility |
| - | ^ Requirements | sh (or bash), hddtemp, smartmontools | | + | ^ Requirements |
| - | ^ Download | https://www.makelofine.org/ | + | ^ Download |
| - | ^ Last Update | 2013-06-27 | | + | ^ Last Update |
| ===== Description ===== | ===== Description ===== | ||
| Line 11: | Line 11: | ||
| ===== Installation ===== | ===== Installation ===== | ||
| === Client side === | === Client side === | ||
| - | Untar this package, put hobbit-hardware.sh in $BBHOME/ext directory | + | Untar this package, put hobbit-hardware.sh in $XYMONCLIENTHOME/ext directory |
| - | Put hobbit-hardware.conf in $BBHOME/etc directory | + | Put xymon-hardware.cfg in $XYMONCLIENTHOME/etc directory |
| Modify variables in both files to fit your needs/ | Modify variables in both files to fit your needs/ | ||
| + | User ' | ||
| === Server side === | === Server side === | ||
| - | Add hardware to you $BBHOME/server/bb-hosts line for the host running this script | + | Add hardware to you $XYMONHOME/ |
| ===== Source ===== | ===== Source ===== | ||
| Line 24: | Line 25: | ||
| # ALL THIS SCRIPT IS UNDER GPL LICENSE | # ALL THIS SCRIPT IS UNDER GPL LICENSE | ||
| - | # Version 0.4 | + | # Version 0.6 |
| - | # Title: | + | # Title: |
| # Author: | # Author: | ||
| - | # Date: | + | # Date: |
| # Purpose: | # Purpose: | ||
| # Platforms: Uni* having lm-sensor and hddtemp utilities | # Platforms: Uni* having lm-sensor and hddtemp utilities | ||
| # Tested: | # Tested: | ||
| - | |||
| - | #TODO for v0.5 | ||
| - | # -To be independent of / | ||
| - | # -Support for multiples sensors | ||
| - | # -Support for independant temperatures thresolds for each disk | ||
| - | # | ||
| - | # History : | ||
| - | # 27 jun 2013 - Damien Martins and Xavier Carol i Rosell | ||
| - | # v0.4 : Fix hddtemp output handling (print last field instead of field N) | ||
| - | # 09 sep 2011 - Damien Martins | ||
| - | # v0.3 : Add support for OpenManage Physical disks, temps | ||
| - | # 17 feb 2010 - Damien Martins | ||
| - | # v0.2.2 : Minor code optimizations | ||
| - | # 22 jan 2010 - Damien Martins | ||
| - | # v0.2.1 : Minor bug fix | ||
| - | # 14 nov 2009 - Damien Martins | ||
| - | # v0.2 : -Getting sensor probe no more hard coded | ||
| - | # -More verbosity when commands fail | ||
| - | # -Disk temperature thresolds in xymon-hardware.conf file. | ||
| - | # -Support smartctl to replace hddtemp (if needed) | ||
| - | # | ||
| - | # | ||
| - | # 25 jun 2009 - Damien Martins | ||
| - | # | ||
| - | # 18 jun 2009 - Damien Martins | ||
| - | # | ||
| - | # 15 jan 2009 - Damien Martins | ||
| - | # v0.1 : First lines, trying to get : | ||
| - | # | ||
| - | # -fan rotation speed and thresold | ||
| - | # | ||
| - | # -HDD temperature (thresold is not include, so we set it in this file) | ||
| ################################################################################# | ################################################################################# | ||
| Line 69: | Line 38: | ||
| #This script should be stored in ext directory, located in Xymon/Xymon client home (typically ~xymon/ | #This script should be stored in ext directory, located in Xymon/Xymon client home (typically ~xymon/ | ||
| - | #You must configure the xymon-hardware.conf file (or whatever name defined in CONFIG_FILE | + | #You must configure the xymon-hardware.cfg file (or whatever name defined in CONFIG_FILE) |
| - | + | ||
| - | #Change to fit your system/ | + | |
| - | TEST=" | + | |
| - | MSG_FILE=" | + | |
| - | CONFIG_FILE=" | + | |
| - | TMP_FILE=" | + | |
| - | CMD_HDDTEMP=" | + | |
| - | SENSORS="/ | + | |
| - | BC="/ | + | |
| - | SUDO="/ | + | |
| - | SMARTCTL="/ | + | |
| - | OMREPORT="/ | + | |
| #Debug | #Debug | ||
| Line 87: | Line 44: | ||
| echo "Debug ON" | echo "Debug ON" | ||
| BB=echo | BB=echo | ||
| - | | + | |
| - | | + | |
| BBDISP=your_xymon_server | BBDISP=your_xymon_server | ||
| MACHINE=$(hostname) | MACHINE=$(hostname) | ||
| Line 98: | Line 55: | ||
| DATE="/ | DATE="/ | ||
| SED="/ | SED="/ | ||
| - | CONFIG_FILE=" | + | CONFIG_FILE=" |
| TMP_FILE=" | TMP_FILE=" | ||
| MSG_FILE=" | MSG_FILE=" | ||
| fi | fi | ||
| + | |||
| + | #Change to fit your system/ | ||
| + | TEST=" | ||
| + | MSG_FILE=" | ||
| + | CONFIG_FILE=" | ||
| + | TMP_FILE=" | ||
| + | CMD_HDDTEMP=" | ||
| + | SENSORS="/ | ||
| + | BC="/ | ||
| + | SMARTCTL=" | ||
| + | OMREPORT="/ | ||
| + | HPACUCLI=" | ||
| #Don't change anything from here (or assume all responsibility) | #Don't change anything from here (or assume all responsibility) | ||
| Line 108: | Line 77: | ||
| #Basic tests : | #Basic tests : | ||
| - | if [ -z "$HOBBITCLIENTHOME" ] ; then | + | if [ -z "$XYMONCLIENTHOME" ] ; then |
| - | echo "HOBBITCLIENTHOME | + | echo "XYMONCLIENTHOME |
| exit 1 | exit 1 | ||
| fi | fi | ||
| - | if [ -z "$BBTMP" ] ; then | + | if [ -z "$XYMONTMP" ] ; then |
| - | echo "BBTMP not defined !" | + | echo "XYMONTMP |
| exit 1 | exit 1 | ||
| fi | fi | ||
| Line 175: | Line 144: | ||
| fi | fi | ||
| for DISK in $(" | for DISK in $(" | ||
| - | HDD_TEMP=" | + | HDD_TEMP=" |
| if [ ! " | if [ ! " | ||
| RED=1 | RED=1 | ||
| Line 344: | Line 313: | ||
| function use_openmanage () | function use_openmanage () | ||
| { | { | ||
| - | rm -f ${BBTMP}/ | + | rm -f ${XYMONTMP}/ |
| #Tests temperatures : | #Tests temperatures : | ||
| CHASSIS_TEMP=$($OMREPORT chassis temps | grep Reading |awk ' | CHASSIS_TEMP=$($OMREPORT chassis temps | grep Reading |awk ' | ||
| Line 356: | Line 325: | ||
| CHASSIS_TEMP_STATUS=red | CHASSIS_TEMP_STATUS=red | ||
| echo "& | echo "& | ||
| - | temperature_chassis: | + | temperature_chassis: |
| RED=1 | RED=1 | ||
| elif [ $CHASSIS_TEMP -ge $CHASSIS_TEMP_WARNING ] ; then | elif [ $CHASSIS_TEMP -ge $CHASSIS_TEMP_WARNING ] ; then | ||
| Line 362: | Line 331: | ||
| YELLOW=1 | YELLOW=1 | ||
| echo "& | echo "& | ||
| - | temperature_chassis: | + | temperature_chassis: |
| elif [ $CHASSIS_TEMP -lt $CHASSIS_TEMP_WARNING ] ; then | elif [ $CHASSIS_TEMP -lt $CHASSIS_TEMP_WARNING ] ; then | ||
| CHASSIS_TEMP_STATUS=green | CHASSIS_TEMP_STATUS=green | ||
| - | echo "& | + | echo "& |
| else | else | ||
| echo " | echo " | ||
| Line 379: | Line 348: | ||
| VOLT_GLOBAL_STATUS=green | VOLT_GLOBAL_STATUS=green | ||
| else | else | ||
| - | $OMREPORT chassis volts | grep -A 2 Index |grep -v Index | grep -v " | + | $OMREPORT chassis volts | grep -A 2 Index |grep -v Index | grep -v " |
| while read LINE ; do | while read LINE ; do | ||
| echo $LINE | grep -q Status | grep -q Ok | echo $LINE | grep -q Status | grep -q Ok | ||
| if [ $ERROR ] ; then | if [ $ERROR ] ; then | ||
| PROBE_IN_ERROR=" | PROBE_IN_ERROR=" | ||
| - | echo "& | + | echo "& |
| fi | fi | ||
| unset ERROR | unset ERROR | ||
| Line 391: | Line 360: | ||
| ERROR=1 | ERROR=1 | ||
| fi | fi | ||
| - | done < ${BBTMP}/ | + | done < ${XYMONTMP}/ |
| fi | fi | ||
| if [ $VOLT_YELLOW ] ; then | if [ $VOLT_YELLOW ] ; then | ||
| Line 402: | Line 371: | ||
| FANS_GLOBAL_STATUS=green | FANS_GLOBAL_STATUS=green | ||
| else | else | ||
| - | $OMREPORT chassis fans | grep -A 6 Index |grep -v Index | grep -v " | + | $OMREPORT chassis fans | grep -A 6 Index |grep -v Index | grep -v " |
| while read LINE ; do | while read LINE ; do | ||
| if [ $NEXT_LINE == FAN_MIN_RPM ] ; then | if [ $NEXT_LINE == FAN_MIN_RPM ] ; then | ||
| FAN_MIN_RPM=$(echo $LINE | awk ' | FAN_MIN_RPM=$(echo $LINE | awk ' | ||
| echo "& | echo "& | ||
| - | ${FAN_NAME}_rpm: | + | ${FAN_NAME}_rpm: |
| unset NEXT_LINE | unset NEXT_LINE | ||
| fi | fi | ||
| Line 419: | Line 388: | ||
| if [ $FAN_RPM -le 0 ] ; then | if [ $FAN_RPM -le 0 ] ; then | ||
| FAN_RED=1 | FAN_RED=1 | ||
| - | echo "& | + | echo "& |
| fi | fi | ||
| unset ERROR | unset ERROR | ||
| Line 429: | Line 398: | ||
| NEXT_LINE=FAN_NAME | NEXT_LINE=FAN_NAME | ||
| fi | fi | ||
| - | done < ${BBTMP}/ | + | done < ${XYMONTMP}/ |
| fi | fi | ||
| if [ $FAN_RED ] ; then | if [ $FAN_RED ] ; then | ||
| RED=1 | RED=1 | ||
| echo "& | echo "& | ||
| - | $(cat ${BBTMP}/ | + | $(cat ${XYMONTMP}/ |
| elif [ $FAN_YELLOW ] ; then | elif [ $FAN_YELLOW ] ; then | ||
| YELLOW=1 | YELLOW=1 | ||
| echo "& | echo "& | ||
| - | $(cat ${BBTMP}/ | + | $(cat ${XYMONTMP}/ |
| else | else | ||
| VOLT_GLOBAL_STATUS=green | VOLT_GLOBAL_STATUS=green | ||
| - | echo "& | + | echo "& |
| fi | fi | ||
| Line 447: | Line 416: | ||
| $OMREPORT storage pdisk controller=0 |grep ^Status | grep -q Ok | $OMREPORT storage pdisk controller=0 |grep ^Status | grep -q Ok | ||
| if [ $? -eq 0 ] ; then | if [ $? -eq 0 ] ; then | ||
| - | echo "& | + | echo "& |
| else | else | ||
| DISK_COLOR=yellow | DISK_COLOR=yellow | ||
| - | $OMREPORT storage pdisk controller=0 |grep -A 1 ^Status | grep -v " | + | $OMREPORT storage pdisk controller=0 |grep -A 1 ^Status | grep -v " |
| while read LINE ; do | while read LINE ; do | ||
| echo $LINE | grep -q Status | grep -q Ok | echo $LINE | grep -q Status | grep -q Ok | ||
| if [ $NEXT_LINE == DISK_NAME ] ; then | if [ $NEXT_LINE == DISK_NAME ] ; then | ||
| DISK_NAME=$(echo $LINE | cut -c 29-) | DISK_NAME=$(echo $LINE | cut -c 29-) | ||
| - | echo "& | + | echo "& |
| unset NEXT_LINE | unset NEXT_LINE | ||
| fi | fi | ||
| Line 464: | Line 433: | ||
| NEXT_LINE=DISK_NAME | NEXT_LINE=DISK_NAME | ||
| fi | fi | ||
| - | done < ${BBTMP}/ | + | done < ${XYMONTMP}/ |
| fi | fi | ||
| } | } | ||
| + | function use_hpacucli () | ||
| + | { | ||
| + | $HPACUCLI ctrl all show config | grep drive | while read OUTPUT ; do | ||
| + | TYPE=$(echo $OUTPUT | awk ' | ||
| + | SLOT=$(echo $OUTPUT | awk ' | ||
| + | STATUS=$(echo $OUTPUT | awk ' | ||
| + | if [ $TYPE == " | ||
| + | RAID=$(echo $OUTPUT | awk ' | ||
| + | SIZE=$(echo $OUTPUT | awk ' | ||
| + | if [ " | ||
| + | RED=1 | ||
| + | LINE="& | ||
| + | elif [ " | ||
| + | LINE="& | ||
| + | else | ||
| + | RED=1 | ||
| + | LINE="& | ||
| + | fi | ||
| + | elif [ " | ||
| + | SIZE=$(echo $OUTPUT | awk ' | ||
| + | if [ " | ||
| + | YELLOW=1 | ||
| + | LINE="& | ||
| + | elif [ " | ||
| + | LINE="& | ||
| + | else | ||
| + | RED=1 | ||
| + | LINE="& | ||
| + | fi | ||
| + | fi | ||
| + | echo $LINE >> $MSG_FILE | ||
| + | done | ||
| + | } | ||
| + | |||
| + | $GREP -q ^HPACUCLI=1 $CONFIG_FILE | ||
| + | if [ $? -eq 0 ] ; then | ||
| + | use_hpacucli | ||
| + | fi | ||
| $GREP -q ^SMARTCTL=1 $CONFIG_FILE | $GREP -q ^SMARTCTL=1 $CONFIG_FILE | ||
| if [ $? -eq 0 ] ; then | if [ $? -eq 0 ] ; then | ||
| Line 480: | Line 487: | ||
| use_openmanage | use_openmanage | ||
| fi | fi | ||
| - | |||
| $GREP -q ^SENSOR=1 $CONFIG_FILE | $GREP -q ^SENSOR=1 $CONFIG_FILE | ||
| if [ $? -eq 0 ] ; then | if [ $? -eq 0 ] ; then | ||
| Line 503: | Line 509: | ||
| ===== To Do ===== | ===== To Do ===== | ||
| - | v0.5 | + | v0.6 |
| * To be independent of / | * To be independent of / | ||
| * Support for independant temperatures thresolds for each disk | * Support for independant temperatures thresolds for each disk | ||
| Line 532: | Line 538: | ||
| * **2013-06-27 v0.4** | * **2013-06-27 v0.4** | ||
| * Fix hddtemp output handling (print last field instead of field N) | * Fix hddtemp output handling (print last field instead of field N) | ||
| + | * **2013-09-27 v0.5** | ||
| + | * Add support for HP monitoring tool (hpacucli) | ||
| + | * **2022-07-13 v0.6** | ||
| + | * Add support for disks independent temperatures | ||
| + | </ | ||
| + | |||