roger-russel / beholder-web-client
A simple php monitoring client
Installs: 1 041
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 1
Forks: 1
Open Issues: 14
Type:system
Requires
- php: >=5.5
Requires (Dev)
- codeception/c3: ^2.0
- codeception/codeception: ^2.3
Suggests
- yaml: Needed to support Yaml configuration file.
This package is auto-updated.
Last update: 2024-11-17 09:59:41 UTC
README
Beholder is a simple php monitoring system, this client is made to serve a json response with the current stats of what is been monitored.
This client can be used with Zabbix and others tools, just setup those to read the json file which this client give.
Dependencies
- PHP:5.6, why? For compatibility.
- Composer
- Lib Yaml, required only if you use it. See more here. here.
Some modules could have more dependencies, please look at src/Eyes/ModuleName/Readme.md too.
How Install
Use the command below to add the dependencies inside the composer.json file:
$ composer require roger-russel/beholder-web-client;
How to use
You can look at a especific model configuration in doc/ModelName folder.
require 'vendor/autoload.php';
$conf = [
'eyes' => [
'DB' => [ // This DB is just an alias, it can be anything
'type' => 'Db\MySQL', // Model wich will be used, this will be usage Db\Mysql Model.
// 'driver' => 'PDO', // If this option is not setted it will try to use one on this order: PDO, mysqli or mysql. If setted it will force to use it.
'host' => 'beholder-test-mysql',
'user' => 'root',
'password' => 'initial1234',
// 'port' => 3306, // If not setted it will use the default port 3306
'dbname' => 'beholder_test',
'querys' => [ // Query that will runned on a test, it will be executed into the following order: CREATE, INSERT, UPDATE, SELECT and DROP.
'select' => 'select name from user limit 1'
]
]
]
];
$beholder = new BeholderWebClient\Observer($conf);
$beholder->run();
How to Contribute
Contribute is easy. Make a fork and start to code, then do a pull request.
You can contribute not just in code, you can make a bug report, a issue asking for a feature or simply giving your suggestion.
How to run locally
With docker is easy and fun!
- Create a docker network
$ docker network create --driver bridge beholder-network
- Build the project and run the container
$ docker-compose build
$ docker-compose up
- Enter the container and run composer to install the dependencies
$ docker exec -it beholder-web-client bash
$ composer install
Or the one liner command:
$ docker exec -it beholder-web-client composer install
To run the codeception tests
With the docker container running do the following:
$ docker exec -it beholder-web-client bash
$ codecept run
Or the one liner command:
$ docker exec -it beholder-web-client codecept run
You can run especific tests like the following:
$ codecept run nfs
$ codecept run unit
If you want to run a mysql test, first you need to start the docker mysql container inside tests/mysql/ folder. Then run the following command:
$ codecept run mysql
License
Apache 2.0 Copyright 2017 Roger Russel, and Alan Yoshida