PHP code example of ocolin / easymt

1. Go to this page and download the library: Download ocolin/easymt library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ocolin / easymt example snippets


use Ocolin\EasyMT\API;

$output = API::query( '/ip/arp/print' )->read();

use Ocolin\EasyMT\SNMP;

$_ENV['EXAMPLE1_SNMP_COMMUNITY'] = public;
$_ENV['EXAMPLE1_SNMP_VERSION'] = 2;
$_ENV['EXAMPLE1_MT_IP'] = '127.0.0.1';

$snmp = new \Ocolin\EasyMT\SNMP(
    prefix: 'EXAMPLE1'
);

$output = $snmp->health();

use Ocolin\EasyMT\SNMP;

$snmp = new \Ocolin\EasyMT\SNMP(
           ip: '127.0.0.1',
    community: 'public',
      version: 2
);

$output = $snmp->health();

use Ocolin\EasyMT\SNMP;

$snmp = new \Ocolin\EasyMT\SNMP(
    ip: '127.0.0.1'
);
$output = $snmp->health();

stdClass Object
(
    [temperature] => stdClass Object
        (
            [Value] => 27
            [Unit] => 1
            [UnitName] => celsius
        )

    [cpu-temperature] => stdClass Object
        (
            [Value] => 48
            [Unit] => 1
            [UnitName] => celsius
        )

    [fan1-speed] => stdClass Object
        (
            [Value] => 4200
            [Unit] => 2
            [UnitName] => rpm
        )

    [fan2-speed] => stdClass Object
        (
            [Value] => 3990
            [Unit] => 2
            [UnitName] => rpm
        )

    [psu1-state] => stdClass Object
        (
            [Value] => 0
            [Unit] => 6
            [UnitName] => status
        )

    [psu2-state] => stdClass Object
        (
            [Value] => 1
            [Unit] => 6
            [UnitName] => status
        )
)