satrobit / prtg-php
PHP API Wrapper for PRTG
dev-master
2021-08-25 17:14 UTC
Requires
- php: >=5.6.0
This package is not auto-updated.
Last update: 2024-04-19 18:58:09 UTC
README
Using this library you can get details on your sensors , create charts and more
Install
Using Composer
Add this package to your composer.json
:
"require": { "satrobit/prtg-php": "dev-master" }
or by command line :
composer require satrobit/prtg-php
Usage
You need to construct a client first.
$client = new prtg(SERVER, USERNAME, PASSWORD);
like this:
$client = new prtg('https://prtg.paessler.com/', 'demo', 'demo');
Now you can use these methods to interact with the API:
Method: getsensordetails
This method returns details of a specified sensor
Parameters:
Name | Type | Description |
---|---|---|
sensorId | int | Sensor ID in PRTG |
Example:
$sensorDetails = $client->getsensordetails(2017);
Method: historicdata
This method returns historic data on a specified sensor
Parameters:
Name | Type | Description |
---|---|---|
sensorId | int | Sensor ID in PRTG |
sdate | string | Starting date |
edate | string | Ending date |
avg | int | Average |
Example:
$historicData = $client->historicdata('2017', '2017-07-26', '2017-07-27', 15);
Method: chart
This method returns a chart of a specified sensor
Parameters:
Name | Type | Description |
---|---|---|
sensorId | int | Sensor ID in PRTG |
sdate | string | Starting date |
edate | string | Ending date |
graphid | int | Graph ID |
type | string | Returned object type like svg, png |
avg | int | Average |
height | int | Height of the chart (px) |
width | int | Width of the chart (px) |
Example:
$chart = $client->chart(2017, '2017-07-26', '2017-07-27', 2, 'svg', 15, 270, 850);
Examples
Check out examples.php .
License
This project is released under the MIT License.