PHP code example of vanderth / laravel-snmp

1. Go to this page and download the library: Download vanderth/laravel-snmp 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/ */

    

vanderth / laravel-snmp example snippets


use Vanderth\Snmp\SnmpPoller;
use Vanderth\Snmp\Pollers\IfTablePoller;
use SNMP;

$session = new SNMP(SNMP::VERSION_2C, '192.168.10.254', 'csnmpv2c');

$poller = new SnmpPoller();

$poller->setSnmpSession($session)->addPoller(IfTablePoller::class)->run();

use Vanderth\Snmp\SnmpPoller;
use Vanderth\Snmp\Pollers\IfTablePoller;
use Vanderth\Snmp\Pollers\IfExtendTablePoller;
use SNMP;

$session = new SNMP(SnmpPoller::V2c, 'localhost', 'public');

$poller = new SnmpPoller();

$pollerClasses = [
   IfTablePoller::class,
   IfExtendTablePoller::class,
];

$poller->setSnmpSession($session)
       ->addPollers($pollerClasses)
       ->run();
bash
php artisan snmp:install