(PHP 5 >= 5.4.0, PHP 7, PHP 8)
SNMP::setSecurity — Configures security-related SNMPv3 session parameters
$securityLevel,$authProtocol = "",$authPassphrase = "",$privacyProtocol = "",$privacyPassphrase = "",$contextName = "",$contextEngineId = ""setSecurity configures security-related session parameters used in SNMP protocol version 3
securityLevelthe security level (noAuthNoPriv|authNoPriv|authPriv)
authProtocolthe authentication protocol (MD5 or SHA)
authPassphrasethe authentication pass phrase
privacyProtocolthe privacy protocol (DES or AES)
privacyPassphrasethe privacy pass phrase
contextNamethe context name
contextEngineIdthe context EngineID
成功时返回 true, 或者在失败时返回 false。
示例 #1 SNMP::setSecurity() example
<?php
$session = new SNMP(SNMP::VERSION_3, $hostname, $rwuser, $timeout, $retries);
$session->setSecurity('authPriv', 'MD5', $auth_pass, 'AES', $priv_pass, '', 'aeeeff');
?>