inventory of NFS servers

28 views
Skip to first unread message

Aleksey Tsalolikhin

unread,
Mar 20, 2019, 3:19:43 PM3/20/19
to help-cfengine
Hello -- we wrote a promise to inventory any mounted NFS servers (by parsing them out of /proc/mounts on the Linux servers that are the NFS clients) so that Ops can list affected hosts (NFS clients) during an NFS server outage.  Nick thought this might make a good addition to the stock masterfiles.

Anybody for? Against?  =)


  classes:
    linux:: # /proc/mounts is specific to Linux
      "hasnfs"
        scope => "namespace",
        meta => { "report", "docinv=Presence of NFS mounts" },
        expression => regline(".*\snfs\s.*", "/proc/mounts");

  vars:
    hasnfs::
      "nfs_servers_slist"
        slist => maplist( regex_replace( $(this) , ":.*", "", "g"),
                          # NFS server is before the colon (:), that's all we want
                          # e.g., nfs.example.com:/vol/homedir/user1 /home/user1 ...
                          #       ^^^^^^^^^^^^^^^
                          grep( ".* nfs .*",
                                readstringlist("/proc/mounts", "", "\n", inf, inf)
                              )
                        );

    hasnfs::
      "nfs_server[$(nfs_servers_slist)]"
        string => "$(nfs_servers_slist)",
        meta => { "docinv=NFS servers (to list hosts impacted by NFS outages)", "report" };



Best,
Aleksey
-- 
Achieve real learning.  Email trai...@verticalsysadmin.com.

Marco Marongiu

unread,
Mar 21, 2019, 3:41:09 AM3/21/19
to Aleksey Tsalolikhin, +1-323-393-0779, help-cfengine
Against? Hell why? :-D


--
You received this message because you are subscribed to the Google Groups "help-cfengine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to help-cfengin...@googlegroups.com.
To post to this group, send email to help-c...@googlegroups.com.
Visit this group at https://groups.google.com/group/help-cfengine.
For more options, visit https://groups.google.com/d/optout.

Ted Zlatanov

unread,
Apr 19, 2019, 9:44:20 AM4/19/19
to help-c...@googlegroups.com
On Wed, 20 Mar 2019 12:19:05 -0700 Aleksey Tsalolikhin <ale...@verticalsysadmin.com> wrote:

AT> Hello -- we wrote a promise to inventory any mounted NFS servers (by
AT> parsing them out of /proc/mounts on the Linux servers that are the NFS
AT> clients) so that Ops can list affected hosts (NFS clients) during an NFS
AT> server outage. Nick thought this might make a good addition to the stock
AT> masterfiles.

I'd make it a generic parser and put it with the other proc parsers in
the startup C code. No need to make it NFS-specific, there's lots of
useful stuff in the mounts.

There's also storage promises...

Ted

Aleksey Tsalolikhin

unread,
Apr 19, 2019, 10:01:24 AM4/19/19
to help-cfengine

-- 
Achieve real learning.  Email trai...@verticalsysadmin.com.


That's a little outside my league...  I like the idea though!

David Lee

unread,
Apr 23, 2019, 6:31:03 AM4/23/19
to help-cfengine
Additionally, generic "/proc" parsing could also be beneficial to CFE-1655 and related issues (replacing the parsing of 'ps' output).

-- David
Reply all
Reply to author
Forward
0 new messages