Issues with snmp dskTotal monitoring


Hi all,
I need to monitor a Red Hat 7.3 system running ucd-snmp-4.2.1-7 when I run snmpwalk -v1 -c public -localhost everything works fine but when I edited the /etc/snmp/snmpd.conf by adding community name it also works fine but when I add disk size monitoring I get a time out from localhost error, I discovered that this happens only when I add the line for disk monitoring because when I checked the status of snmpd it gave a snmpd dead but subsys locked error I was able to go around this problem by replacing the snmpd.conf file on the 7.3 version with the snmpd.conf file on a Fedora core 3 and every other command like memory, cpu, swap, system, interface etc worked fine except that dskTotal, dskAvail, dskPercent and dskUsed command did not work.

I searched the internet for a solution but I learnt that this is actually caused by a bug in the way 7.3 handles getmntent for reading disk settings. On sourceforge I learnt that there was a patch but it didn’t give details as to how to apply the patch. I have pasted a copy of the patch. I need to be able to do this in order to be able to monitor this server using nagios. I hope I get a solution soon.

Index: disk.c

RCS file: /cvsroot/net-snmp/net-snmp/agent/mibgroup/ucd-snmp/disk.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
— disk.c 2001/12/05 16:23:31 1.34
+++ disk.c 2002/01/03 22:00:29 1.35
@@ -241,7 +241,7 @@
mntfp = setmntent(ETC_MNTTAB, “r”);
disks[numdisks].device[0] = 0;

  • while ((mntent = getmntent (mntfp)))
  • while (mntent && (mntent = getmntent (mntfp)))
    if (strcmp (disks[numdisks].path, mntent->mnt_dir) == 0) {
    copy_nword(mntent->mnt_fsname, disks[numdisks].device, sizeof(disks[numdisks].device));
    DEBUGMSGTL((“ucd-snmp/disk”, “Disk: %s\n”,mntent->mnt_fsname));
    @@ -251,7 +251,8 @@
    DEBUGMSGTL((“ucd-snmp/disk”, " %s != %s\n", disks[numdisks].path,
  • endmntent(mntfp);
  • if (mntfp)
  •    endmntent(mntfp);
    if (disks[numdisks].device[0] != 0) {
    /* dummy clause for else below /
    numdisks += 1; /
    but inc numdisks here after test */

Thanks in advance


try man patchadd. I’m not at a linux box, so I’m going from my terrible memory.