- Notifications
You must be signed in to change notification settings - Fork1
Multithreaded TCP/UDP server monitors system status: CPU load, RAM usage, disk space used and available network interfaces.
License
NotificationsYou must be signed in to change notification settings
malykhin-sergei/System-monitoring-server
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Multithreaded TCP/UDP server monitors system status: CPU load, RAM usage, disk space used and available network interfaces.
At client's request - messagereport
, in response the server gives the description of the current state of the system inJSON format.
Example of server response:
{"CPU, %": [11,11,13,9,8],"RAM": {"Total":3908840,"Free":232132,"Available":1505048,"Buffers":169024,"Cached":1506540,"Total swap":2097148,"Free swap":2087676,"Unit":"kB"},"Storage": [{"Filesystem":"/dev/sda5","Mount Point":"/","Total":30507428,"Free":26878422,"Available":25317974,"Block size, kB":4}, {"Filesystem":"/dev/sda1","Mount Point":"/boot/efi","Total":130812,"Free":130811,"Available":130811,"Block size, kB":4}],"Network": [{"Interface":"lo","IP":"127.0.0.1"}, {"Interface":"wlp2s0","IP":"192.168.41.193"}],"Time":"Wed Oct 7 10:32:17 2020"}
- happycoders-libsocket-dev - Generic C++ library implementing Udp/Tcp socket interface - development files
- libjansson-dev - C library for encoding, decoding and manipulating JSON data (dev)
cd ./server/makecd ./client/make
On server side:
$ ./server Usage: ./server<TCP/UDP><port><max_connections>$ ./server TCP 10000 10Using TCP on port 10000 with no more than 10 clientsNew TCP connection accepted: now there are 1 clientsClient 1 stops observation
On client side:
$ ./clientUsage: ./client host port time_lag$ ./client 127.0.0.1 10000 1Total usage of 4 CPUs: 5%, Memory: 1937.8 MB used, 1879.4 MB freeTotal usage of 4 CPUs: 6%, Memory: 1935.9 MB used, 1881.4 MB freeTotal usage of 4 CPUs: 5%, Memory: 1935.8 MB used, 1881.4 MB freeTotal usage of 4 CPUs: 6%, Memory: 1935.8 MB used, 1881.4 MB free^C$
The code is based on theHarry Wong template (RedAndBlueEraser).
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Use at your own risk.
This project is licensed under the MIT License - see the LICENSE file fordetails.
Sergei Malykhin,s.e.malykhin@gmail.com