Web application for monitoring HTTP webpages made by Pavel Arefyev.
The program is done entirely in C++. However, GitHub sees it as in C, because there is C-library source code included in the project.
Usage is implemented as a docker image. Detailed information can be found on DockerHub.
- Read the command line arguments
- Start HTTP sever on http://localhost:8000/
- Upload the configuration
- Start making requests, update logs and HTML page on the server
Web Monitor can be accessed on http://localhost:8000/ by default. It is dynamically-updated HTML page, that includes time of the last checking sequence, URL, page status and response time.
Logs are saved into "weblist.log" file. It includes time of the last checking sequence, URL, page status and response time.
Each checking sequence is separated by one line.
Configuration file should be written in the following format:
URL;Content condition
http://example.com/;Hello World!
Testing configuration file can be found in the repository under name testdata.cfg
All details can be found in the code comments. The article below shortly describes the main design solutions used in this project.
Requested pages interfaces are implemented with WebPage and WebList classes.
WebPage provides functionality to make the request, using ASIO library of BOOST package, as well as parse URL and check if the requested content is present.
Instances are updated using setters and getters.
WebList stores WebPage objects. It can save all the objects to log file, html page, as well as send requests to each of the pages.
Classes are related with the association principle.
Server is implemented using Mongoose C-based library. The library is included in the source.
Server is hosted on http://localhost:8000/ by default.
Server interface is represented by Server class. It is run in the background thread of the main process.
The program must be executed as following from the command line:
./program.cpp CONF_FILE_ARGUMENT CHECKING_TIME
The checking time is 30 by default. Range of the checking time is [30;86400] in seconds.
The default configuration file is set to testdata.cfg.
In order to use the source code, Boost library must be installed to your IDE. Installation guide (Taken from Thomas Kin educational YouTube channel).
The path must not include non-ASCII characters.
- Decrease additional delays by redesigning the order in checkAll() member function of WebList class.
- Change the parsing of command line options to fit the modern designs
- Clear log file depending on the file size
Mongoose C-based library: https://github.com/cesanta/mongoose
Mongoose HTTP-server C-example: https://github.com/cesanta/mongoose/tree/master/examples/http-server
Boost Extension Website: https://www.boost.org/
ASIO Networking Tutorial: https://www.youtube.com/watch?v=2hNdkYInj4g&ab_channel=javidx9
Pavel Arefyev, Feb 2021