PHP code example of acamposm / snmp-poller

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

    

acamposm / snmp-poller example snippets


use Acamposm\SnmpPoller\SnmpPoller;
use Acamposm\SnmpPoller\Pollers\IfTablePoller;
use Acamposm\SnmpPoller\Pollers\IfExtendedTablePoller;
use Acamposm\SnmpPoller\Pollers\EntPhysicalTablePoller;
use Acamposm\SnmpPoller\Pollers\LldpRemoteTablePoller;
use SNMP;

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

$poller = new SnmpPoller();

$pollerClasses = [
   IfTablePoller::class,
   IfExtendedTablePoller::class,
   EntPhysicalTablePoller::class,
   LldpRemoteTablePoller::class,
];

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