Monitoring Web Servers And Resources

What do you mean by web server/resource monitoring?

Creating web applications and websites are fairly easy, but to keep them running and updated isn't so easy task especially for those who are running their own server at home or on cloud service providers like Amazon AWS, DigitalOcean Droplets or any kind of VPS service, etc. DevOps are required to maintain all business services and applications running smoothly and accessible 24x7. 

You may never know which component of your web server is failing or malfunctioning which includes your hardware as well as software. It may also happen that a hacker breached your web server security and might use it for a DDOS attack on some other web servers using your hardware and network resources. These breaches maybe not be identified immediately but its effects can be seen at times in your server's computational performance and network usage, which can also add stress to your financial bills. So to be updated about all the components in use in your server at all times you may need to monitor them periodically.

How to monitor web server/resource?

Amazon AWS provides monitoring service called Amazon CloudWatch which offers free tier version with 3 dashboards and 50 metrics to be set on alert which is great for most websites but offer basic features to be monitored. Any custom or advanced metrics will definitely cost you according to their pricing. DigitalOcean also provides basic monitoring for free but offers very limited functionality and monitoring and is only hardware oriented. There are more paid tools to do the same. Why buy when you can build one for free? There are some well-recognized names in this domain too.

Grafana is an open source software for time series analytics and monitoring. It offers to monitor resources in real-time as well as save metrics in form of dashboards which can be used to keep a check on vital components at your fingertips. It also lets you add alerts via email on metrics and set a threshold on which you would be liked to be alerted. You have the ability to customize dashboards and install plugins which suit your need. Data can be aggregated from various sources like Amazon CloudWatch, InfluxDB, Graphite, etc.

For people who hate configuration, or need faster monitoring solutions, I have created an Ansible automation playbook to do the same. It will install Grafana with Graphite as its data source and serve the monitoring website over free SSL via Let's Encrypt. The script will work for installing on any Debian distribution and even Raspberry Pi 2B/3. You just need to configure one file and start the installation. Sit back and have a cup of coffee till the installation is finished. Click here for the Github repository. Feel free to fork the repository and raise pull request for fixes and new features.