RestAPI for library switcher-core based on roadrunner.
List of supported devices here
- Automate detect device vendor and model
- Prometheus metrics
- Batch calling
- Use docker-compose file
Create file docker-compose.yml
with content
version: '2'
services:
switcher-core-api:
image: meklis/switcher-core-api
ports:
- 5990:5990 # HTTP RestAPI port
- 127.0.0.1:2112:2112 # prometheus metrics
volumes:
- ./logs:/app/logs
Start command docker-compose up -d
For native install you must use php >=7.4 with dependencies (see here), git, composer
After installing all dependencies run commands:
git clone https://github.com/meklis/switcher-core-api
cd switcher-core-api
composer install
sudo ./vendor/bin/rr get -l /usr/local/bin/roadrunner
Whats next?
You can run server use command roadrunner serve -c </path/to/.rr.yaml>
Recomenation: configure running server as deamon
See examples of API in postman documenter
URL: http://127.0.0.1:2112/metrics
Custom metrics:
# HELP calling_devices_counter Information about calling devices
# TYPE calling_devices_counter counter
calling_devices_counter{ip="10.1.1.11",module="fdb",status="success"} 2
calling_devices_counter{ip="10.1.1.11",module="non_existed_module",status="failed"} 1
calling_devices_counter{ip="10.1.1.11",module="system",status="success"} 3
# HELP calling_devices_duration Spent time from device calling
# TYPE calling_devices_duration counter
calling_devices_duration{ip="10.1.1.11",module="fdb",status="success"} 1.4123849868774414
calling_devices_duration{ip="10.1.1.11",module="non_existed_module",status="failed"} 0.028479814529418945
calling_devices_duration{ip="10.1.1.11",module="system",status="success"} 0.4323270320892334
- PHP
- Slim framework
- roadrunner
- composer
- sockets
- yaml
- opcache
- snmp
- zip
- curl
- mbstring
- json