123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- #!/bin/bash
- ################################################################
- # Global definitions for the script - change to fit your needs #
- ################################################################
- # Look for a process if a GroupWise MailTransferAgent (MTA) should be running (0 if no MTA is on the client, else set 1)
- gwMTA=1
- # Look for a process if a GroupWise PostOffice (POA) should be running (0 if no POA is on the client, else set 1)
- gwPOA=1
- # Look for a process if a GroupWise Internet Agent (GWIA) should be running (0 if no GWIA is on the client, else set 1)
- 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
- if [ $debug -eq 1 ]
- then
- echo "DEBUG:We found a gwMTA process ID: $gwMTAProcess"
- fi
- 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
- if [ $debug -eq 1 ]
- then
- echo "DEBUG:We found atleast one gwMTA listener: $gwMTAListener"
- fi
- echo "P \"Groupwise MTA\" status=1;;;1 GroupWise Mail Transfer Agent is running with PID: $gwMTAProcess and listening.\n $gwMTAListener"
- else
- if [ $debug -eq 1 ]
- then
- echo "DEBUG:We found no listeners for the gwMTA process with process ID: $gwMTAProcess"
- fi
- echo "P \"Groupwise MTA\" status=0.5;;;1GroupWise Mail Transfer Agent is running with PID: $gwMTAProcess but not listening."
- fi
- else
- if [ $debug -eq 1 ]
- then
- echo "DEBUG: gwMTA is enabled in config, but no processes could be found."
- fi
- echo "P \"GroupWise MTA\" status=0;;;1 GroupWise Mail Transfer Agemt process is not Running."
- fi
- else
- echo "DEBUG: gwMTA is not enabled in config, skipping."
- 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
- if [ $debug -eq 1 ]
- then
- echo "DEBUG:We found a gwPOA process ID: $gwPOAProcess"
- fi
- 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
- if [ $debug -eq 1 ]
- then
- echo "DEBUG:We found atleast one gwPOA listener: $gwPOAListener"
- fi
- echo "P \"Groupwise POA\" status=1;;;1 GroupWise Post Office Agent is running with PID: $gwPOAProcess and listening.\n $gwPOAListener"
- else
- if [ $debug -eq 1 ]
- then
- echo "DEBUG:We found no listeners for the gwPOA process with process ID: $gwPOAProcess"
- fi
- echo "P \"Groupwise POA\" status=0.5;;;1GroupWise Post Office Agent is running with PID: $gwPOAProcess but not listening."
- fi
- else
- if [ $debug -eq 1 ]
- then
- echo "DEBUG: gwPOA is enabled in config, but no processes could be found."
- fi
- 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
- 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
|