info@yenlo.com
eng
Menu
Uncategorized 2 min

Basic health check script for Web Servers and Services

Vinay Babu Yella
Vinay Babu Yella
Solution Architect
Basic health check script for Web Servers and Services

health check for web servers and services There are tools available to monitor the status of web servers and services, for e.g.: Nagios and SolarWinds. These tools need to be installed and configured to start monitoring/reporting and they provide many advanced features to monitor things in your IT. But if you are looking for simple solution for basic health check of your web resources without having to install special software or its agents, then this script helps you to get the job done.

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
wp advanced api management guide
Whitepaper Advanced API Management guide

Helping you to select and design your Enterprise API Management platform

Download now

How 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:56
Site: https://localhost:9543/console/
Status: DOWN

Latency: 0 sec
Previous status: UP
Previous change: 2018-06-28 00:06:01
Time: 2018-06-28 00:07:56
Service: https://localhost:9443/services/ServerAdmin
Status: SLOW

Latency: 15 sec
Previous status: UP
Previous 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.

connext platform enables brainbay
Client Case Brainbay

Connext enables securely data sharing

Download now

Yenlo is the leading, global, multi-technology integration specialist in the field of API-management, Integration technology and Identity Management. Known for our strong focus on best-of-breed hybrid and cloud-based iPaaS technologies. Yenlo is the product leader and multi-award winner in WSO2, Boomi, MuleSoft and Microsoft Azure technologies and offers best-of-breed solutions from multiple leading integration vendors.

With over 240+ experts in the API, integration, and Identity Access Management domain and over $35 million in annual revenue, Yenlo is one of the largest and best API-first and Cloud-first integration specialists worldwide.

eng
Close