#!/bin/bash ################################################################ # Global definitions for the script - change to fit your needs # ################################################################ # process to find when loaded via java for the AdminService of GroupWise #gwAdminService=1 # process to look for if a GroupWise MailTransferAgent (MTA) is running (leave blank if no MTA is on the client) gwMTA=1 # process to look for if a GroupWise PostOffice (POA) is running (leave blank if no POA is on the client) gwPOA=1 # process to look for if a GroupWise Internet Agent (GWIA) is running (leave blank if no GWIA is on the client) gwIA=1 # Debug switch for development purposes ( 0 for no debug, 1 for debug information ) debug=0 ######################################################################### # DO NOT CHANGE BELOW UNLESS YOU ARE EXACTLY KNOW WHAT YOU ARE DOING # ######################################################################### if [ $gwMTA -eq 1 ] then if [ $debug -eq 1 ] then echo "DEBUG: gwMTA is enabled in config, checking for the process." fi gwMTAProcess=$(ps -ef | grep "gwmta" | grep -v grep | awk '{print $2}') if [ ! -z "$gwMTAProcess" ] then gwMTAListener=$(ss -lpn | grep $gwMTAProcess |awk '{print $5}' | grep -E '^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'| sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g') if [ ! -z "$gwMTAListener" ] then echo "P \"Groupwise MTA\" status=1;;;1 GroupWise Mail Transfer Agent is running with PID: $gwMTAProcess and listening.\n $gwMTAListener" else echo "P \"Groupwise MTA\" status=0.5;;;1GroupWise Mail Transfer Agent is running with PID: $gwMTAProcess but not listening." fi else echo "P \"GroupWise MTA\" status=0;;;1 GroupWise Mail Transfer Agemt process is not Running." fi fi if [ $gwPOA -eq 1 ] then if [ $debug -eq 1 ] then echo "DEBUG: gwPOA is enabled in config, checking for the process." fi gwPOAProcess=$(ps -ef | grep "gwpoa" | grep -v grep | awk '{print $2}') if [ ! -z "$gwPOAProcess" ] then gwPOAListener=$(ss -lpn | grep $gwPOAProcess |awk '{print $5}' | grep -E '^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | sort -u | sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g' ) if [ ! -z "$gwPOAListener" ] then echo "P \"Groupwise POA\" status=1;;;1 GroupWise Post Office Agent is running with PID: $gwPOAProcess and listening.\n $gwPOAListener" else echo "P \"Groupwise POA\" status=0.5;;;1GroupWise Post Office Agent is running with PID: $gwPOAProcess but not listening." fi else echo "P \"GroupWise POA\" status=0;;;1 GroupWise Post Office Agemt process is not Running." fi fi if [ $gwIA -eq 1 ] then if [ $debug -eq 1 ] then echo "DEBUG: gwIA is enabled in config, checking for the process." fi gwIAProcess=$(ps -ef | grep "gwia" | grep -v grep | awk '{print $2}') if [ ! -z "$gwIAProcess" ] then # echo "P \"Groupwise GWIA\" status=1;;;1 GroupWise Internet Agent process is running with PID: $gwIAProcess" gwIAListener=$(ss -lpn | grep $gwIAProcess |awk '{print $5}' | grep -E '^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | sort -u | sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g') if [ ! -z "$gwIAListener" ] then echo "P \"Groupwise GWIA\" status=1;;;1 GroupWise Internet Agent is running with PID: $gwIAProcess and listening.\n $gwIAListener" else echo "P \"Groupwise GWIA\" status=0.5;;;1 GroupWise Internet Agent is running with PID: $gwIAProcess but not listening." fi else echo "P \"GroupWise GWIA\" status=0;;;1 GroupWise Internet Agemt process is not Running." fi fi gwAdminProcess=$(ps -ef | grep gwadmin.jar | grep -v grep | awk '{print $2}') if [ ! -z "$gwAdminProcess" ] then echo "P \"Groupwise AdminService\" count=1;;;1 GroupWise AdminService process is running with PID: $gwAdminProcess" else echo "P \"GroupWise AdninService\" count=0;;;1 GroupWise AdminService process is not Running." fi