Ad Widget

Collapse

Linux - How to monitor local and NFS filesystems in /etc/fstab

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • niall.porter
    Junior Member
    • Jun 2021
    • 8

    #1

    Linux - How to monitor local and NFS filesystems in /etc/fstab

    Hello,

    We have Zabbix 5.4.3, agents are currently mostly 4.0.something but we will upgrade them soon. We wish to have all the agents monitor all filesystems defined in /etc/fstab - currently it only seems to pick up local disk filesystems such as root, /boot etc. We want it to include NFS filesystems also, and to be able to alert us when any monitored filesystem from /etc/fstab becomes unmounted. Is this possible?
  • niall.porter
    Junior Member
    • Jun 2021
    • 8

    #2
    Thanks for that. We found that after I posted originally so we've added nfs to that list. That's only half the battle though - now we get alerts for space usage going above thresholds, but we don't get any alerts when a filesystem goes offline. We have issues where sometimes some of our servers in Azure lose their NFS mounts from on-premise storage devices so we need to be able to monitor when a filesystem (local or NFS) in /etc/fstab becomes unmounted.

    Comment

    • niall.porter
      Junior Member
      • Jun 2021
      • 8

      #3
      Thanks for those. I've got a UserParameter which generates a list of filesystems defined in /etc/fstab and I have this defined in a Discovery Rule in a template, but I'm struggling to get another one working, to return a 1 if each filesystem is mounted and 0 if it is not. The UserParameter looks like this:

      Code:
      UserParameter=filesystem.mounted[*],df | grep -c $1
      Running "df | grep -c <mountpoint>" on a shell at the client machine does return a 1 or 0. I can see that the discovery rule created an item for each filesystem but I'm not seeing anything under Last Check or Last Value in the Latest Data view for the system I'm testing with. Am I missing something here?

      Comment

      • niall.porter
        Junior Member
        • Jun 2021
        • 8

        #4
        Hi, thanks - I got it working, turns out one of the examples I'd followed had the Item Prototype set to zero history, this apparently disables data collection for that item. Once I set it to 7d it started checking those items so we now have a slightly rough but working solution for discovery and monitoring the mounted status of filesystems in /etc/fstab. I'll try and tidy it up a little and submit to Zabbix Share.

        Comment

        • gert.derouck
          Member
          • Jan 2020
          • 69

          #5
          I'd like to add a note to this...
          You're running a df command for collecting the status of an nfs filesystem... Unfortunately this df command will hang on most unix machines, when an nfs filesystem is unreachable....

          We parse the messages file for checking NFS share unavailability...

          Comment

          • niall.porter
            Junior Member
            • Jun 2021
            • 8

            #6
            Thanks for that. Good point, although we find it depends on the mount options - if an NFS share is hard mounted then yes, df etc. will hang but not on soft mounts. Regards the second point, the issue that prompted this was a number of SLES systems in Azure with NFS mounts which have become unavailable/unmounted, with no mention of this at all in the messages file so that's not a reliable check in our environment either really.

            Will findmnt also hang if it attempts to check an NFS filesystem which has become unreachable?

            Comment

            Working...