snmp_agent_config()
Indicate if the PATROL SNMP Sub-Agent is active or not active.
Syntax
snmp_agent_config()
Parameter
This function does not accept any parameters.
Description
The snmp_agent_config() function returns one of the following messages indicating if the PATROL SNMP Sub-Agent is active or inactive.
SNMP support is not active.
or
SNMP support is active.
Example
The following example uses the snmp_agent_config() function to create a user-defined function, verify_snmp_agent(), to check for SNMP support.
The main() section of the example starts SNMP, checks for SNMP support, stops SNMP, and then checks again for SNMP support using the user-defined verify_snmp_agent() function:
function verify_snmp_agent() {
print("Checking for SNMP support... ");
#Check the result of snmp_agent_config()function for the text "not" starting
#in the 17th character of the output string using the substr() function.
if (substr(snmp_agent_config(),17,3)=="not") {
print("SNMP NOT ACTIVE\n");
} else {
print("SNMP ACTIVE\n");
}
return;
}
function main() {
print("Starting SNMP\n");
snmp_agent_start(); #Starting SNMP
verify_snmp_agent(); #Checking for SNMP support
print("Stopping SNMP\n");
snmp_agent_stop(); #Stopping SNMP
verify_snmp_agent(); #Checking for SNMP support
}
print("Checking for SNMP support... ");
#Check the result of snmp_agent_config()function for the text "not" starting
#in the 17th character of the output string using the substr() function.
if (substr(snmp_agent_config(),17,3)=="not") {
print("SNMP NOT ACTIVE\n");
} else {
print("SNMP ACTIVE\n");
}
return;
}
function main() {
print("Starting SNMP\n");
snmp_agent_start(); #Starting SNMP
verify_snmp_agent(); #Checking for SNMP support
print("Stopping SNMP\n");
snmp_agent_stop(); #Stopping SNMP
verify_snmp_agent(); #Checking for SNMP support
}
This example produces the following output:
Starting SNMP
Checking for SNMP support... SNMP ACTIVE
Stopping SNMP
Checking for SNMP support... SNMP NOT ACTIVE
Checking for SNMP support... SNMP ACTIVE
Stopping SNMP
Checking for SNMP support... SNMP NOT ACTIVE