Good morning everyone,
I have a problem when running my configuration file in logstash, it does not show me the metrics that I am requesting with the GET method, I've been doing some tests and I realized that when I try to add two more oids there begins the failure, but if I remove those two there if I serve me all right. That is, the problem occurs when I add more OIDS with the GET method.
This works fine for me, but if I add more oid in this field, the problem starts in the execution.
This is my code :
input {
snmp {
get => ["1.3.6.1.2.1.1.5.0", "1.3.6.1.4.1.9.9.109.1.1.1.1.7.1", "1.3.6.1.4.1.9.2.1.57.0", "1.3.6.1.4.1.9.9.48.1.1.1.5.1", "1.3.6.1.4.1.9.9.109.1.1.1.1.12.1"]
get => ["1.3.6.1.4.1.9.9.109.1.1.1.1.13.1", "1.3.6.1.4.1.9.9.48.1.1.1.6.1"]
get => ["1.3.6.1.2.1.31.1.1.1.1.2", "1.3.6.1.2.1.31.1.1.1.1.7", "1.3.6.1.2.1.31.1.1.1.1.44", "1.3.6.1.2.1.31.1.1.1.1.46", "1.3.6.1.2.1.31.1.1.1.1.47", "1.3.6.1.2.1.31.1.1.1.1.61", "1.3.6.1.2.1.31.1.1.1.1.62", "1.3.6.1.2.1.31.1.1.1.1.37", "1.3.6.1.2.1.31.1.1.1.1.38"]
get => ["1.3.6.1.2.1.31.1.1.1.18.2", "1.3.6.1.2.1.31.1.1.1.18.7", "1.3.6.1.2.1.31.1.1.1.18.44", "1.3.6.1.2.1.31.1.1.1.18.46", "1.3.6.1.2.1.31.1.1.1.18.47", "1.3.6.1.2.1.31.1.1.1.18.61", "1.3.6.1.2.1.31.1.1.1.18.62", "1.3.6.1.2.1.31.1.1.1.18.37", "1.3.6.1.2.1.31.1.1.1.18.38"]
get => ["1.3.6.1.2.1.31.1.1.1.15.2", "1.3.6.1.2.1.31.1.1.1.15.7", "1.3.6.1.2.1.31.1.1.1.15.44", "1.3.6.1.2.1.31.1.1.1.15.46", "1.3.6.1.2.1.31.1.1.1.15.47", "1.3.6.1.2.1.31.1.1.1.15.61", "1.3.6.1.2.1.31.1.1.1.15.62", "1.3.6.1.2.1.31.1.1.1.15.37", "1.3.6.1.2.1.31.1.1.1.15.38"]
# get => ["1.3.6.1.2.1.2.2.1.10.2", "1.3.6.1.2.1.2.2.1.10.7", "1.3.6.1.2.1.2.2.1.10.44", "1.3.6.1.2.1.2.2.1.10.46", "1.3.6.1.2.1.2.2.1.10.47", "1.3.6.1.2.1.2.2.1.10.61", "1.3.6.1.2.1.2.2.1.10.62", "1.3.6.1.2.1.2.2.1.10.37", "1.3.6.1.2.1.2.2.1.10.38"]
get => ["1.3.6.1.2.1.2.2.1.16.2", "1.3.6.1.2.1.2.2.1.16.7", "1.3.6.1.2.1.2.2.1.16.44"]
get => ["1.3.6.1.2.1.2.2.1.8.2", "1.3.6.1.2.1.2.2.1.8.7", "1.3.6.1.2.1.2.2.1.8.44", "1.3.6.1.2.1.2.2.1.8.46", "1.3.6.1.2.1.2.2.1.8.47", "1.3.6.1.2.1.2.2.1.8.61", "1.3.6.1.2.1.2.2.1.8.62", "1.3.6.1.2.1.2.2.1.8.37", "1.3.6.1.2.1.2.2.1.8.38"]
hosts => [{host => "udp:157.253.91.6/161" community => "UA_ETB_R" version => "2c"}]
interval => 60
}
}
filter {
if [host] == "157.253.91.6" {
mutate { add_field => {"State" => 0}}
mutate { add_field => {"Estado" => "Normal"}}
mutate {
convert => {"MemUsagePerc" => "integer"}
rename => ["host", "IP"]
rename => ["iso.org.dod.internet.mgmt.mib-2.system.sysName.0", "Sysname"]
# rename => ["iso.org.dod.internet.private.enterprises.9.9.109.1.1.1.1.7.1", ""]
rename => ["iso.org.dod.internet.private.enterprises.9.2.1.57.0", "Cpu"]
# rename => ["iso.org.dod.internet.private.enterprises.9.9.109.1.1.1.1.12.1", ""]
rename => ["iso.org.dod.internet.private.enterprises.9.9.48.1.1.1.5.1", "MemUsed"]
rename => ["iso.org.dod.internet.private.enterprises.9.9.48.1.1.1.6.1", "MemFree"]
# rename => ["iso.org.dod.internet.private.enterprises.9.9.109.1.1.1.1.13.1", ""]
rename => ["iso.org.dod.internet.mgmt.mib-2.ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifAlias.2", "InterfazDesc1"]
rename => ["iso.org.dod.internet.mgmt.mib-2.ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifAlias.7", "InterfazDesc2"]
rename => ["iso.org.dod.internet.mgmt.mib-2.ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifAlias.44", "InterfazDesc3"]
rename => ["iso.org.dod.internet.mgmt.mib-2.ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifAlias.46", "InterfazDesc4"]
rename => ["iso.org.dod.internet.mgmt.mib-2.ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifAlias.47", "InterfazDesc5"]
rename => ["iso.org.dod.internet.mgmt.mib-2.ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifAlias.61", "InterfazDesc6"]
rename => ["iso.org.dod.internet.mgmt.mib-2.ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifAlias.62", "InterfazDesc7"]
rename => ["iso.org.dod.internet.mgmt.mib-2.ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifAlias.37", "InterfazDesc8"]
rename => ["iso.org.dod.internet.mgmt.mib-2.ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifAlias.38", "InterfazDesc9"]
rename => ["iso.org.dod.internet.mgmt.mib-2.ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifName.2", "InterfazName1"]
rename => ["iso.org.dod.internet.mgmt.mib-2.ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifName.7", "InterfazName2"]
rename => ["iso.org.dod.internet.mgmt.mib-2.ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifName.44", "InterfazName3"]
rename => ["iso.org.dod.internet.mgmt.mib-2.ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifName.46", "InterfazName4"]
rename => ["iso.org.dod.internet.mgmt.mib-2.ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifName.47", "InterfazName5"]
rename => ["iso.org.dod.internet.mgmt.mib-2.ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifName.61", "InterfazName6"]
rename => ["iso.org.dod.internet.mgmt.mib-2.ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifName.62", "InterfazName7"]
rename => ["iso.org.dod.internet.mgmt.mib-2.ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifName.37", "InterfazName8"]
rename => ["iso.org.dod.internet.mgmt.mib-2.ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifName.38", "InterfazName9"]
rename => ["iso.org.dod.internet.mgmt.mib-2.ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifHighSpeed.2", "InterfazSpeed1"]
rename => ["iso.org.dod.internet.mgmt.mib-2.ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifHighSpeed.7", "InterfazSpeed2"]
rename => ["iso.org.dod.internet.mgmt.mib-2.ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifHighSpeed.44", "InterfazSpeed3"]
rename => ["iso.org.dod.internet.mgmt.mib-2.ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifHighSpeed.46", "InterfazSpeed4"]
rename => ["iso.org.dod.internet.mgmt.mib-2.ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifHighSpeed.47", "InterfazSpeed5"]
rename => ["iso.org.dod.internet.mgmt.mib-2.ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifHighSpeed.61", "InterfazSpeed6"]
rename => ["iso.org.dod.internet.mgmt.mib-2.ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifHighSpeed.62", "InterfazSpeed7"]
rename => ["iso.org.dod.internet.mgmt.mib-2.ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifHighSpeed.37", "InterfazSpeed8"]
rename => ["iso.org.dod.internet.mgmt.mib-2.ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifHighSpeed.38", "InterfazSpeed9"]
rename => ["iso.org.dod.internet.mgmt.mib-2.interfaces.ifTable.ifEntry.ifInOctets.2", "InterfazIn1"]
rename => ["iso.org.dod.internet.mgmt.mib-2.interfaces.ifTable.ifEntry.ifInOctets.7", "InterfazIn2"]
rename => ["iso.org.dod.internet.mgmt.mib-2.interfaces.ifTable.ifEntry.ifInOctets.44", "InterfazIn3"]
rename => ["iso.org.dod.internet.mgmt.mib-2.interfaces.ifTable.ifEntry.ifInOctets.46", "InterfazIn4"]
rename => ["iso.org.dod.internet.mgmt.mib-2.interfaces.ifTable.ifEntry.ifInOctets.47", "InterfazIn5"]
rename => ["iso.org.dod.internet.mgmt.mib-2.interfaces.ifTable.ifEntry.ifInOctets.61", "InterfazIn6"]
rename => ["iso.org.dod.internet.mgmt.mib-2.interfaces.ifTable.ifEntry.ifInOctets.62", "InterfazIn7"]
rename => ["iso.org.dod.internet.mgmt.mib-2.interfaces.ifTable.ifEntry.ifInOctets.37", "InterfazIn8"]
rename => ["iso.org.dod.internet.mgmt.mib-2.interfaces.ifTable.ifEntry.ifInOctets.38", "InterfazIn9"]
rename => ["iso.org.dod.internet.mgmt.mib-2.interfaces.ifTable.ifEntry.ifOutOctets.2", "InterfazOut1"]
rename => ["iso.org.dod.internet.mgmt.mib-2.interfaces.ifTable.ifEntry.ifOutOctets.7", "InterfazOut2"]
rename => ["iso.org.dod.internet.mgmt.mib-2.interfaces.ifTable.ifEntry.ifOutOctets.44", "InterfazOut3"]
rename => ["iso.org.dod.internet.mgmt.mib-2.interfaces.ifTable.ifEntry.ifOutOctets.46", "InterfazOut4"]
#rename => ["iso.org.dod.internet.mgmt.mib-2.interfaces.ifTable.ifEntry.ifOutOctets.47", "InterfazOut5"]
#rename => ["iso.org.dod.internet.mgmt.mib-2.interfaces.ifTable.ifEntry.ifOutOctets.61", "InterfazOut6"]
#rename => ["iso.org.dod.internet.mgmt.mib-2.interfaces.ifTable.ifEntry.ifOutOctets.62", "InterfazOut7"]
#rename => ["iso.org.dod.internet.mgmt.mib-2.interfaces.ifTable.ifEntry.ifOutOctets.37", "InterfazOut8"]
#rename => ["iso.org.dod.internet.mgmt.mib-2.interfaces.ifTable.ifEntry.ifOutOctets.38", "InterfazOut9"]
}
ruby {
code => "event.set('MemTotal', event.get('MemUsed') + event.get('MemFree'))"
}
ruby {
code => "event.set('MemUsagePerc', (event.get('MemUsed') * 100 ) / event.get('MemTotal'))"
}
if [MemUsagePerc] > 75 {
mutate {
update => {"State" => 1}
update => {"Estado" => "Alert"}
convert => { "State" => "integer" }
}
if [MemUsagePerc] > 85 {
mutate { update => {"State" => 2 }
update => {"Estado" => "Warning"}
convert => { "State" => "integer" }
}
if [MemUsagePerc] > 90 {
mutate { update => {"State" => 3 }
update => {"Estado" => "Critical"}
convert => { "State" => "integer" }}
}
}
}
else if [Cpu] > 70 {
mutate {
update => {"State" => 1}
update => {"Estado" => "Alert"}
convert => { "State" => "integer" }
}
if [Cpu] > 80 {
mutate { update => {"State" => 2 }
update => {"Estado" => "Warning"}
convert => { "State" => "integer" }
}
if [Cpu] > 90 {
mutate { update => {"State" => 3 }
update => {"Estado" => "Critical"}
convert => { "State" => "integer" }}
}
}
}
}
}
output {
stdout{}
}