-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathv3test.php
41 lines (24 loc) · 946 Bytes
/
v3test.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
error_reporting(E_ALL);
require('snmp.php');
$snmp = new snmp();
$snmp->timeout = 1;
echo "v1: ";
$snmp->version = SNMP_VERSION_1;
print_r($snmp->get('localhost', '.1.3.6.1.2.1.1.3.0'));
echo "v2: ";
$snmp->version = SNMP_VERSION_2C;
print_r($snmp->get('localhost', '.1.3.6.1.2.1.1.3.0'));
echo "v3: ";
$snmp->version = SNMP_VERSION_3;
print_r($snmp->get('localhost', '.1.3.6.1.2.1.1.3.0', array('v3_flags'=>SNMP_AUTH_PRIV, 'v3_user'=>'jellofish',
'v3_auth'=>'qxplne45', 'v3_priv'=>'rvnsiq45')));
/*
1. Make sure the snmpd is not running and insert the following command to create a user:
# net-snmp-config --create-snmpv3-user -a my_password my_user
2. Setup net-snmpd with the following command:
# snmpconf -i -g basic_setup
3. Test the config
# snmpget -v3 -u my_user -l authNoPriv -a MD5 -A my_password localhost sysUpTime.0
*/
?>