Bug 169201 - bsnmpd(8) host-resources - return hrFSTypes on hrStorageType oid
Summary: bsnmpd(8) host-resources - return hrFSTypes on hrStorageType oid
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 9.0-STABLE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-06-18 15:50 UTC by Rafael Ganascim
Modified: 2018-01-03 05:16 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rafael Ganascim 2012-06-18 15:50:11 UTC
According to the host-resources MIB, the HOST-RESOURCES-MIB::hrStorageType need
to be set to hrStorageTypes values (like hrStorageFixedDisk,
hrStorageRemovableDisk, etc), but the bsnmpd is setting the hrFSTypes
in this field (hrFSBerkeleyFFS, hrFSFat, etc).

rafael@ldalatimez006:~$ snmpwalk -c public -v 2c fw01 .1.3.6.1.2.1.25.2.3.1 | grep '\.4 '
HOST-RESOURCES-MIB::hrStorageIndex.4 = INTEGER: 4
HOST-RESOURCES-MIB::hrStorageType.4 = OID: HOST-RESOURCES-TYPES::hrFSBerkeleyFFS
HOST-RESOURCES-MIB::hrStorageDescr.4 = STRING: /, type: ufs, dev: /dev/mfid0s1a

On the source code, I found where is set the fstype  (file hostres_storage_tbl.c line 495):
..
entry->type = fs_get_type(&fs_buf[i]); /*XXX - This is wrong*/
..

How-To-Repeat: rafael@ldalatimez006:~$ snmpwalk -c public -v 2c fw01 .1.3.6.1.2.1.25.2.3.1 | grep '\.4 '
HOST-RESOURCES-MIB::hrStorageIndex.4 = INTEGER: 4
HOST-RESOURCES-MIB::hrStorageType.4 = OID: HOST-RESOURCES-TYPES::hrFSBerkeleyFFS
HOST-RESOURCES-MIB::hrStorageDescr.4 = STRING: /, type: ufs, dev: /dev/mfid0s1a
Comment 1 Andrey V. Elsukov freebsd_committer freebsd_triage 2012-06-19 04:49:19 UTC
Responsible Changed
From-To: freebsd-bugs->ae

I have a WIP related to hostres module, so i take it.
Comment 2 Rafael Ganascim 2012-07-26 15:11:36 UTC
To workaround this issue, and to put our network monitoring system
back to work, I made the following patch.

It's very questionable, for example, an FAT partition can be an
removable usb stick. But for our servers being monitored it works
fine.



--- hostres_fs_tbl.c.old	2012-07-26 10:38:27.000000000 -0300
+++ hostres_fs_tbl.c	2012-07-26 10:34:41.000000000 -0300
@@ -125,23 +125,37 @@
 static const struct asn_oid OIDX_hrFSHPFS_c = OIDX_hrFSHPFS;
 static const struct asn_oid OIDX_hrFSUnknown_c = OIDX_hrFSUnknown;

+/* constants from HOSTRESOURCES-TYPES hrStorageTypes */
+static const struct asn_oid OIDX_hrStorageOther_c = OIDX_hrStorageOther;
+static const struct asn_oid OIDX_hrStorageRam_c = OIDX_hrStorageRam;
+static const struct asn_oid OIDX_hrStorageVirtualMemory_c =
OIDX_hrStorageVirtualMemory;
+static const struct asn_oid OIDX_hrStorageFixedDisk_c =
OIDX_hrStorageFixedDisk;
+static const struct asn_oid OIDX_hrStorageRemovableDisk_c =
OIDX_hrStorageRemovableDisk;
+static const struct asn_oid OIDX_hrStorageFloppyDisk_c =
OIDX_hrStorageFloppyDisk;
+static const struct asn_oid OIDX_hrStorageCompactDisc_c =
OIDX_hrStorageCompactDisc;
+static const struct asn_oid OIDX_hrStorageRamDisk_c = OIDX_hrStorageRamDisk;
+static const struct asn_oid OIDX_hrStorageFlashMemory_c =
OIDX_hrStorageFlashMemory;
+static const struct asn_oid OIDX_hrStorageNetworkDisk_c =
OIDX_hrStorageNetworkDisk;
+
+
 /* file system type map */
 static const struct {
 	const char		*str;	/* the type string */
 	const struct asn_oid	*oid;	/* the OID to return */
+	const struct asn_oid	*oidst;	/* the OID of the StorageType to return */
 } fs_type_map[] = {
-	{ "ufs",	&OIDX_hrFSBerkeleyFFS_c },
-	{ "zfs",        &OIDX_hrFSOther_c },
-	{ "cd9660",	&OIDX_hrFSiso9660_c },
-	{ "nfs",	&OIDX_hrFSNFS_c },
-	{ "ext2fs",	&OIDX_hrFSLinuxExt2_c },
-	{ "procfs",	&OIDX_hrFSOther_c },
-	{ "devfs",	&OIDX_hrFSOther_c },
-	{ "msdosfs",	&OIDX_hrFSFAT32_c },
-	{ "ntfs",	&OIDX_hrFSNTFS_c },
-	{ "nwfs",	&OIDX_hrFSNetware_c },
-	{ "hpfs",	&OIDX_hrFSHPFS_c },
-	{ "smbfs",	&OIDX_hrFSOther_c },
+	{ "ufs",	&OIDX_hrFSBerkeleyFFS_c , &OIDX_hrStorageFixedDisk_c},
+	{ "zfs",        &OIDX_hrFSOther_c , &OIDX_hrStorageFixedDisk_c},
+	{ "cd9660",	&OIDX_hrFSiso9660_c , &OIDX_hrStorageCompactDisc_c},
+	{ "nfs",	&OIDX_hrFSNFS_c , &OIDX_hrStorageNetworkDisk_c },
+	{ "ext2fs",	&OIDX_hrFSLinuxExt2_c , &OIDX_hrStorageFixedDisk_c},
+	{ "procfs",	&OIDX_hrFSOther_c , &OIDX_hrStorageOther_c },
+	{ "devfs",	&OIDX_hrFSOther_c , &OIDX_hrStorageOther_c },
+	{ "msdosfs",	&OIDX_hrFSFAT32_c , &OIDX_hrStorageFixedDisk_c},
+	{ "ntfs",	&OIDX_hrFSNTFS_c , &OIDX_hrStorageFixedDisk_c},
+	{ "nwfs",	&OIDX_hrFSNetware_c , &OIDX_hrStorageNetworkDisk_c },
+	{ "hpfs",	&OIDX_hrFSHPFS_c , &OIDX_hrStorageFixedDisk_c},
+	{ "smbfs",	&OIDX_hrFSOther_c , &OIDX_hrStorageNetworkDisk_c},
 };
 #define	N_FS_TYPE_MAP	(sizeof(fs_type_map) / sizeof(fs_type_map[0]))

@@ -329,9 +343,9 @@

 	for (t = 0; t < N_FS_TYPE_MAP; t++)
 		if (strcmp(fs_type_map[t].str, fs_p->f_fstypename) == 0)
-			return (fs_type_map[t].oid);
+			return (fs_type_map[t].oidst);

-	return (&OIDX_hrFSUnknown_c);
+	return (&OIDX_hrStorageOther_c);
 }

 /*
Comment 3 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:58:50 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped