|
|
23ac29 |
diff -urNp b/agent/mibgroup/hardware/fsys/fsys_mntctl.c net-snmp-5.8/agent/mibgroup/hardware/fsys/fsys_mntctl.c
|
|
|
23ac29 |
--- b/agent/mibgroup/hardware/fsys/fsys_mntctl.c 2018-07-18 16:12:20.674499629 +0200
|
|
|
23ac29 |
+++ net-snmp-5.8/agent/mibgroup/hardware/fsys/fsys_mntctl.c 2018-07-18 16:15:46.782859398 +0200
|
|
|
23ac29 |
@@ -43,8 +43,9 @@ _fsys_type( int type)
|
|
|
23ac29 |
|
|
|
23ac29 |
case MNT_NFS:
|
|
|
23ac29 |
case MNT_NFS3:
|
|
|
23ac29 |
- case MNT_AUTOFS:
|
|
|
23ac29 |
return NETSNMP_FS_TYPE_NFS;
|
|
|
23ac29 |
+ case MNT_AUTOFS:
|
|
|
23ac29 |
+ return NETSNMP_FS_TYPE_AUTOFS;
|
|
|
23ac29 |
|
|
|
23ac29 |
/*
|
|
|
23ac29 |
* The following code covers selected filesystems
|
|
|
23ac29 |
@@ -156,10 +157,12 @@ netsnmp_fsys_arch_load( void )
|
|
|
23ac29 |
|
|
|
23ac29 |
/*
|
|
|
23ac29 |
* Optionally skip retrieving statistics for remote mounts
|
|
|
23ac29 |
+ * AUTOFS is skipped by default
|
|
|
23ac29 |
*/
|
|
|
23ac29 |
- if ( (entry->flags & NETSNMP_FS_FLAG_REMOTE) &&
|
|
|
23ac29 |
+ if ( ((entry->flags & NETSNMP_FS_FLAG_REMOTE) &&
|
|
|
23ac29 |
netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
|
|
|
23ac29 |
- NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES))
|
|
|
23ac29 |
+ NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES)) ||
|
|
|
23ac29 |
+ entry->type == (NETSNMP_FS_TYPE_AUTOFS))
|
|
|
23ac29 |
continue;
|
|
|
23ac29 |
|
|
|
23ac29 |
if ( statfs( entry->path, &stat_buf ) < 0 ) {
|
|
|
23ac29 |
diff -urNp b/agent/mibgroup/hardware/fsys/fsys_mntent.c net-snmp-5.8/agent/mibgroup/hardware/fsys/fsys_mntent.c
|
|
|
23ac29 |
--- b/agent/mibgroup/hardware/fsys/fsys_mntent.c 2018-07-18 16:12:20.674499629 +0200
|
|
|
23ac29 |
+++ net-snmp-5.8/agent/mibgroup/hardware/fsys/fsys_mntent.c 2018-07-18 16:15:46.782859398 +0200
|
|
|
23ac29 |
@@ -150,6 +150,13 @@ _fsys_type( char *typename )
|
|
|
23ac29 |
!strcmp(typename, MNTTYPE_LOFS))
|
|
|
23ac29 |
return NETSNMP_FS_TYPE_OTHER;
|
|
|
23ac29 |
|
|
|
23ac29 |
+ /* Detection of AUTOFS.
|
|
|
23ac29 |
+ * This file system will be ignored by default
|
|
|
23ac29 |
+ */
|
|
|
23ac29 |
+ else if ( !strcmp(typename, MNTTYPE_AUTOFS))
|
|
|
23ac29 |
+ return NETSNMP_FS_TYPE_AUTOFS;
|
|
|
23ac29 |
+
|
|
|
23ac29 |
+
|
|
|
23ac29 |
/*
|
|
|
23ac29 |
* All other types are silently skipped
|
|
|
23ac29 |
*/
|
|
|
23ac29 |
@@ -239,6 +246,10 @@ netsnmp_fsys_arch_load( void )
|
|
|
23ac29 |
NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES))
|
|
|
23ac29 |
continue;
|
|
|
23ac29 |
|
|
|
23ac29 |
+ /* Skip AUTOFS enteries */
|
|
|
23ac29 |
+ if ( entry->type == (NETSNMP_FS_TYPE_AUTOFS))
|
|
|
23ac29 |
+ continue;
|
|
|
23ac29 |
+
|
|
|
23ac29 |
#ifdef irix6
|
|
|
23ac29 |
if ( NSFS_STATFS( entry->path, &stat_buf, sizeof(struct statfs), 0) < 0 )
|
|
|
23ac29 |
#else
|
|
|
23ac29 |
diff -urNp b/agent/mibgroup/hardware/fsys/mnttypes.h net-snmp-5.8/agent/mibgroup/hardware/fsys/mnttypes.h
|
|
|
23ac29 |
--- b/agent/mibgroup/hardware/fsys/mnttypes.h 2018-07-18 16:12:20.674499629 +0200
|
|
|
23ac29 |
+++ net-snmp-5.8/agent/mibgroup/hardware/fsys/mnttypes.h 2018-07-18 16:15:46.782859398 +0200
|
|
|
23ac29 |
@@ -165,6 +165,9 @@
|
|
|
23ac29 |
#ifndef MNTTYPE_APP
|
|
|
23ac29 |
#define MNTTYPE_APP "app"
|
|
|
23ac29 |
#endif
|
|
|
23ac29 |
+#ifndef MNTTYPE_AUTOFS
|
|
|
23ac29 |
+#define MNTTYPE_AUTOFS "autofs"
|
|
|
23ac29 |
+#endif
|
|
|
23ac29 |
#ifndef MNTTYPE_DEVPTS
|
|
|
23ac29 |
#define MNTTYPE_DEVPTS "devpts"
|
|
|
23ac29 |
#endif
|
|
|
23ac29 |
diff -urNp b/agent/mibgroup/host/hr_filesys.c net-snmp-5.8/agent/mibgroup/host/hr_filesys.c
|
|
|
23ac29 |
--- b/agent/mibgroup/host/hr_filesys.c 2018-07-18 16:12:20.668499652 +0200
|
|
|
23ac29 |
+++ net-snmp-5.8/agent/mibgroup/host/hr_filesys.c 2018-07-18 16:15:46.783859399 +0200
|
|
|
23ac29 |
@@ -834,6 +834,27 @@ Check_HR_FileSys_NFS (void)
|
|
|
23ac29 |
return 0; /* no NFS file system */
|
|
|
23ac29 |
}
|
|
|
23ac29 |
|
|
|
23ac29 |
+/* This function checks whether current file system is an AutoFs
|
|
|
23ac29 |
+ * HRFS_entry must be valid prior to calling this function
|
|
|
23ac29 |
+ * return 1 if AutoFs, 0 otherwise
|
|
|
23ac29 |
+ */
|
|
|
23ac29 |
+int
|
|
|
23ac29 |
+Check_HR_FileSys_AutoFs (void)
|
|
|
23ac29 |
+{
|
|
|
23ac29 |
+#if HAVE_GETFSSTAT
|
|
|
23ac29 |
+ if ( HRFS_entry->HRFS_type != NULL &&
|
|
|
23ac29 |
+#if defined(MNTTYPE_AUTOFS)
|
|
|
23ac29 |
+ !strcmp( HRFS_entry->HRFS_type, MNTTYPE_AUTOFS)
|
|
|
23ac29 |
+#else
|
|
|
23ac29 |
+ !strcmp( HRFS_entry->HRFS_type, "autofs")
|
|
|
23ac29 |
+#endif
|
|
|
23ac29 |
+ )
|
|
|
23ac29 |
+#endif /* HAVE_GETFSSTAT */
|
|
|
23ac29 |
+ return 1; /* AUTOFS */
|
|
|
23ac29 |
+
|
|
|
23ac29 |
+ return 0; /* no AUTOFS */
|
|
|
23ac29 |
+}
|
|
|
23ac29 |
+
|
|
|
23ac29 |
void
|
|
|
23ac29 |
End_HR_FileSys(void)
|
|
|
23ac29 |
{
|
|
|
23ac29 |
diff -urNp b/agent/mibgroup/host/hr_filesys.h net-snmp-5.8/agent/mibgroup/host/hr_filesys.h
|
|
|
23ac29 |
--- b/agent/mibgroup/host/hr_filesys.h 2018-07-18 16:12:20.669499648 +0200
|
|
|
23ac29 |
+++ net-snmp-5.8/agent/mibgroup/host/hr_filesys.h 2018-07-18 16:15:46.784859400 +0200
|
|
|
23ac29 |
@@ -10,6 +10,7 @@ extern void Init_HR_FileSys(void);
|
|
|
23ac29 |
extern FindVarMethod var_hrfilesys;
|
|
|
23ac29 |
extern int Get_Next_HR_FileSys(void);
|
|
|
23ac29 |
extern int Check_HR_FileSys_NFS(void);
|
|
|
23ac29 |
+extern int Check_HR_FileSys_AutoFs(void);
|
|
|
23ac29 |
|
|
|
23ac29 |
extern int Get_FSIndex(char *);
|
|
|
23ac29 |
extern long Get_FSSize(char *); /* Temporary */
|
|
|
23ac29 |
diff -urNp b/agent/mibgroup/host/hrh_filesys.c net-snmp-5.8/agent/mibgroup/host/hrh_filesys.c
|
|
|
23ac29 |
--- b/agent/mibgroup/host/hrh_filesys.c 2018-07-18 16:12:20.668499652 +0200
|
|
|
23ac29 |
+++ net-snmp-5.8/agent/mibgroup/host/hrh_filesys.c 2018-07-18 16:15:46.785859402 +0200
|
|
|
23ac29 |
@@ -429,3 +429,9 @@ Check_HR_FileSys_NFS (void)
|
|
|
23ac29 |
{
|
|
|
23ac29 |
return (HRFS_entry->flags & NETSNMP_FS_FLAG_REMOTE) ? 1 : 0;
|
|
|
23ac29 |
}
|
|
|
23ac29 |
+
|
|
|
23ac29 |
+int
|
|
|
23ac29 |
+Check_HR_FileSys_AutoFs (void)
|
|
|
23ac29 |
+{
|
|
|
23ac29 |
+ return (HRFS_entry->type == (NETSNMP_FS_TYPE_AUTOFS)) ? 1 : 0;
|
|
|
23ac29 |
+}
|
|
|
23ac29 |
diff -urNp b/agent/mibgroup/host/hrh_filesys.h net-snmp-5.8/agent/mibgroup/host/hrh_filesys.h
|
|
|
23ac29 |
--- b/agent/mibgroup/host/hrh_filesys.h 2018-07-18 16:12:20.669499648 +0200
|
|
|
23ac29 |
+++ net-snmp-5.8/agent/mibgroup/host/hrh_filesys.h 2018-07-18 16:15:46.785859402 +0200
|
|
|
23ac29 |
@@ -10,6 +10,7 @@ extern void Init_HR_FileSys(void);
|
|
|
23ac29 |
extern FindVarMethod var_hrhfilesys;
|
|
|
23ac29 |
extern int Get_Next_HR_FileSys(void);
|
|
|
23ac29 |
extern int Check_HR_FileSys_NFS(void);
|
|
|
23ac29 |
+extern int Check_HR_FileSys_AutoFs(void);
|
|
|
23ac29 |
|
|
|
23ac29 |
extern int Get_FSIndex(char *);
|
|
|
23ac29 |
extern long Get_FSSize(char *); /* Temporary */
|
|
|
23ac29 |
diff -urNp b/agent/mibgroup/host/hrh_storage.c net-snmp-5.8/agent/mibgroup/host/hrh_storage.c
|
|
|
23ac29 |
--- b/agent/mibgroup/host/hrh_storage.c 2018-07-18 16:12:20.668499652 +0200
|
|
|
23ac29 |
+++ net-snmp-5.8/agent/mibgroup/host/hrh_storage.c 2018-07-18 16:15:46.786859402 +0200
|
|
|
23ac29 |
@@ -367,9 +367,10 @@ really_try_next:
|
|
|
23ac29 |
store_idx = name[ HRSTORE_ENTRY_NAME_LENGTH ];
|
|
|
23ac29 |
if (HRFS_entry &&
|
|
|
23ac29 |
store_idx > NETSNMP_MEM_TYPE_MAX &&
|
|
|
23ac29 |
- netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
|
|
|
23ac29 |
+ ((netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
|
|
|
23ac29 |
NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES) &&
|
|
|
23ac29 |
- Check_HR_FileSys_NFS())
|
|
|
23ac29 |
+ Check_HR_FileSys_NFS()) ||
|
|
|
23ac29 |
+ Check_HR_FileSys_AutoFs()))
|
|
|
23ac29 |
return NULL;
|
|
|
23ac29 |
if (store_idx <= NETSNMP_MEM_TYPE_MAX ) {
|
|
|
23ac29 |
mem = (netsnmp_memory_info*)ptr;
|
|
|
23ac29 |
@@ -508,7 +509,8 @@ Get_Next_HR_Store(void)
|
|
|
23ac29 |
if (HRS_index >= 0) {
|
|
|
23ac29 |
if (!(netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
|
|
|
23ac29 |
NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES) &&
|
|
|
23ac29 |
- Check_HR_FileSys_NFS())) {
|
|
|
23ac29 |
+ Check_HR_FileSys_NFS()) &&
|
|
|
23ac29 |
+ !Check_HR_FileSys_AutoFs()) {
|
|
|
23ac29 |
return HRS_index + NETSNMP_MEM_TYPE_MAX;
|
|
|
23ac29 |
}
|
|
|
23ac29 |
} else {
|
|
|
23ac29 |
diff -urNp b/agent/mibgroup/host/hr_storage.c net-snmp-5.8/agent/mibgroup/host/hr_storage.c
|
|
|
23ac29 |
--- b/agent/mibgroup/host/hr_storage.c 2018-07-18 16:12:20.670499644 +0200
|
|
|
23ac29 |
+++ net-snmp-5.8/agent/mibgroup/host/hr_storage.c 2018-07-18 16:15:46.786859402 +0200
|
|
|
23ac29 |
@@ -540,9 +540,10 @@ really_try_next:
|
|
|
23ac29 |
|
|
|
23ac29 |
store_idx = name[ HRSTORE_ENTRY_NAME_LENGTH ];
|
|
|
23ac29 |
if (store_idx > NETSNMP_MEM_TYPE_MAX ) {
|
|
|
23ac29 |
- if ( netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
|
|
|
23ac29 |
+ if ( (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
|
|
|
23ac29 |
NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES) &&
|
|
|
23ac29 |
- Check_HR_FileSys_NFS())
|
|
|
23ac29 |
+ Check_HR_FileSys_NFS()) ||
|
|
|
23ac29 |
+ Check_HR_FileSys_AutoFs())
|
|
|
23ac29 |
return NULL; /* or goto try_next; */
|
|
|
23ac29 |
if (HRFS_statfs(HRFS_entry->HRFS_mount, &stat_buf) < 0) {
|
|
|
23ac29 |
snmp_log_perror(HRFS_entry->HRFS_mount);
|
|
|
23ac29 |
@@ -683,7 +684,8 @@ Get_Next_HR_Store(void)
|
|
|
23ac29 |
if (HRS_index >= 0) {
|
|
|
23ac29 |
if (!(netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
|
|
|
23ac29 |
NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES) &&
|
|
|
23ac29 |
- Check_HR_FileSys_NFS())) {
|
|
|
23ac29 |
+ Check_HR_FileSys_NFS()) &&
|
|
|
23ac29 |
+ !Check_HR_FileSys_AutoFs()) {
|
|
|
23ac29 |
return HRS_index + NETSNMP_MEM_TYPE_MAX;
|
|
|
23ac29 |
}
|
|
|
23ac29 |
} else {
|
|
|
23ac29 |
diff -urNp b/include/net-snmp/agent/hardware/fsys.h net-snmp-5.8/include/net-snmp/agent/hardware/fsys.h
|
|
|
23ac29 |
--- b/include/net-snmp/agent/hardware/fsys.h 2018-07-18 16:12:20.649499726 +0200
|
|
|
23ac29 |
+++ net-snmp-5.8/include/net-snmp/agent/hardware/fsys.h 2018-07-18 16:19:33.994918912 +0200
|
|
|
23ac29 |
@@ -41,6 +41,7 @@ typedef struct netsnmp_fsys_info_s netsn
|
|
|
23ac29 |
#define NETSNMP_FS_TYPE_SYSFS (4 | _NETSNMP_FS_TYPE_LOCAL | _NETSNMP_FS_TYPE_SKIP_BIT)
|
|
|
23ac29 |
#define NETSNMP_FS_TYPE_TMPFS (5 | _NETSNMP_FS_TYPE_LOCAL)
|
|
|
23ac29 |
#define NETSNMP_FS_TYPE_USBFS (6 | _NETSNMP_FS_TYPE_LOCAL)
|
|
|
23ac29 |
+#define NETSNMP_FS_TYPE_AUTOFS (7 | _NETSNMP_FS_TYPE_LOCAL | _NETSNMP_FS_TYPE_SKIP_BIT)
|
|
|
23ac29 |
|
|
|
23ac29 |
#define NETSNMP_FS_FLAG_ACTIVE 0x01
|
|
|
23ac29 |
#define NETSNMP_FS_FLAG_REMOTE 0x02
|