RHEL7 check_disk autofs issue

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
yannr
Posts: 4
Joined: Thu Feb 18, 2016 4:27 am

RHEL7 check_disk autofs issue

Post by yannr »

Hello,

I have a different behaviour of check_disk on RHEL6 and RHEL7.
In RHEL7 when I have a nfs mount declared in autofs map it will always mount, even if I say I want to check local disk only.

Exemple on RHEL7 :

Code: Select all

host-rhel7 # cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.2 (Maipo)

host-rhel7 # cat /etc/auto.master
/- /etc/auto.test

host-rhel7 # cat /etc/auto.test
/test -rw,soft,intr,rsize=8192,wsize=8192 xxx:/xxx

host-rhel7 # service autofs status
Redirecting to /bin/systemctl status  autofs.service
● autofs.service - Automounts filesystems on demand
   Loaded: loaded (/usr/lib/systemd/system/autofs.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2016-02-18 10:39:08 CET; 20min ago
  Process: 11499 ExecReload=/usr/bin/kill -HUP $MAINPID (code=exited, status=0/SUCCESS)
  Process: 11074 ExecStart=/usr/sbin/automount $OPTIONS --pid-file /run/autofs.pid (code=exited, status=0/SUCCESS)
 Main PID: 11076 (automount)
   CGroup: /system.slice/autofs.service
           └─11076 /usr/sbin/automount --pid-file /run/autofs.pid

Feb 18 10:39:08 dal-b-cl04 systemd[1]: Starting Automounts filesystems on demand...
Feb 18 10:39:08 dal-b-cl04 systemd[1]: Started Automounts filesystems on demand.

host-rhel7 # ls /test
xxx

host-rhel7 # df|grep test
xxx:/xxx 524288000 413674576 110613424  79% /test

host-rhel7 # umount /test

host-rhel7 # df|grep test

host-rhel7 # ./check_disk --help | head -n1
check_disk v2.1.1 (nagios-plugins 2.1.1)

host-rhel7 # /tmp/check_disk -l |grep test
DISK OK - free space: / 2044 MB (44% inode=70%); /dev 4908 MB (100% inode=99%); /dev/shm 4919 MB (100% inode=99%); /run 4903 MB (99% inode=99%); /sys/fs/cgroup 4919 MB (100% inode=99%); /tmp 905 MB (99% inode=99%); /home 905 MB (99% inode=99%); /opt 4051 MB (87% inode=98%); /var 2697 MB (73% inode=96%); /boot 876 MB (86% inode=99%); /local 4618 MB (99% inode=99%); /run/user/0 369 MB (100% inode=99%); /test 108020 MB (21% inode=95%);| /=2594MB;;;0;4911 /dev=0MB;;;0;4908 /dev/shm=0MB;;;0;4919 /run=16MB;;;0;4919 /sys/fs/cgroup=0MB;;;0;4919 /tmp=3MB;;;0;975 /home=2MB;;;0;975 /opt=587MB;;;0;4911 /var=985MB;;;0;3903 /boot=137MB;;;0;1014 /local=20MB;;;0;4911 /run/user/0=0MB;;;0;369 /test=403979MB;;;0;512000

host-rhel7 #  /tmp/check_disk -l |grep test
host-rhel7 #  

Same example on RHEL 6 :

Code: Select all

host-rhel6 # cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.7 (Santiago)

host-rhel6 # cat /etc/auto.master
/- auto.test

host-rhel6 #  cat /etc/auto.test
/test -rw,soft,intr,rsize=8192,wsize=8192 xxx:/xxx

host-rhel6 #  service autofs status
automount (pid  30908) is running...

host-rhel6 # ls /test
xxx

host-rhel6 # df|grep test
                     524288000 413674576 110613424  79% /test

host-rhel6 # umount /test

host-rhel6 # /tmp/check_disk --help | head -n1
check_disk v2.1.1 (nagios-plugins 2.1.1)

host-rhel6 # /tmp/check_disk -l |grep test

host-rhel6 # 
As you can see on RHEL7 the plugin need to mount the FS once to detect the type, the second time it does not display the NFS. On RHEL6 it work well the first time.

Regards.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: RHEL7 check_disk autofs issue

Post by rkennedy »

Can you try changing your autofs configuration to not reference the auto.test, and have all of your configuration in auto.master? We tested things pretty extensively not too long ago with autofs in this thread https://support.nagios.com/forum/viewto ... 35&t=36593.
Former Nagios Employee
yannr
Posts: 4
Joined: Thu Feb 18, 2016 4:27 am

Re: RHEL7 check_disk autofs issue

Post by yannr »

I do not understand what you mean because on /etc/auto.master I need to specify a map file (cf man auto.master). I can't just copy/paste my /etc/auto.test inside /etc/auto.master.
I have read the topic you mention before posting my case but it's not exactly the same.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: RHEL7 check_disk autofs issue

Post by ssax »

Please post both of your /etc/autofs.conf files so that we can compare them.
yannr
Posts: 4
Joined: Thu Feb 18, 2016 4:27 am

Re: RHEL7 check_disk autofs issue

Post by yannr »

RHEL6 /etc/autofs.conf :

Code: Select all

 # cat  /etc/autofs.conf
#
# Define default options for autofs.
#
[ autofs ]
#
# master_map_name - default map name for the master map.
#
#master_map_name = auto.master
#
# timeout - set the default mount timeout in secons. The internal
#           program default is 10 minutes, but the default installed
#           configuration overrides this and sets the timeout to 5
#           minutes to be consistent with earlier autofs releases.
#
timeout = 300
#
# negative_timeout - set the default negative timeout for
#                    failed mount attempts (default 60).
#
#negative_timeout = 60
#
# mount_wait - time to wait for a response from mount(8).
#              Setting this timeout can cause problems when
#              mount would otherwise wait for a server that
#              is temporarily unavailable, such as when it's
#              restarting. The default setting (-1) of waiting
#              for mount(8) usually results in a wait of around
#              3 minutes.
#
#mount_wait = -1
#
# umount_wait - time to wait for a response from umount(8).
#
#umount_wait = 12
#
# browse_mode - maps are browsable by default.
#
browse_mode = no
#
# mount_nfs_default_protocol - specify the default protocol used by
#                              mount.nfs(8). Since we can't identify
#                              the default automatically we need to
#                              set it in our configuration.
#
#mount_nfs_default_protocol = 3
mount_nfs_default_protocol = 4
#
# append_options - append to global options instead of replace.
#
#append_options = yes
#
# logging - set default log level "none", "verbose" or "debug"
#
#logging = none
#
# force_standard_program_map_env - disable the use of the "AUTOFS_"
#                       prefix for standard environemt variables when
#                       executing a program map. Since program maps
#                       are run as the privileded user this opens
#                       automount(8) to potential user privilege
#                       escalation when the program map is written
#                       in a language that  can load components from,
#                       for example, a user home directory.
#
# force_standard_program_map_env = no
#
# Define base dn for map dn lookup.
#
# Define server URIs
#
# ldap_uri - space seperated list of server uris of the form
#            <proto>://<server>[/] where <proto> can be ldap
#            or ldaps. The option can be given multiple times.
#            Map entries that include a server name override
#            this option.
#
#            This configuration option can also be used to
#            request autofs lookup SRV RRs for a domain of
#            the form <proto>:///[<domain dn>]. Note that a
#            trailing "/" is not allowed when using this form.
#            If the domain dn is not specified the dns domain
#            name (if any) is used to construct the domain dn
#            for the SRV RR lookup. The server list returned
#            from an SRV RR lookup is refreshed according to
#            the minimum ttl found in the SRV RR records or
#            after one hour, whichever is less.
#
#ldap_uri = ""
#
# ldap_timeout - timeout value for the synchronous API  calls
#                 (default is LDAP library default).
#
#ldap_timeout = -1
#
# ldap_network_timeout - set the network response timeout (default 8).
#
#ldap_network_timeout = 8
#
# search_base - base dn to use for searching for map search dn.
#               Multiple entries can be given and they are checked
#               in the order they occur here.
#
#search_base = ""
#
# Define the LDAP schema to used for lookups
#
# If no schema is set autofs will check each of the schemas
# below in the order given to try and locate an appropriate
# basdn for lookups. If you want to minimize the number of
# queries to the server set the values here.
#
#map_object_class = nisMap
#entry_object_class = nisObject
#map_attribute = nisMapName
#entry_attribute = cn
#value_attribute= nisMapEntry
#
# Other common LDAP nameing
#
#map_object_class = automountMap
#entry_object_class = automount
#map_attribute = ou
#entry_attribute = cn
#value_attribute= automountInformation
#
#map_object_class = automountMap
#entry_object_class = automount
#map_attribute = automountMapName
#entry_attribute = automountKey
#value_attribute= automountInformation
#
# auth_conf_file - set the default location for the SASL
#                  authentication configuration file.
#
#auth_conf_file = /etc/autofs_ldap_auth.conf
#
# map_hash_table_size - set the map cache hash table size.
#                       Should be a power of 2 with a ratio roughly
#                       between 1:10 and 1:20 for each map.
#
#map_hash_table_size = 1024
#
#
# Otions for the amd parser within autofs.
#
# amd configuration options that are aren't used, haven't been
# implemented or have different behaviour within autofs.
#
# A number of the amd configuration options are not used by autofs,
# some because they are not relevant within autofs, some because
# they are done differently in autofs and others that are not yet
# implemented.
#
# Since "mount_type" is always autofs (because there's no user space
# NFS server) the configuration entries relating to that aren't used.
# Also, server availability is done differently within autofs so the
# options that relate to the amd server monitoring sub-system are
# also not used.
#
# These options are mount_type, auto_attrcache, portmap_program,
# nfs_vers_ping, nfs_allow_any_interface, nfs_allow_insecure_port,
# nfs_proto, nfs_retransmit_counter, nfs_retransmit_counter_udp,
# nfs_retransmit_counter_tcp, nfs_retransmit_counter_toplvl,
# nfs_retry_interval, nfs_retry_interval_udp, nfs_retry_interval_tcp,
# nfs_retry_interval_toplvl and nfs_vers.
#
#
# Other options that are not used within the autofs implementation:
#
# log_file, truncate_log - autofs used either stderr when running in
#       the foreground or sends its output to syslog so an alternate
#       log file (or truncating the log) can't be used.
#
# print_pid - there's no corresponding option for this within autofs.
#
# use_tcpwrappers, show_statfs_entries - there's no user space NFS
#       server to control access to so this option isn't relevant.
#       The show_statfs_entries can't be implemented for the same
#       reason.
#
# debug_mtab_file - there's no user space NFS server and autofs
#       avoids using file based mtab whenever possible.
#
# sun_map_syntax - obviously, are provided by autofs itself.
#
# plock, show_statfs_entries, preferred_amq_port - not supported.
#
# ldap_cache_maxmem, ldap_cache_seconds - external ldap caching
#       is not used by autofs.
#
# ldap_proto_version - autofs always attempts to use the highest
#       available ldap protocol version.
#
# cache_duration, map_reload_interval, map_options - the map
#       entry cache is continually updated and stale entries
#       cleaned on re-load, which is done when map changes are
#       detected so these configuration entries are not used
#       by autofs.
#
# localhost_address - is not used within autofs. This
#       configuration option was only used in the amd user
#       space server code and is not relevant within autofs.
#
#
# Options that are handled differently within autofs:
#
# pid_file - must be given as a command line option on startup.
#
# print_version - program version and feature information is obtained
#       by using the automount command line option "-V".
#
# debug_options, log_options - autofs has somewhat more limited
#       logging and debug logging options. When the log_options
#       options is encountered it is converted to the nearest
#       matching autofs logging option. Since the configuration
#       option debug_options would be handled the same way it
#       is ignored.
#
# restart_mounts - has no sensible meaning within autofs because autofs
#       always tries to re-connect to existing mounts. While this
#       has its own set of problems not re-connecting to existing
#       mounts always results in a non-functional automount tree if
#       mounts were busy at the last shutdown (as is also the case
#       with amd when using mount_type autofs).
#
# forced_unmounts - detaching mounts often causes serious problems
#       for users of existing mounts. It is used by autofs in some
#       cases, either at the explicit request of the user (with a
#       command line or init option) and in some special cases during
#       program operation but is avoided whenever possible.
#
#
# A number of configuration options are not yet implemented:
#
# fully_qualified_hosts - not yet implemented.
#
# unmount_on_exit - since autofs always tries to re-connect
#       to mounts left mounted from a previous shutdown this
#       is a sensible option to implement and that will be
#       done.
#
# browsable_dirs - not yet implemented.
#
# exec_map_timeout - a timeout is not currently used for
#       for program maps, might be implemented.
#
# tag - the tag option is not implemented within autofs.
#
#
# Supported options:
#
# arch, karch, os, osver - these options default to what is returned
#       from uname(2) and can be overridden if required.
#
# full_os - has no default and must be set in the configuration
#       if used in maps.
#
# cluster - if not set defaults to the host domain name. This option
#       corresponds to the HP_UX cluster name (according to the amd
#       source) and is probably not used in Linux but is set anyway.
#
# vendor - has a default value of "unknown", it must be set in the
#       configuration if used in maps.
#
# auto_dir - is the base name of the mount tree used for external
#       mounts that are sometimes needed by amd maps. Its default
#       value is "/a".
#
# map_type - specifies the autofs map source, such as file, nis,
#       ldap etc. and has no default value set.
#
# map_defaults - is used to override /defaults entries within maps
#       and can be used to provide different defaults on specific
#       machines without having to modify centrally managed maps.
#       It is empty by default.
#
# search_path - colon seperated paths to search for maps that
#       are not specified as a full path.
#
# dismount_interval - is equivalent to the autofs timeout option. It
#       is only possible to use this with type "auto" mounts due
#       to the way the autofs kernel module performs expiry. It
#       takes its default value from the autofs internal default
#       of 600 seconds.
#
# autofs_use_lofs - if set to "yes" autofs will attempt to use bind
#       mounts for type "auto" when possible.
#
# nis_domain - allows setting of a domain name other than the system
#       default.
#
# local_domain - is used to override (or set) the host domain name.
#
# normalize_hostnames - if set to "yes" then the contents of ${rhost}
#       is translated in its official host name.
#
# domain_strip - if set to "yes" the domain name part of the host
#       is strippped when normalizing hostnames. This can be useful
#       when using of the same maps in a multiple domain environment.
#
# normalize_slashes - is set to "yes" by default and will collapse
#       multiple unescaped occurrences of "/" to a single "/".
#
# selectors_in_defaults, selectors_on_default - has a default value
#       of "no". If set to "yes" then any defaults entry will be
#       checked for selectors to determine the values to be used.
#       selectors_in_defaults is the preferred option to use.
#
# ldap_base - has no default value. It must be set to the base dn
#       that is used for queries if ldap is to be used as a map
#       source.
#
# ldap_hostports - has no default value set. It must be set to
#       the URI of the LDAP server to be used for lookups when
#       ldap is used a map source. It may contain a comma or
#       space seperated list of LDAP URIs.
#
# hesiod_base - the base name used for hesiod map sources.
#
# Additional configuration options added:
#
# linux_ufs_mount_type - set the default system filesystem type that's
#       used for mount type ufs. There's no simple way to determine
#       what the system default filesystem is and am-utils needs to
#       be continually updated to do this and can easily get it wrong
#       anyway.
#
#
# Define global options for the amd parser within autofs.
#
[ amd ]
#
# Override the internal default with the same timeout that
# is used by the override in the autofs configuration, sanity
# only change.
#
dismount_interval = 300
#
# map_type = file
#
# Overriding this can cause autofs to use less resources because
# it will use symlinks instead of bind mounts in certain cases.
# You should ensure that the autofs kernel module your using
# supports expration of symlinks for best results (although this
# appears to work reasonably well most of the time without the
# update).
#
# autofs_use_lofs = yes
#
# Several configuration options can be set per mount point.
# In particulr map_type, map_name, map_defaults, search_path,
# browsable_dirs, dismount_interval and selectors_in_defaults
# (not all of which are currently implemented, see above).
#
# Also, if a section for an amd mount point is defined here
# it isn't necessary to specify the format in the corresponding
# master map entry and the format will be inherited for type
# "auto" mounts.
#
# [ /expamle/mount ]
# dismount_interval = 60
# map_type = nis
RHEL7 /etc/autofs.conf :

Code: Select all

#
# Define default options for autofs.
#
[ autofs ]
#
# master_map_name - default map name for the master map.
#
#master_map_name = auto.master
#
# timeout - set the default mount timeout in secons. The internal
#           program default is 10 minutes, but the default installed
#           configuration overrides this and sets the timeout to 5
#           minutes to be consistent with earlier autofs releases.
#
timeout = 300
#
# negative_timeout - set the default negative timeout for
#                    failed mount attempts (default 60).
#
#negative_timeout = 60
#
# mount_wait - time to wait for a response from mount(8).
#              Setting this timeout can cause problems when
#              mount would otherwise wait for a server that
#              is temporarily unavailable, such as when it's
#              restarting. The default setting (-1) of waiting
#              for mount(8) usually results in a wait of around
#              3 minutes.
#
#mount_wait = -1
#
# umount_wait - time to wait for a response from umount(8).
#
#umount_wait = 12
#
# browse_mode - maps are browsable by default.
#
browse_mode = no
#
# mount_nfs_default_protocol - specify the default protocol used by
#                              mount.nfs(8). Since we can't identify
#                              the default automatically we need to
#                              set it in our configuration.
#
#mount_nfs_default_protocol = 3
mount_nfs_default_protocol = 4
#
# append_options - append to global options instead of replace.
#
#append_options = yes
#
# logging - set default log level "none", "verbose" or "debug"
#
#logging = none
#
# force_standard_program_map_env - disable the use of the "AUTOFS_"
#                       prefix for standard environemt variables when
#                       executing a program map. Since program maps
#                       are run as the privileded user this opens
#                       automount(8) to potential user privilege
#                       escalation when the program map is written
#                       in a language that  can load components from,
#                       for example, a user home directory.
#
# force_standard_program_map_env = no
#
# Define base dn for map dn lookup.
#
# Define server URIs
#
# ldap_uri - space seperated list of server uris of the form
#            <proto>://<server>[/] where <proto> can be ldap
#            or ldaps. The option can be given multiple times.
#            Map entries that include a server name override
#            this option.
#
#            This configuration option can also be used to
#            request autofs lookup SRV RRs for a domain of
#            the form <proto>:///[<domain dn>]. Note that a
#            trailing "/" is not allowed when using this form.
#            If the domain dn is not specified the dns domain
#            name (if any) is used to construct the domain dn
#            for the SRV RR lookup. The server list returned
#            from an SRV RR lookup is refreshed according to
#            the minimum ttl found in the SRV RR records or
#            after one hour, whichever is less.
#
#ldap_uri = ""
#
# ldap_timeout - timeout value for the synchronous API  calls
#                 (default is LDAP library default).
#
#ldap_timeout = -1
#
# ldap_network_timeout - set the network response timeout (default 8).
#
#ldap_network_timeout = 8
#
# search_base - base dn to use for searching for map search dn.
#               Multiple entries can be given and they are checked
#               in the order they occur here.
#
#search_base = ""
#
# Define the LDAP schema to used for lookups
#
# If no schema is set autofs will check each of the schemas
# below in the order given to try and locate an appropriate
# basdn for lookups. If you want to minimize the number of
# queries to the server set the values here.
#
#map_object_class = nisMap
#entry_object_class = nisObject
#map_attribute = nisMapName
#entry_attribute = cn
#value_attribute= nisMapEntry
#
# Other common LDAP nameing
#
#map_object_class = automountMap
#entry_object_class = automount
#map_attribute = ou
#entry_attribute = cn
#value_attribute= automountInformation
#
#map_object_class = automountMap
#entry_object_class = automount
#map_attribute = automountMapName
#entry_attribute = automountKey
#value_attribute= automountInformation
#
# auth_conf_file - set the default location for the SASL
#                  authentication configuration file.
#
#auth_conf_file = /etc/autofs_ldap_auth.conf
#
# map_hash_table_size - set the map cache hash table size.
#                       Should be a power of 2 with a ratio of
#                       close to 1:8 for acceptable performance
#                       with maps up to around 8000 entries.
#                       See autofs.conf(5) for more details.
#
#map_hash_table_size = 1024
#
#
# Otions for the amd parser within autofs.
#
# amd configuration options that are aren't used, haven't been
# implemented or have different behaviour within autofs.
#
# A number of the amd configuration options are not used by autofs,
# some because they are not relevant within autofs, some because
# they are done differently in autofs and others that are not yet
# implemented.
#
# Since "mount_type" is always autofs (because there's no user space
# NFS server) the configuration entries relating to that aren't used.
# Also, server availability is done differently within autofs so the
# options that relate to the amd server monitoring sub-system are
# also not used.
#
# These options are mount_type, auto_attrcache, portmap_program,
# nfs_vers_ping, nfs_allow_any_interface, nfs_allow_insecure_port,
# nfs_proto, nfs_retransmit_counter, nfs_retransmit_counter_udp,
# nfs_retransmit_counter_tcp, nfs_retransmit_counter_toplvl,
# nfs_retry_interval, nfs_retry_interval_udp, nfs_retry_interval_tcp,
# nfs_retry_interval_toplvl and nfs_vers.
#
#
# Other options that are not used within the autofs implementation:
#
# log_file, truncate_log - autofs used either stderr when running in
#       the foreground or sends its output to syslog so an alternate
#       log file (or truncating the log) can't be used.
#
# print_pid - there's no corresponding option for this within autofs.
#
# use_tcpwrappers, show_statfs_entries - there's no user space NFS
#       server to control access to so this option isn't relevant.
#       The show_statfs_entries can't be implemented for the same
#       reason.
#
# debug_mtab_file - there's no user space NFS server and autofs
#       avoids using file based mtab whenever possible.
#
# sun_map_syntax - obviously, are provided by autofs itself.
#
# plock, show_statfs_entries, preferred_amq_port - not supported.
#
# ldap_cache_maxmem, ldap_cache_seconds - external ldap caching
#       is not used by autofs.
#
# ldap_proto_version - autofs always attempts to use the highest
#       available ldap protocol version.
#
# cache_duration, map_reload_interval, map_options - the map
#       entry cache is continually updated and stale entries
#       cleaned on re-load, which is done when map changes are
#       detected so these configuration entries are not used
#       by autofs.
#
# localhost_address - is not used within autofs. This
#       configuration option was only used in the amd user
#       space server code and is not relevant within autofs.
#
#
# Options that are handled differently within autofs:
#
# pid_file - must be given as a command line option on startup.
#
# print_version - program version and feature information is obtained
#       by using the automount command line option "-V".
#
# debug_options, log_options - autofs has somewhat more limited
#       logging and debug logging options. When the log_options
#       options is encountered it is converted to the nearest
#       matching autofs logging option. Since the configuration
#       option debug_options would be handled the same way it
#       is ignored.
#
# restart_mounts - has no sensible meaning within autofs because autofs
#       always tries to re-connect to existing mounts. While this
#       has its own set of problems not re-connecting to existing
#       mounts always results in a non-functional automount tree if
#       mounts were busy at the last shutdown (as is also the case
#       with amd when using mount_type autofs).
#
# forced_unmounts - detaching mounts often causes serious problems
#       for users of existing mounts. It is used by autofs in some
#       cases, either at the explicit request of the user (with a
#       command line or init option) and in some special cases during
#       program operation but is avoided whenever possible.
#
#
# A number of configuration options are not yet implemented:
#
# fully_qualified_hosts - not yet implemented.
#
# unmount_on_exit - since autofs always tries to re-connect
#       to mounts left mounted from a previous shutdown this
#       is a sensible option to implement and that will be
#       done.
#
# browsable_dirs - not yet implemented.
#
# exec_map_timeout - a timeout is not currently used for
#       for program maps, might be implemented.
#
# tag - the tag option is not implemented within autofs.
#
#
# Supported options:
#
# arch, karch, os, osver - these options default to what is returned
#       from uname(2) and can be overridden if required.
#
# full_os - has no default and must be set in the configuration
#       if used in maps.
#
# cluster - if not set defaults to the host domain name. This option
#       corresponds to the HP_UX cluster name (according to the amd
#       source) and is probably not used in Linux but is set anyway.
#
# vendor - has a default value of "unknown", it must be set in the
#       configuration if used in maps.
#
# auto_dir - is the base name of the mount tree used for external
#       mounts that are sometimes needed by amd maps. Its default
#       value is "/a".
#
# map_type - specifies the autofs map source, such as file, nis,
#       ldap etc. and has no default value set.
#
# map_defaults - is used to override /defaults entries within maps
#       and can be used to provide different defaults on specific
#       machines without having to modify centrally managed maps.
#       It is empty by default.
#
# search_path - colon seperated paths to search for maps that
#       are not specified as a full path.
#
# dismount_interval - is equivalent to the autofs timeout option. It
#       is only possible to use this with type "auto" mounts due
#       to the way the autofs kernel module performs expiry. It
#       takes its default value from the autofs internal default
#       of 600 seconds.
#
# autofs_use_lofs - if set to "yes" autofs will attempt to use bind
#       mounts for type "auto" when possible.
#
# nis_domain - allows setting of a domain name other than the system
#       default.
#
# local_domain - is used to override (or set) the host domain name.
#
# normalize_hostnames - if set to "yes" then the contents of ${rhost}
#       is translated in its official host name.
#
# domain_strip - if set to "yes" the domain name part of the host
#       is strippped when normalizing hostnames. This can be useful
#       when using of the same maps in a multiple domain environment.
#
# normalize_slashes - is set to "yes" by default and will collapse
#       multiple unescaped occurrences of "/" to a single "/".
#
# selectors_in_defaults, selectors_on_default - has a default value
#       of "no". If set to "yes" then any defaults entry will be
#       checked for selectors to determine the values to be used.
#       selectors_in_defaults is the preferred option to use.
#
# ldap_base - has no default value. It must be set to the base dn
#       that is used for queries if ldap is to be used as a map
#       source.
#
# ldap_hostports - has no default value set. It must be set to
#       the URI of the LDAP server to be used for lookups when
#       ldap is used a map source. It may contain a comma or
#       space seperated list of LDAP URIs.
#
# hesiod_base - the base name used for hesiod map sources.
#
# Additional configuration options added:
#
# linux_ufs_mount_type - set the default system filesystem type that's
#       used for mount type ufs. There's no simple way to determine
#       what the system default filesystem is and am-utils needs to
#       be continually updated to do this and can easily get it wrong
#       anyway.
#
#
# Define global options for the amd parser within autofs.
#
[ amd ]
#
# Override the internal default with the same timeout that
# is used by the override in the autofs configuration, sanity
# only change.
#
dismount_interval = 300
#
# map_type = file
#
# Overriding this can cause autofs to use less resources because
# it will use symlinks instead of bind mounts in certain cases.
# You should ensure that the autofs kernel module your using
# supports expration of symlinks for best results (although this
# appears to work reasonably well most of the time without the
# update).
#
# autofs_use_lofs = yes
#
# Several configuration options can be set per mount point.
# In particulr map_type, map_name, map_defaults, search_path,
# browsable_dirs, dismount_interval and selectors_in_defaults
# (not all of which are currently implemented, see above).
#
# Also, if a section for an amd mount point is defined here
# it isn't necessary to specify the format in the corresponding
# master map entry and the format will be inherited for type
# "auto" mounts.
#
# [ /expamle/mount ]
# dismount_interval = 60
# map_type = nis
I have done a diff between the two files and there is no difference at all, exception from comment.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: RHEL7 check_disk autofs issue

Post by rkennedy »

I can try to replicate this, one thing - what version of autofs are you running on both machines?

Code: Select all

automount --version
Former Nagios Employee
yannr
Posts: 4
Joined: Thu Feb 18, 2016 4:27 am

Re: RHEL7 check_disk autofs issue

Post by yannr »

host-rhel6 # automount --version

Code: Select all

Linux automount version 5.0.5-113.el6

Directories:
        config dir:     /etc/sysconfig
        maps dir:       /etc
        modules dir:    /usr/lib64/autofs

Compile options:
  DISABLE_MOUNT_LOCKING ENABLE_IGNORE_BUSY_MOUNTS WITH_HESIOD WITH_LDAP
  WITH_SASL LIBXML2_WORKAROUND WITH_LIBTIRPC
host-rhel7 # automount --version

Code: Select all

Linux automount version 5.0.7-54.el7

Directories:
        config dir:     /etc/sysconfig
        maps dir:       /etc
        modules dir:    /usr/lib64/autofs

Compile options:
  DISABLE_MOUNT_LOCKING ENABLE_IGNORE_BUSY_MOUNTS WITH_HESIOD WITH_LDAP
  WITH_SASL LIBXML2_WORKAROUND WITH_LIBTIRPC
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: RHEL7 check_disk autofs issue

Post by jolson »

I did some testing, and everything functioned appropriately. Nevermind! See edit at the bottom of this post.

On NFS server:

Code: Select all

[root@localhost ~]# cat /etc/exports
/centos6 192.168.x.x(rw,sync,no_subtree_check,no_root_squash)
/centos7 192.168.x.x(rw,sync,no_subtree_check,no_root_squash)
On CentOS 6:

Code: Select all

[root@localhost ~]# cat /etc/*relea*
CentOS release 6.7 (Final)

Code: Select all

[root@localhost ~]# mount | tail -1
192.168.x.x:/centos6 on /centos6 type nfs (rw,soft,intr,rsize=8192,wsize=8192,sloppy,vers=4,addr=192.168.x.x,clientaddr=192.168.x.x)

Code: Select all

[root@localhost ~]# df | grep cent
192.168.x.x:/centos6
18348032 3237176  15110856  18% /centos6

Code: Select all

[root@localhost ~]# /usr/local/nagios/libexec/check_disk -l | grep cent
[root@localhost ~]

Code: Select all

[root@localhost ~]# /usr/local/nagios/libexec/check_disk -w 2 -c 1 | grep cent
DISK OK - free space: / 4696 MB (66% inode=83%); /dev/shm 497 MB (100% inode=99%); /boot 380 MB (84% inode=99%); /centos6 14756 MB (82% inode=99%);| /=2388MB;7468;7469;0;7470 /dev/shm=0MB;495;496;0;497 /boot=70MB;474;475;0;476 /centos6=3161MB;17916;17917;0;17918

Code: Select all

[root@localhost ~]# yum info autofs
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.cs.uwp.edu
 * epel: mirror.steadfast.net
 * extras: cosmos.illinois.edu
 * rpmforge: mirror.team-cymru.org
 * updates: centos.firehosted.com
Installed Packages
Name        : autofs
Arch        : x86_64
Epoch       : 1
Version     : 5.0.5
Release     : 113.el6
Size        : 4.6 M
Repo        : installed
From repo   : base
Summary     : A tool for automatically mounting and unmounting filesystems
URL         : http://wiki.autofs.net/
License     : GPLv2+
Description : autofs is a daemon which automatically mounts filesystems when you use
            : them, and unmounts them later when you are not using them.  This can
            : include network filesystems, CD-ROMs, floppies, and so forth.

On CentOS 7:

Code: Select all

[root@localhost centos7]# cat /etc/*relea*
CentOS Linux release 7.2.1511 (Core)

Code: Select all

[root@localhost centos7]# mount | tail -2
192.168.x.x:/centos7 on /centos7 type nfs4 (rw,relatime,vers=4.0,rsize=8192,wsize=8192,namlen=255,soft,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=192.168.x.x,local_lock=none,addr=192.168.x.x)

Code: Select all

[root@localhost centos7]# df | grep cent
192.168.x.x:/centos7   18348032 3237160  15110872  18% /centos7

Code: Select all

[root@localhost centos7]# /usr/local/nagios/libexec/check_disk -l | grep cent
[root@localhost centos7]#

Code: Select all

[root@localhost centos7]# /usr/local/nagios/libexec/check_disk -w 2 -c 1 | grep cent
DISK OK - free space: / 16606 MB (92% inode=99%); /dev 478 MB (100% inode=99%); /dev/shm 488 MB (100% inode=99%); /run 482 MB (98% inode=99%); /sys/fs/cgroup 488 MB (100% inode=99%); /boot 332 MB (67% inode=99%); /run/user/0 97 MB (100% inode=99%); /centos7 14756 MB (82% inode=99%);| /=1271MB;17876;17877;0;17878 /dev=0MB;476;477;0;478 /dev/shm=0MB;486;487;0;488 /run=6MB;486;487;0;488 /sys/fs/cgroup=0MB;486;487;0;488 /boot=163MB;494;495;0;496 /run/user/0=0MB;95;96;0;97 /centos7=3161MB;17916;17917;0;17918

Code: Select all

[root@localhost centos7]# yum info autofs
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.cisp.com
 * extras: centos.mirror.lstn.net
 * updates: mirrors.gigenet.com
Installed Packages
Name        : autofs
Arch        : x86_64
Epoch       : 1
Version     : 5.0.7
Release     : 54.el7
Size        : 5.0 M
Repo        : installed
From repo   : base
Summary     : A tool for automatically mounting and unmounting filesystems
License     : GPLv2+
Description : autofs is a daemon which automatically mounts filesystems when you use
            : them, and unmounts them later when you are not using them.  This can
            : include network filesystems, CD-ROMs, floppies, and so forth.
Do you see any differences in the above? I tried reproducing your setup as exactly as possible, and I don't think I made any mistakes - everything works appropriately for me. Is your /etc/exports any different than mine?

EDIT:

Whoa! Nevermind, after an unmount everything doesn't work as expected:

CentOS 6:

Code: Select all

[root@localhost ~]# umount /centos6/
[root@localhost ~]# /usr/local/nagios/libexec/check_disk -w 2 -c 1 -l | grep cent
[root@localhost ~]#
CentOS 7:

Code: Select all

[root@localhost ~]# umount /centos7/
[root@localhost ~]# /usr/local/nagios/libexec/check_disk -w 2 -c 1 -l | grep cent
DISK OK - free space: / 16606 MB (92% inode=99%); /dev 478 MB (100% inode=99%); /dev/shm 488 MB (100% inode=99%); /run 482 MB (98% inode=99%); /sys/fs/cgroup 488 MB (100% inode=99%); /boot 332 MB (67% inode=99%); /run/user/0 97 MB (100% inode=99%); /centos7 14756 MB (82% inode=99%);| /=1271MB;17876;17877;0;17878 /dev=0MB;476;477;0;478 /dev/shm=0MB;486;487;0;488 /run=6MB;486;487;0;488 /sys/fs/cgroup=0MB;486;487;0;488 /boot=163MB;494;495;0;496 /run/user/0=0MB;95;96;0;97 /centos7=3161MB;17916;17917;0;17918
[root@localhost ~]# /usr/local/nagios/libexec/check_disk -w 2 -c 1 -l | grep cent
[root@localhost ~]#
A will file a but report here after collecting my findings:
https://github.com/nagios-plugins/nagios-plugins/issues

Bug report filed: https://github.com/nagios-plugins/nagio ... issues/141
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
Locked