Using this library you can get details on your sensors , create charts and more
Add this package to your composer.json
:
"require": {
"satrobit/prtg-php": "dev-master"
}
or by command line :
composer require satrobit/prtg-php
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:
This method returns details of a specified sensor
Parameters:
Name | Type | Description |
---|---|---|
sensorId | int | Sensor ID in PRTG |
Example:
$sensorDetails = $client->getsensordetails(2017);
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);
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);
Check out examples.php .
This project is released under the MIT License.