Friday, May 02, 2008
Navel-gazing on my unwillingness to learn a software package
It was a simple request at the Weekly Company Meeting: “Can we monitor the number of SMTP connections to our mail servers, and have it graphed in Cacti?” Breaking it down, the answer appears to be yes, and I have no XXXXXXX clue.”
And that is bugging the XXXX out of me.
The first bit? Pretty easy actually.
By default, our servers are already tracking SMTP connections via iptables
,
and it's a simple matter to pull the number out:
iptables --list -vnx \ | grep 'state NEW tcp dpt:25' \ | awk '{print $1}'
Print the current state of iptables
, pull out the line
accepting incoming connections to the SMTP port, and print the first column, which is the
number of packets (and thus, the number of connections).
Next up is to deliver this information via SNMP. We're using net-snmp and it indeed, does make it easy to export information via SNMP. Take the above command, place it into a file (thus making it a shell script). Then, in the SNMP configuration file:
exec .1.3.6.1.4.1.2021.9004 snmp_connection /root/bin/smpt_connection
Restart the SNMP server, and do your query:
GenericUnixPrompt> snmpwalk XXXXXXXXXXXXXXXXXX .1.3.6.1.4.1.2021.9004
UCD-SNMP-MIB::ucdavis.9004.1.1 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.9004.2.1 = STRING: "snmp_connection"
UCD-SNMP-MIB::ucdavis.9004.3.1 = STRING: "/root/bin/snmp_connection"
UCD-SNMP-MIB::ucdavis.9004.100.1 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.9004.101.1 = STRING: "62191"
UCD-SNMP-MIB::ucdavis.9004.102.1 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.9004.103.1 = ""
GenericUnixPrompt>
So okay, the value we want is a string, and not numeric, but at least we can query it.
Now we get to Cacti.
Eight hours later and I've yet to get a graph out of Cacti.
I found a page that describes a similar setup, but check out section 3C and the XML file that's created.
Now check out the SNMP Query XML Syntax for Cacti.
I don't fault you for feeling confused. I'm a XXXXXXXXXX programmer who writes CGIs in C for fun, and I got horribly confused.
I can't quite figure out how Cacti works. Oh sure, it's easy to install, and monitoring devices isn't all that difficult (I find it rather randomly clunky myself) but adding a new query to Cacti?
If there's a straightforward way of doing that, I haven't found it.
Somehow “Data Queries” are tied to the “Data Templates” although what that connection is eludes me. It seems like you can specify a single SNMP query in a “Data Template” but maybe not, because why have an XML file for the SNMP query?
And the “Graph Templates” tie into this mess as well, although I'm still puzzled at that one.
And the flow is weird—I'll be in the “Data Query” section, obstensibly making a change to a “Data Query” and suddenly find myself in the “Data Template” area after saving a change. Or sometimes in the “Graph Template” area.
Never the “Host Template” area though.
I'm finding it a horribly confusing process and it's bugging me that I can't figure this out. I want to quit and say to Smirk, “Sorry, not possible,” and that is bugging me, because I know it is possible, probably even with Cacti if I just knew what to do.
I know what the problem is—my mental model of how this is supposed to work doesn't match the mental model of the Cacti developers. And without that clear mental model, the whole process under Cacti just doesn't make sense to me.
I had the same problem with C when I first started using it. I had been programming for years in Assembly, and there were certain cases where a problem would have been trivial in Assembly but I was utterly lost for a solution with C. Of course, over time, I gained the ability to “think” in C, and now what was once problematic in C (but not in Assembly) is now trivial in C.
But that took a few years though, and at least with C, the knowledge is still useful. I'm doubting that the time I spend with Cacti will have the same benefit over the long term.
And that's bugging me too, mainly because it seems like I'm justifying not learning it at all.
Things that go “Vroooom!”
To take my mind off some troubling thoughts, here's something for Gregory, who loves motocycles, airplanes, and space exploration: the ultimate crotch rocket.
“… then sing again for the ever onward IBM!”
I. B. M., Happy men, smiling all the way.
Oh what fun it is to sell our products night and day.
I. B. M., Watson men, partners of T. J.
In his service to mankind—that's why we are so gay.I. B. M., Watson men, International line:
Proud T. M.—Dayton Scale— and I. T. R. so fine
I. B. M. goods and men, leaders all the time.
Saving money, time and men, in every land and clime.
Ever Onward and other classic IBM Company Songs
And yet another silly link to take my mind off things—this time, a collection of those classic IBM company songs, from a time when employees sang these without irony.
And again, this silly link is for Gregory, who also loves his IBM.