[ZBXNEXT-580] Support {#FSTYPE} for "vfs.fs.discovery" key out of the box. Created: 2010 Dec 12  Updated: 2011 Dec 22  Resolved: 2011 Oct 26

Status: Closed
Project: ZABBIX FEATURE REQUESTS
Component/s: Agent (G)
Affects Version/s: None
Fix Version/s: 1.9.8 (beta)

Type: Change Request Priority: Critical
Reporter: Oleksii Zagorskyi Assignee: Unassigned
Resolution: Fixed Votes: 4
Labels: discovery, lld
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

latest trunk



 Description   

If we define the key "vfs.fs.discovery" for Windows and for Linux we get all the file systems, including absolutely unnecessary file systems. For example in windows floppy-drive A, and optical drives. In Linux for example the FS like /dev, /proc, others.

Presented an example script in the documentation is good, but I'm sure it must be supported by an agent of the box.
Without the ability to filter by the

{#FSTYPE}

macro, FS discovery feature is quite inconvenient.

There is only one drawback - a cool JSON-format example in the documentation will have to change - you need to come up with yet another cool example to demonstrate JSON-format



 Comments   
Comment by Brad Crowder [ 2011 Sep 28 ]

Two Diffs to add #FSTYPE to JSON result for vfs.fs.discovery for Linux and HPUX, (first is linux, second is hpux)

— diskspace.c.orig 2011-09-28 14:06:45.000000000 -0400
+++ diskspace.c 2011-09-28 14:09:21.000000000 -0400
@@ -102,7 +102,7 @@
int VFS_FS_DISCOVERY(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result)
{
int ret = SYSINFO_RET_FAIL;

  • char line[MAX_STRING_LEN], *p, *mpoint;
    + char line[MAX_STRING_LEN], *p, *mpoint,*mtype;
    FILE *f;
    struct zbx_json j;

@@ -124,8 +124,16 @@

*p = '\0';

+ mtype = ++p;
+
+ if (NULL == (p = strstr(mtype, " ")))
+ continue;
+
+ *p = '\0';
+
zbx_json_addobject(&j, NULL);
zbx_json_addstring(&j, "

{#FSNAME}", mpoint, ZBX_JSON_TYPE_STRING);
+ zbx_json_addstring(&j, "{#FSTYPE}", mtype, ZBX_JSON_TYPE_STRING);
zbx_json_close(&j);
}

---------------------------------------------------------------------------------------------------
— diskspace.c.orig 2011-09-10 00:10:56 -0700
+++ diskspace.c 2011-09-28 11:14:57 -0700
@@ -179,6 +179,7 @@
{
zbx_json_addobject(&j, NULL);
zbx_json_addstring(&j, "{#FSNAME}

", mt->mnt_dir, ZBX_JSON_TYPE_STRING);
+ zbx_json_addstring(&j, "

{#FSTYPE}

", mt->mnt_type, ZBX_JSON_TYPE_STRING);
zbx_json_close(&j);
}

Comment by Aleksandrs Saveljevs [ 2011 Oct 24 ]

Added

{#FSTYPE}

and tested on the following platforms:

AIX: AIX 5.2, AIX 6.1 (also see http://api.kde.org/4.x-api/kdelibs-apidocs/kdecore/html/kmountpoint_8cpp_source.html for how KDE does it)
HP-UX: HP-UX 11.11
Linux: Linux 2.6 (should work on Linux 2.4, too)
Solaris: Solaris 10
Windows: Windows 2008 Server

Added vfs.fs.discovery and tested on the following platforms:

FreeBSD: FreeBSD 4.2 and FreeBSD 6.2 (after working around ZBX-4178), FreeBSD 7.3
NetBSD: NetBSD 5.0
OpenBSD: OpenBSD 3.9 and OpenBSD 4.6 (after working around ZBX-4179)

Comment by Aleksandrs Saveljevs [ 2011 Oct 25 ]

Updated documentation at http://www.zabbix.com/documentation/2.0/manual/discovery/low_level_discovery .

<richlv> i liked the filtering example, so i returned it to that page. please, review

<asaveljevs> OK, CLOSED.

Comment by Aleksandrs Saveljevs [ 2011 Oct 26 ]

Updated documentation at http://www.zabbix.com/documentation/2.0/manual/appendix/items/supported_by_platform, because support for "vfs.fs.discovery" was added for FreeBSD, NetBSD, and OpenBSD.

Comment by Alexander Vladishev [ 2011 Oct 27 ]

Has tested support of a macro {$FSTYPE} on next platforms:

  • Linux 2.6 and Linux 2.4.
  • Windows 7 Professional
  • FreeBSD 4.2, 6.2, 7.1, 7.3
  • NetBSD 5.0
  • OpenBSD 3.9, 4.7
  • Solaris 11
  • HP-UX B.11.31 Itanium
  • AIX 5.2, 6.1
Comment by Aleksandrs Saveljevs [ 2011 Nov 02 ]

Available in pre-1.9.8 in r22899.

Comment by Oleksii Zagorskyi [ 2011 Nov 02 ]

Thank you Aleksandrs !

Now I'm happy
And the solution for drawback with the cool JSON-format example in the documentation is EXCELLENT !!!

Comment by Michael OBrien [ 2011 Nov 30 ]

Any way we could get Win2003 support out of the box? I've tested XP, 2008, 2008 R2, and Win7 - All work great. I'm a bit surprised that 2003 doesn't work, given XP does.

Comment by Oleksii Zagorskyi [ 2011 Dec 01 ]

Michael, I cannot confirm.

It works for Win 2003 server. I tried 3 different machines, always successfully:

  1. zabbix_get -s 1.1.1.1 -k vfs.fs.discovery
    {
    "vfs.fs.discovery":[
    Unknown macro: { "{#FSNAME}":"C:
    ",
    "{#FSTYPE}":"NTFS"},
    {
    "{#FSNAME}"}

    ,

    Unknown macro: { "{#FSNAME}"}

    ]}

  1. zabbix_get -s 1.1.1.1 -k system.uname
    Windows HOSTNAME 5.2.3790 Windows Server 2003 Service Pack 2 Intel IA-32
  1. zabbix_get -s 1.1.1.1 -k agent.version
    1.9.8
Generated at Fri Apr 19 18:20:02 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.