getting ssh failed attempts via ucd::mib Arbitrary Extension

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

Post Reply
kbowerman
Posts: 3
Joined: Mon Oct 20, 2003 8:32 pm

getting ssh failed attempts via ucd::mib Arbitrary Extension

Post by kbowerman »

I almost got this working but I return a string so it wont graph.

There is probably a better way to do this but this seems pretty cool but I can't quite get it to work. I am trying to get the number of failed ssh attempts by grepping /var/log/messages and I got it with the script method but it is ugly. I came up with this method but it wont graph becuase I return a string not a number. Can anyone tell me how I can force an integer from as a return value.

snmpd.conf:
exec .1.3.6.1.4.1.2021.50 sshcount /bin/sh /usr/local/bin/sshcount

/usr/local/bin/sshcount:
/bin/grep password /var/log/messages | wc -l

snmpwalk output:
UCD-SNMP-MIB::ucdavis.50.1.1 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.50.2.1 = STRING: "sshcount"
UCD-SNMP-MIB::ucdavis.50.3.1 = STRING: "/bin/sh /usr/local/bin/sshcount"
UCD-SNMP-MIB::ucdavis.50.100.1 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.50.101.1 = STRING: " 5340"
UCD-SNMP-MIB::ucdavis.50.102.1 = INTEGER: 0


I try to graph 1.3.6.1.4.1.2021.50.101.1
and get nan becuase (I am assuming) a string is returned and not a number

Thanks
Kyle Bowerman ( k y l e a t b o w e r m a n d o t o r g)
pbulteel
Cacti User
Posts: 150
Joined: Fri Sep 05, 2003 9:20 am
Location: London
Contact:

Post by pbulteel »

I'm assuming it is the space that is causing your value to appear as a string and not a number. Let me see if I can find out how to trim it.

-P
uname -a
kbowerman
Posts: 3
Joined: Mon Oct 20, 2003 8:32 pm

Post by kbowerman »

I stand corrected the graph is doing fine. I did add a CDEF to give 5 minute totals becuase it was annoying to look at failed ssh attempts per second.

Thanks for your intrest and reply.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest