You use global SNMP when you want to
send trap or informational messages to external SNMP daemons.
To access global SNMP using the REST API
on VAMI port 5480, you use the URL https://$vRA:5480/config#/vSNMP. The
following procedure shows how to configure, enable, and start the VMware SNMP
daemon.Procedure
-
Configure the VMware SNMP
daemon.
curl -X PUT --insecure \
https://$vRA:5480/config/snmp/agent/configure \
-H "Authorization: Bearer $token" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{ \
"manager": { \
"host": "Your snmp server here !", \
"auth_user": "The user that is authorized to send snmp inform messages", \
"auth_password": "Authentication password for auth_user", \
"channel_encryption_password": "The password to be used for connection encryption between this agent and your snmp server.", \
"security_engine": "Authentication engine. Example: 0x8000000001020304", \
"content_engine": "Content engine. Example: 0x8000000001020304" \
} \
}'
-
Retrieve the default configuration for
SNMP.
curl --insecure -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer $token" https://$vRA:5480/config/snmp/monitors/config
The response body shows the default configuration.
{
"load": {
"load": [
[
"10",
"10",
"10"
]
],
"monitor": {
"seconds": "30"
}
},
"disk": {
"disk": [
[
"/",
"15%"
],
[
"/storage/log",
"15%"
],
[
"/storage/artifactory",
"15%"
],
[
"/storage/db",
"15%"
]
],
"monitor": {
"seconds": "10"
}
},
"proc": {
"proc": [
[
"postgres",
"1",
"300"
]
],
"monitor": {
"seconds": "60"
}
},
"file": {
"monitor": {
"seconds": "60"
},
"file": [
[
"\"/storage/db/pgdata/recovery.conf\"",
"0"
]
]
}
}
-
To change the configuration for SNMP,
edit parameter values in the response and use the new configuration as input to the
request. In this example, the load monitoring period is extended to 180 seconds.
curl -X PUT --insecure \
https://$vRA:5480/config/snmp/monitors \
-H "Authorization: Bearer $token" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{ \
"load": { \
"load": [["10","10","10"]], \
"monitor": {"seconds": "180"} \
}, \
"disk": { \
"disk": [ \
["/","15%"], \
["/storage/log","15%"], \
["/storage/artifactory","15%"], \
["/storage/db","15%"] \
], \
"monitor": {"seconds": "10"} \
}, \
"proc": { \
"proc": [["postgres","1","300"]], \
"monitor": {"seconds": "60"} \
}, \
"file": { \
"monitor": {"seconds": "60"}, \
"file": [["\"/storage/db/pgdata/recovery.conf\"","0"]] \
} \
}'
-
Enable but do not start the
VMware SNMP daemon.
curl -X PUT --insecure -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer $token" https://$vRA:5480/config/snmp/enable
-
Start the VMware SNMP daemon.
curl -X PUT --insecure -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer $token" https://$vRA:5480/config/snmp/start
If the daemon fails to start, perform the following steps.
-
Stop the daemon.
curl -X PUT --insecure -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer $token" https://$vRA:5480/config/snmp/stop
-
Restore the default
configuration of SNMP monitoring.
curl -X PUT --insecure -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer $token" https://$vRA:5480/config/snmp/restore_default_config?proceed=true
-
Disable the daemon to
prevent it from running if vRealize Automation is rebooted or if there is an attempt to
restart the daemon using the API.
curl -X PUT --insecure -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer $token" https://$vRA:5480/config/snmp/disable
Results
After the VMware SNMP daemon is configured
and running, you can access the vRealize Automation node agent on port 161. For authentication, you use the
same user name and password that you used to configure SNMP. To encrypt the channel, you
use the same channel_encryption_password
that you used to encrypt the
channel between the vSNMPD and the SNMP server.