Commit Graph

40 Commits

Author SHA1 Message Date
265128d725
Update known paths in 404 error template based on available routes
- Adjusted handling of known paths to dynamically include additional routes if a specific directory exists, enhancing user experience.
2024-06-14 20:49:33 +02:00
f3513ea80e
Update script path in shell_exec command
Changed the script path in the shell_exec command to include a forward slash before 'script.php' for correct execution.
2024-06-14 20:31:09 +02:00
8af61f97b0
Added /config endpoint and link in 404 page
The update includes the addition of a new '/config' endpoint in index.php, which returns the application's configuration as a JSON response. A corresponding link to this new endpoint has also been added to the 404 error page.
2024-06-13 17:43:32 +02:00
f75be1fcaf
Added git installation and version endpoint
In the Dockerfile, a new command has been added to install git. This allows for more flexibility in managing code versions within the container. In addition, a new endpoint '/version' has been introduced in index.php which returns JSON data about the last commit, its timestamp and the current branch. This provides an easy way to check versioning information directly from the application.
2024-06-13 17:42:18 +02:00
f06c804c24
Updated response handling and added 404 page
The code changes include an update to the response handling in index.php. Now, it checks if the request URI is '/metrics'. If so, it continues with the previous behavior of executing a script and outputting its result. If not, it loads a new 404 error page using Twig templating engine.

