Monitoring switch

Hello
I have tried to monitor my switch with snmp v3
in CLI everythings work perfectly :slight_smile:

[root@icingamaster plugins]# ./check_snmp -H x.x.x.x-P 3 -L authPriv -U icingamonitoring -a SHA -x AES -A ‘SnmpPA$sw0d%MoniTring(A06)’ -X ‘SnmpPA$sw0d%MoniTring(A06)’
-o.my-oid
SNMP OK - 1 | my-oid=1

the problem is when adding thoses variables intro my service.conf the result is No counter specified


my command.conf file:

object CheckCommand “check_snmp” {
import “plugin-check-command”
command = [ PluginDir + “/check_snmp” ]
arguments = {
“-H” = “$snmpv3_address$”
“-P” = “$snmp_port$”
“-o” = “$snmpv3_oid$”
“-C” = “$snmp_community$”
“-V” = “$snmp_version$”
“-U” = “$snmpv3_user$”
“-L” = “$snmpv3_seclevel$”
“-a” = “$snmpv3_auth_alg$”
“-x” = “$snmpv3_priv_alg$”
“-A” = “$snmpv3_auth_key$”
“-X” = “$snmpv3_priv_key$”
}
}

My service.conf file :

apply Service “Interface Gi/23” {
import “generic-service”
check_command = “snmpv3”
vars.snmp_address = “x.x.x.x”
vars.snmpv3_user = “icingamonitoring”
vars.snmp_oid = “my-mib”
vars.snmpv3_seclevel = “authPriv”
vars.snmpv3_auth_key = “SnmpPA$sw0d%MoniTring(A06)”
vars.snmpv3_priv_key = “SnmpPA$sw0d%MoniTring(A06)”
vars.snmpv3_priv_alg = “AES”
vars.snmpv3_auth_alg = “SHA”
vars.snmp_version = 3
assign where host.vars.agent_type == “snmp”

vars.notification[“mail”] = {
groups = [ “icingaadmins” ]
users = [“icingaadmin”]
}
}

my host.conf
template Host “snmp-agent” {
check_command = “hostalive”

vars.agent_type = “snmpv3”
}

object Host “my-object-invisible-host” {
import “snmp-agent”
address = “x.x.x.x”
vars.agent_type = “snmp”
vars.interfaces[“GigabitEthernet0/1”] = {
description = “GigabitEthernet0/1”
}
vars.interfaces[“GigabitEthernet0/2”] = {
description = “GigabitEthernet0/1”
}
}

the first problem is with the dollar signe , the error returned is :
Closing $ not found in macro format string 'SnmpPA$sw0d%MoniTring(A06)'.
i have add one $ to become the password SnmpPA$$sw0d%MoniTring(A06)
again i have tried many and many time but the result is uknown with no No counter specified
I wish you can give me an explication about that and how to make it right
I repeat that in CLI is working normal
Thank you

Try to escape the dollar sign by using it twice. BTW: Why don’t you use snmpv3 from ITL?

1 Like

Hello Roland
I have modified the check_command to snmpv3 and i have deleted the line where the vars.snmp_version = 3
and its works
Thanks for collaboration and i hope to everyone has the same probleme as me to use snmpv3 and change the command.conf with all parameters to snmpv3
Thank you all