\SNMPHelper
Ubilling SNMP abstraction class
Synopsis
class SNMPHelper
{
- // constants
- const CACHE_PATH = 'exports/';
- const EX_NOT_IMPL = 'NOT_IMPLEMENTED_MODE';
- const EX_WRONG_DATA = 'WRONG_DATA_FORMAT_RECEIVED';
- const OPTION_DEBUG = 'SNMP_DEBUG_MODE';
- const LOG_OIDS = 'exports/snmpdebug_oids.log';
- const LOG_COMMANDS = 'exports/snmpdebug_commands.log';
- // members
- protected array $altCfg = ;
- protected string $mode = '';
- protected bool $background = false;
- protected integer $cacheTime = 60;
- protected string $pathWalk = '';
- protected string $pathSet = '';
- protected integer $retriesNative = 1;
- protected bool $debug = false;
- protected integer $timeoutNative = 1000000;
- // methods
- public void __construct()
- protected void loadAlter()
- protected void setOptions()
- protected void setDebug()
- public void setBackground()
- public bool getBackground()
- public void setMode()
- public bool getMode()
- protected string snmpWalkSystem()
- protected string snmpWalkNative()
- protected string snmpWalkClass()
- protected string snmpSetSystem()
- protected string snmpSetNative()
- protected string snmpSetClass()
- protected void oidLog()
- public string walk()
- public string set()
Constants
Name | Value |
---|---|
CACHE_PATH | 'exports/' |
EX_NOT_IMPL | 'NOT_IMPLEMENTED_MODE' |
EX_WRONG_DATA | 'WRONG_DATA_FORMAT_RECEIVED' |
OPTION_DEBUG | 'SNMP_DEBUG_MODE' |
LOG_OIDS | 'exports/snmpdebug_oids.log' |
LOG_COMMANDS | 'exports/snmpdebug_commands.log' |
Members
protected
- $altCfg
—
array
System-wide alter.ini config as array - $background
—
bool
System snmpwalk background multi-threaded mode - $cacheTime
—
int
SNMP raw data caching timeout in minutes - $debug
—
bool
Debugging mode flag - $mode
—
string
Pre-configured SNMP work mode - system/native/class - $pathSet
—
string
System snmpset binary path with -On and version params - $pathWalk
—
string
System snmpwalk binary path with -On and version params - $retriesNative
—
int
Native PHP snmp functions retries - $timeoutNative
—
int
Native PHP snmp functions timeout
Methods
protected
- loadAlter() — Loads system alter config at startup
- oidLog() — Put some messages to logs if debug mode is enabled
- setDebug() — Sets instance debug mode state
- setOptions() — Sets all needed options to protected props
- snmpSetClass() — Executes PHP 5.4 SNMP set interface
- snmpSetNative() — Executes native SNMP set interface
- snmpSetSystem() — Executes native SNMP set interface
- snmpWalkClass() — Executes php 5.4 SNMP class walk interface
- snmpWalkNative() — Executes native SNMP walk interface
- snmpWalkSystem() — Executes system SNMP walk interface
public
- __construct() — Creates new SNMPHelper instance
- getBackground() — Public getter of background mode
- getMode() — Public getter of SNMP run mode
- set() — Public SNMP set interface
- setBackground() — Public background mode setter
- setMode() — Set SNMP run mode (system/native/class)
- walk() — Public SNMP walk interface