
What type of script is this?
This is a generic shell script with wget, curl and awk commands to monitor and notify the health of web servers and services. It monitors to check whether resources are UP, DOWN or SLOW. Keeps track of status changes and notifies whenever there is a change in state.
Sites and services of WSO2 servers are used in its configurations to demonstrate use with WSO2 servers.
What are its features?
- Customizable Sites and Services to monitor:
- Monitors any HTTP or HTTPS URL, checking for “200” status return codes.
- Monitors Web-services based on codes in response (for checking Admin service of WSO2 server, it is checking for RUNNING code in xml response)
- Can be applied to monitor multiple sites/services (not just WSO2 middleware but for other web/application servers)
- Checks request fulfilment time for slow responses, not just UP/DOWN
- Sends email notification on state change (UP, SLOW, or DOWN)
- Customizable To/From mail notification settings
- Customizable SLOW latency threshold
- Tracks previous state change and current state to avoid multiple notifications
- Uses single text file for data storage, no DB necessary (configurable to have separate status files for Services and Sites)
- No agents or special software to install
Helping you to select and design your Enterprise API Management platform
Download nowHow to use this script?
Download or clone this source code (https://bitbucket.org/vinaysbitbucket/healthcheckforsitesnservices/src/master/). Make config changes in this script to customize list of servers and services you want to monitor. Once ready, it can be run from terminal for ad-hoc health check or as a cron job to run periodically at fixed time intervals.
Here is sample Email content/Script Output for state changes of Servers/Services:
Time: 2018-06-28 00:07:56Site: https://localhost:9543/console/
Status: DOWNLatency: 0 secPrevious status: UPPrevious change: 2018-06-28 00:06:01 Time: 2018-06-28 00:07:56Service: https://localhost:9443/services/ServerAdmin
Status: SLOWLatency: 15 secPrevious status: UPPrevious change: 2018-06-28 00:06:02
I hope this is of help. Please don’t hesitate to ask your questions. I’m more than happy to help.