Tip:
Fatal error: Call to undefined function snmpwalkoid () in E: \ proj \ PHP \ SNMP. php on line 2
Code:
<? PHP
$ A = snmpwalk ("127.0.0.1", "public ","");
Foreach ($ A as $ Val ){
Echo "$ Val <br> ";
}
?>
Solution:
1. install PHP and Its modules
A) decompress the package;
B) modify PHP. ini-Dist to PhP. ini;
2. Configuration File
A) modify the php. ini configuration file.
I. Modify extension_dir = c: \ PHP \ extensions
Ii. Delete the quotation marks (;) before the extended modules you need, for example:
Originally:
; Extension = php_snmp.dll
To:
Extension = php_snmp.dll
B) configure system environment variables (not required in this step)
I. Add c: \ PHP (PHP installation directory) to the environment variable path)
Ii. Add a variable, right-click my computer-properties-advanced-Environment Variable-system variable-New mibdirs = C: \ PHP \ mibs, and create phprc = c: \ PHP
Iii. Modify the registry (if not, create a new string value ):
HKEY_LOCAL_MACHINE → software → PHP → inifilepath
Value: C: \ PHP (PHP installation directory)
After all the work is done, restart.
Create a PHP file:
Code:
<? PHP
$ A = snmpwalk ("127.0.0.1", "public ","");
Foreach ($ A as $ Val ){
Echo "$ Val <br> ";
}
?>
You can see the effect.
------------------------------------------------------------
If any:
Warning: snmpwalk no response from 127.0.01
The SNMP configuration for Windows 2003 is required:
SNMP in Windows 2003 does not allow direct access by default. You need to configure some parameters.
Download net-snmpinstallation from http://www.net-snmp.org/download.html.
After installing SNMP, you can view the security options in the SNMP service of the Windows service.
Select the send Authentication Trap, add the public group, and read-only permission.
Select Accept SNMP Packets from these hosts and add the IP address of the SNMP browser.
For Linux, configure the snmpd. conf file:
# Vi/etc/snmp/snmpd. conf
Modify the snmpd. conf file
1. com2sec notconfiguser default public
Changed to com2sec notconfiguser 127.0.0.1 public
If you want to run the monitoring software on another machine (192.168.11.50) (the IP address of the local machine is 192.168.11.134), add the following:
Com2sec notconfiguser 192.168.11.50 public