A new file '404.twig' has been added under templates directory which serves as a custom 404 error page. It displays the requested URI and provides a link back to '/metrics'.
2024-06-13 16:03:44 +02:00
f7f3cb9704
Refactored script for better readability
The code has been refactored to improve readability and maintainability. The main changes include removing unnecessary condition checks, simplifying the flow of control, and reorganizing the code blocks for better logical grouping. This should make it easier to understand and modify in the future.
2024-06-13 15:52:08 +02:00
b52abb69c7
Updated script execution path
The shell_exec command in index.php has been updated to include the document root in the script path. This change ensures that the correct script is executed regardless of the current working directory.
2024-06-13 14:33:48 +02:00
e4d78e054b
Updated Twig cache directory name
The cache directory name for the Twig environment has been updated. The previous hyphen-separated name 'twig-cache' has been replaced with an underscore-separated one, 'twig_cache'. This change ensures consistency in naming conventions across the project.
2024-06-13 14:32:50 +02:00
0f50e874d4
Added Dockerfile for PHP with Apache
This commit introduces a new Dockerfile that sets up a PHP 8.3 environment with Apache. It includes the following significant changes:
- Sets the working directory to /var/www/html
- Copies current directory contents into the container
- Installs Composer and activates mod_rewrite
- Installs Process Control extension using curl command
- Runs composer install to fetch dependencies
- Exposes port 9050 and modifies Apache configuration to listen on this port
- Adds environment variables to Apache configuration 
- Changes ownership of /var/www/html to www-data user 
- Starts the Apache server using apache2-foreground command
2024-06-13 13:42:19 +02:00
f367958d69
Introduced .htaccess file and refactored index.php
A new .htaccess file has been added to handle URL rewriting. The index.php file has been significantly refactored for improved readability and performance. A large portion of the original code was moved to a separate script.php file, which is now executed from within index.php. This change simplifies the main entry point of the application and separates concerns more effectively. Additionally, minor changes were made to cache handling in script.php.
2024-06-13 13:41:31 +02:00
3021ec4436
Added newline for better readability in metrics template
A newline has been added to the metrics.twig template to improve code readability. This change separates different sections of the code, making it easier to understand and maintain.
2024-06-13 13:40:35 +02:00
aa6d231ead
Add parallel processing for HTTP requests and handle fallback values
- Implement parallel processing using pcntl_fork for HTTP requests
- Handle different types of HTTP data retrieval and response codes
- Set fallback values if necessary based on configuration
2024-06-05 22:13:05 +02:00
09bba2a0c3
Update metrics configuration with new CPU, memory, disk usage, website status, and HTTP request count metrics. Add submetrics for detailed monitoring. 2024-06-05 08:33:35 +02:00
8ac31b0092
Update gitignore to exclude config files, refactor index.php for dynamic configuration file loading and caching. 2024-06-05 08:33:29 +02:00
2ffac2254c
Update metric type based on definition, add detailed description
- Update metric type based on definition
- Add detailed description for metric type if defined
2024-06-05 08:33:24 +02:00
81255d0b27
Update handling of submetric values in index.php
Refactor condition to set submetric value based on fallback.
2024-06-04 19:39:08 +02:00
8d0959b21c
Refactor fallback logic for submetrics
- Updated condition to check maxage existence before comparison.
2024-06-04 16:59:23 +02:00
9707a3cfb9
Add check for empty array before accessing elements.
- Added a condition to check for an empty array before accessing its elements in the getArrayValue function. This prevents potential errors when trying to access values from an empty array.
2024-06-04 16:51:05 +02:00
dcf62d3865
Add metrics_cache.json to gitignore and implement cache fallback logic
The commit adds metrics_cache.json to .gitignore and implements cache fallback logic in index.php for handling metric values.
2024-06-04 16:50:53 +02:00
fd8a67c23c
Refactor conditional logic for response handling
- Adjusted code to handle different scenarios when processing responses.
2024-06-04 13:22:16 +02:00
439d658d14
Refactor error handling for command execution
- Added try-catch block to handle exceptions during command execution.
2024-06-04 13:20:43 +02:00
e004a1002e
Refactor handling of HTTP response data
- Added condition to check status code for response body
- Updated logic for determining presence of response
2024-06-04 07:06:40 +02:00
069e550a3f
Refactor metric retrieval and display
Improved handling of submetrics for better data organization and presentation. Updated metric values based on retrieved data, ensuring accurate representation in the metrics template file.
2024-06-03 23:47:40 +02:00
41f2ddea37
Reorder conditional for CLI check, then URI comparison.
- Reordered the condition to first check for CLI mode before URI comparison.
2024-06-03 23:41:42 +02:00
24f1f6c974
Add content type header for metrics endpoint
Set the Content-Type header to 'text/plain; version=0.0.4' for the '/metrics' endpoint and CLI requests.
2024-06-03 19:48:39 +02:00
6f26907181
Adjust handling of boolean values in metrics output
Ensure boolean values are converted to integers for consistency.
2024-06-03 19:48:39 +02:00
aea6873ed8
Refactor error handling for GuzzleException
- Refactored error handling to check for response in exception.
2024-06-03 19:48:39 +02:00
aa1ee0cc11
Update metric data retrieval configurations with additional details and proxy server setting. 2024-06-03 19:48:39 +02:00
48f121c759
Refactor metric configurations for HTTP requests
- Restructured config to include 'http' with url and data fields for each metric. Added metrics 3 and 4 with specific data outputs.
2024-06-03 19:48:39 +02:00
51ab7bcde6
Refactor HTTP request handling for response status check
- Added try-catch block to handle GuzzleException
- Updated logic to check for response status before processing
2024-06-03 19:48:39 +02:00
201c935330
Refactor HTTP request handling and data extraction
- Improved handling of HTTP requests and extraction of response data.
2024-06-03 19:48:39 +02:00
66933d7d19
Update URI check to include CLI request detection.
The code now checks if the request URI is '/metrics' or if the PHP script is running from the command line interface (CLI). This change allows for proper handling of CLI requests in addition to web requests.
2024-06-03 19:48:39 +02:00
7c61ead8ac
Refactor HTTP handling, update Guzzle requests and Twig config.
- Refactored HTTP handling to use nested arrays for options
- Updated Guzzle requests based on new array structure
- Adjusted Twig cache configuration in the code
2024-06-03 19:48:39 +02:00
638e6d9346
Refactor Guzzle HTTP requests for flexibility and proxy support
Restructured Guzzle HTTP requests to allow for additional options like proxy support, enhancing flexibility in handling different types of requests.
2024-06-03 19:48:39 +02:00
a726fa024c
Add handling for HTTP response time metric using GuzzleHttp. 2024-06-03 19:48:39 +02:00
d0fa8a6a99
Update handling of value assignment when 'jsonelem' is not set.
- Adjusted code to assign $output directly to 'value' if 'jsonelem' is not set.
2024-06-03 19:48:39 +02:00
7aef1769d9
Added readme and licence 2024-06-03 19:48:39 +02:00
418b170bc6
Added example configurion 2024-06-03 19:48:39 +02:00
5d76b42c23
Added the first code 2024-06-03 19:48:39 +02:00
6a9976f082
Initial commit 2024-06-03 19:48:39 +02:00