I wanted to create a simple monitoring page to get basic resource’s info about my servers. Most of the monitoring tools, need to install an agent on the server which will communicate the info to a central server with an interface. The main problem is, you need to install this agent on each server, dedicate a communication port for that…etc. I wanted to create my own agent as simple and as compatible with all systems (not separate agent depending on the client OS) and automatically push it on client (in case of upgrade or else…).
Agent
For the agent, I found the library psutils which retrieve most (all ?) info from a client. This library is, most of the time, already installed on all OS by default when python3 is installed.
The agent is pushed to the client (using ssh connection by keys or password) and execute. They can be run manually and show a dictionary with all the values.
The output is parsed to the server and show in a Flask interface.
Interface
A chart (using chartjs ) will trigger the node agent every second to show a chart for the last minute.
I decide not to stock values (maybe a next version ?) but I can easily imagine adding the values on a database, but it will consume more resources and need to trigger all agents all day long, and the purpose of this simple monitoring is not to use a lot of resources and libraries.
A simple bootstrap interface will show all the values retrieve by agent filter by nodes, to cards.
What next ?
For the moment, only the chart show dynamically the values (CPU, RAM and swap usage).
I will try to find an easy way to show them on real time.
I did some test in order to add an alerting system (by mail or SMS) but most of the time the CPU have many spikes and create false alarm. Without stocking the values, I can’t do an average, which is more revealing of an issue.
NB: since the article , I could manage to show values in real time
0 Comments