Skip to content

Instantly share code, notes, and snippets.

@brutus
Created July 24, 2018 08:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brutus/25d0944e5ca04a901cebac3e2997b6d0 to your computer and use it in GitHub Desktop.
Save brutus/25d0944e5ca04a901cebac3e2997b6d0 to your computer and use it in GitHub Desktop.
systemd automount NFS partitions and icinga disk check
# /etc/systemd/system/misc-backup.automount
[Unit]
Description=Automount for NFS backup share from 'host.domain.com'
Requisite=network-online.target
After=network-online.service
[Automount]
Where=/misc/backup
TimeoutIdleSec=60
[Install]
WantedBy=multi-user.target
# /etc/systemd/system/misc-backup.mount
[Unit]
Description=Mountpoint for NFS backup share from 'host.domain.com'
Requisite=network-online.target
After=network-online.service
[Mount]
What=host.domain.com:/hostname
Where=/misc/backup
Type=nfs
Options=ro,fg,soft,timeo=5,retry=5,nfsvers=4.1
DirectoryMode=0555
TimeoutSec=30 seconds
[Install]
WantedBy=multi-user.target

I have a mount and automount unit pair for systemd, that mounts a NFS share from another host when needed. It is unmounted automatically after 60 seconds of idle time. Works fine so far.

But if I active an Icinga2 disk check - running every minute - it prevents the mount to go idle, or causes already unmounted ones to get mounted; as seen in the journal for the automount unit:

Jul 23 14:53:19 host.domain.com systemd[1]: Got automount request for /misc/backup, triggered by 24289 (check_disk)

I tried to prevent this by setting disk_local in the GUI (Only check local filesystems. May be true or false.) and adding disk_ignore_eregi_path to the GUI and setting it to /misc/*. To no avail.

Any hints on how to ignore the mount point for the check, so it can idle and get unmounted automatically?

  • centos: 7
  • systemd: 219
  • icinga: 2.5.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment