#!/bin/bash ### check_snmp_citrix # Citrix-Server Checks via SNMP # OID's available through snmp4ctx package (http://www.wtcs.org/snmp4tpc/snmp4ctx.htm) # Version 0.1, Copyright (c) 2008 by Michael Boehm # # TODO: implement warning and critical values (doesn't matter yet) ### ### License Information: # 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 (or with Nagios); if not, write to the # Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA ### if [ "$1" = "help" ]; then echo -e "\nCitrix-Server Checks via SNMP"; echo -e "OID's available through snmp4ctx package (http://www.wtcs.org/snmp4tpc/snmp4ctx.htm)"; echo -e "Version 0.1, Copyright (c) 2008 by Michael Boehm \nLast Modified: 2008-06-04\n"; echo -e "--------------------------------------------------"; echo -e "Usage: ./check_snmp_citrix "; echo -e "--------------------------------------------------\n"; echo -e "\t\tHostname or IP Address"; echo -e "\tthe snmp community string"; echo -e "\t\tpossible values are:"; echo -e "\t\tWFActive\t- User logged on to WinStation"; echo -e "\t\tWFConnected\t- WinStation connected to client"; echo -e "\t\tWFConnectQuery\t- Sessions in the process of connecting to client"; echo -e "\t\tWFShadow\t- Shadowing another WinStation"; echo -e "\t\tWFDisconnected\t- WinStation logged on without client"; echo -e "\t\tWFIdle\t\t- Waiting for client to connect"; echo -e "\t\tWFListen\t- WinStation listening for connection"; echo -e "\t\tWFReset\t\t- WinStation being reset"; echo -e "\t\tWFDown\t\t- WinStation down due to error"; echo -e "\t\tWFInit\t\t- WinStation initialization\n" && exit 0; fi if [ ! "$#" -gt "2" ]; then echo -e "\nWarning: Not enough command line arguments.\n"; echo -e "Citrix-Server Checks via SNMP"; echo -e "OID's available through snmp4ctx package (http://www.wtcs.org/snmp4tpc/snmp4ctx.htm)"; echo -e "Version 0.1, Copyright (c) 2008 by Michael Boehm \nLast Modified: 2008-06-04\n"; echo -e "--------------------------------------------------"; echo -e "Usage: ./check_snmp_citrix \n or just \nUsage: ./check_snmp_citrix help"; echo -e "--------------------------------------------------\n" && exit 3; fi HOST=$1 SNMPSTRING=$2 VALUE=$3 #check WFActive if [ $VALUE = WFActive ]; then WFActive=$(snmpget -v2c -c $SNMPSTRING $HOST 1.3.6.1.4.1.9827.1.1.1.1.0 | awk '{print $4}') ECHO="USERS OK - $WFActive users currently logged in |User=$WFActive;;;"; EXIT=0; #check WFConnected elif [ $VALUE = WFConnected ]; then WFConnected=$(snmpget -v2c -c $SNMPSTRING $HOST 1.3.6.1.4.1.9827.1.1.1.2.0 | awk '{print $4}') ECHO="WFConnected OK - $WFConnected WinStation connected to client |connected=$WFConnected;;;"; EXIT=0; #check WFConnectQuery elif [ $VALUE = WFConnectQuery ]; then WFConnectQuery=$(snmpget -v2c -c $SNMPSTRING $HOST 1.3.6.1.4.1.9827.1.1.1.3.0 | awk '{print $4}') ECHO="WFConnectQuery OK - $WFConnectQuery Sessions in the process of connecting to client |connectquery=$WFConnectQuery;;;"; EXIT=0; #check WFShadow elif [ $VALUE = WFShadow ]; then WFShadow=$(snmpget -v2c -c $SNMPSTRING $HOST 1.3.6.1.4.1.9827.1.1.1.4.0 | awk '{print $4}') ECHO="WFShadow OK - $WFShadow Shadowing another WinStation |shadow=$WFShadow;;;"; EXIT=0; #check WFDisconnected elif [ $VALUE = WFDisconnected ]; then WFDisconnected=$(snmpget -v2c -c $SNMPSTRING $HOST 1.3.6.1.4.1.9827.1.1.1.5.0 | awk '{print $4}') ECHO="WFDisconnected OK - $WFDisconnected WinStation logged on without client |disconnected=$WFDisconnected;;;"; EXIT=0; #check WFIdle elif [ $VALUE = WFIdle ]; then WFIdle=$(snmpget -v2c -c $SNMPSTRING $HOST 1.3.6.1.4.1.9827.1.1.1.6.0 | awk '{print $4}') ECHO="WFIdle OK - $WFIdle Waiting for client to connect |idle=$WFIdle;;;"; EXIT=0; #check WFListen elif [ $VALUE = WFListen ]; then WFListen=$(snmpget -v2c -c $SNMPSTRING $HOST 1.3.6.1.4.1.9827.1.1.1.7.0 | awk '{print $4}') ECHO="WFListen OK - $WFListen WinStation listening for connection |listen=$WFListen;;;"; EXIT=0; #check WFReset elif [ $VALUE = WFReset ]; then WFReset=$(snmpget -v2c -c $SNMPSTRING $HOST 1.3.6.1.4.1.9827.1.1.1.8.0 | awk '{print $4}') ECHO="WFReset OK - $WFReset WinStation being reset |reset=$WFReset;;;"; EXIT=0; #check WFDown elif [ $VALUE = WFDown ]; then WFDown=$(snmpget -v2c -c $SNMPSTRING $HOST 1.3.6.1.4.1.9827.1.1.1.9.0 | awk '{print $4}') ECHO="WFDown OK - $WFDown WinStation down due to error|down=$WFDown;;;"; EXIT=0; #check WFInit elif [ $VALUE = WFInit ]; then WFInit=$(snmpget -v2c -c $SNMPSTRING $HOST 1.3.6.1.4.1.9827.1.1.1.10.0 | awk '{print $4}') ECHO="WFInit OK - $WFInit WinStation initialization|init=$WFInit;;;"; EXIT=0; else echo "Unknown Value"; exit 2 fi echo $ECHO exit $EXIT