system that will enable health monitoring of webservers in the cloud
there are 2 tables:
every 60 seconds system monitor all servers url status by api request and store the status in table called monitorHistory (id , serverName , statusResponse , monitorTime , latincyTime)
It is possible using API to:
- create new servers
- edit a server
- delete a server
- display all servers (in servers table) and their current heallt status
- display detailts about specific webserver request history logs
install Node.js
clone the repository:
git clone
install dependencies:
- npm i express
- npm i axios
- npm i node-schedule
- npm i perf_hooks
- npm i env
create ".env" file in "backend1" folder and add process.env.MYSQL_PASSWORD :
process.env.MYSQL_HOST = '127.0.0.1' process.env.MYSQL_USER = 'root' process.env.MYSQL_PASSWORD = ' ' process.env.MYSQL_DB = 'server_monitoring'
create 2 table in mysql:
""" CREATE DATABASE server_monitoring; USE server_monitoring;
CREATE TABLE servers ( serverName VARCHAR(255) PRIMARY KEY NOT NULL, urlServer TEXT NOT NULL, statusServer VARCHAR(255) NOT NULL, healthly integer DEFAULT 0, unHealthly integer DEFAULT 0, lastMonitor TIMESTAMP NOT NULL DEFAULT NOW() );
CREATE TABLE monitorHistory ( id integer PRIMARY KEY AUTO_INCREMENT, serverName VARCHAR(255) NOT NULL, statusResponse integer NOT NULL, monitorTime TIMESTAMP NOT NULL DEFAULT NOW() );
"""
also in schema.sql file
finnaly run coomand in terminal :
npm run dev
** There are thunder collection file, using this file you can create api requests.
Dashboard page (list of all server monitoring and logs in real time)