#!/bin/bash ################################################################################ # # # Copyright (C) 2011 Jack-Benny Persson # # # # This program is free software; you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # # the Free Software Foundation; either version 2 of the License, or # # (at your option) any later version. # # # # This program is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with this program; if not, write to the Free Software # # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # # ################################################################################ ############################################################################### # # # Nagios plugin to monitor CPU and M/B temperature with sensors. # # Written in Bash (and uses sed & awk). # # Latest version of check_temp can be found at the below URL: # # https://github.com/jackbenny/check_temp # # # # If you are having problems getting it to work, check the instructions in # # the README first. It walks you though install lm-sensors and getting it to # # display sensor data. # # # ############################################################################### VERSION="Version 0.93" AUTHOR="(c) 2011 Jack-Benny Persson (jack-benny@cyberinfo.se)" # Sensor program SENSORPROG=$(whereis -b -B /{bin,sbin,usr,etc} /{bin,sbin,usr,etc}/* -f sensors | awk '{print $2}') # Ryan's note: utils.sh is installed with nagios-plugins in with the plugins # Check if utils.sh exists. This lets you use check_domain in a testing environment # or outside of Nagios. if [ -e "$PROGPATH/utils.sh" ]; then . "$PROGPATH/utils.sh" else STATE_OK=0 STATE_WARNING=1 STATE_CRITICAL=2 STATE_UNKNOWN=3 # STATE_DEPENDENT=4 (Commented because it's unused.) fi shopt -s extglob #### Functions #### # Print version information print_version() { echo "$0 - $VERSION" } #Print help information print_help() { print_version echo "$AUTHOR" echo "Monitor temperature with the use of sensors" /bin/cat <