The SNMP client is configured through an array of configuration values. The configuration is simply passed to the client on construction:
use FreeDSx\Snmp\SnmpClient;
$snmp = new SnmpClient([
'host' => 'server',
'version' => 2,
'community' => 'foo',
]);
The following documents these various configuration options and how they impact the client.
The host to connect to.
Default: localhost
The port to connect to on the SNMP host.
Default: 161
The SNMP version to use. Must be one of: 1, 2, 3
Default: 2
The community name to use when sending SNMP version 1 or 2 communications.
Default: public
The user to connect to when using SNMP version 3.
Default: (null)
Whether or not to use authentication for the specified user when using SNMP version 3.
Default: false
The authentication password to use for the specified user when using SNMP version 3.
Default: (null)
The authentication mechanism to use for the specified user when using SNMP version 3. Available options are:
- md5
- sha1
- sha224
- sha256
- sha384
- sha512
Default: (null)
Whether or not to use privacy (encryption) for the specified user when using SNMP version 3.
Default: false
The privacy password to use for the specified user when using SNMP version 3.
Default: (null)
The privacy mechanism to use for the specified user when using SNMP version 3. Available options are:
- des
- aes128
- 3des
- aes192
- aes256
- aes192blu
- aes256blu
By default the aes192
and aes256
mechanisms use the "Reeder" key localization strategy. This strategy
will work for Cisco devices. If it doesn't work you may want to try the aes192blu
or aes256blu
mechanisms,
which uses the "Blumenthal" key localization strategy. Unfortunately the AES192 / AES256 / 3DES mechanisms were never
officially standardized and multiple implementations exist.
Default: (null)
The engine id of the remote SNMP host. If you specify it here, this will always be used. If you leave it empty, then the engine id will be discovered automatically as part of the SNMP version 3 USM discovery process.
If you define this it must be an instance of FreeDSx\Snmp\Message\EngineId
.
Default: (null)
The context name to use when communicating with the remote SNMP host.
Default: (null)
The timeout period (in seconds) when connecting to an SNMP host.
Default: 3
The timeout period (in seconds) when reading data from an SNMP host.
Default: 10