5.2 KiB
Zabbix Template Module NFS version 1.0.0
Tested on Zabbix 4.4 to 7.0
Introduction
Template for Zabbix to check nfs share availability using external script. It can check:
- If NFS server is accepting request
- If NFS share are available
- The NFS server version
Requirement
The script use the commands showmount & rpcinfo so it requires the Linux package nfs-common
To install it you can use the package manager of your distribution
Exemple
apt-get install nfs-common
By the way you may require sudoer rights to run the command.
On Linux NFS server you may need to install rpcbind service to get information from rpcinfo command
Installation
Content
The template installation require 3 files:
frogg_nfs_check.shZabbix external scriptzabbix_template.*Zabbix template configurationuserparameter_frogg_nfs_check.confZabbix shortcut for a clean call
Introduction
The script will be launched by Zabbix server, testing if client nfs share is available using a script. That mean Zabbix network must be able to see nfs sharing of the client on the network.
- All the files are installed on Zabbix server, none is required on the client.
- Your network must allow Zabbix server to see nfs share of the client
- First check your external script folder, in most of new version you can find it in
/usr/lib/zabbix/externalscriptsYou can find the ExternalScripts folder in your/etc/zabbix/zabbix_server.conf(default location)
### Option: ExternalScripts
# Full path to location of external scripts.
# Default depends on compilation options.
# To see the default path run command "zabbix_server --help".
#
# Mandatory: no
# Default:
# ExternalScripts=${datadir}/zabbix/externalscripts
ExternalScripts=/usr/lib/zabbix/externalscripts
- For a cleaner script calling this template now use
userparameterfile, You can verify the path stored in your/etc/zabbix/zabbix_agentd.conf(default location)
### Option: Include
# You may include individual files or all files in a directory in the configuration file.
# Installing Zabbix will create include directory in /usr/local/etc, unless modified during the compile time.
#
# Mandatory: no
# Default:
# Include=
Include=/etc/zabbix/zabbix_agentd.d/*.conf
If /etc/zabbix/zabbix_agentd.conf.d/ doesn't exist you can create it
External script
Scripts
Place the frogg_nfs_check.sh in /usr/lib/zabbix/externalscripts.
You will need to add execute permission on the script
chmod +x frogg_nfs_check.sh
User parameters
Add the userparameter_frogg_nfs_check.conf to /etc/zabbix/zabbix_agentd.conf.d/ (default location)
Testing the installation
You can run the command:
- To Test NFS version
./frogg_nfs_check.sh version <ip-of-server>
- To Test NFS share
./frogg_nfs_check.sh share <ip-of-server> "/nfsShare1,/nfsShare2,/nfsShare3"
Template
Then you need to import the zabbix_template.* template configuration file in the Zabbix web interface in Template tab using the import button
Host configuration
The template use 2 macros :
| MACRO | Description |
|---|---|
| {$NFSVERSION} | the NFS version that should be returned by the server |
| {$NFSSHARES} | the list of NFS shares that should be available, to set multiple shares they must be separated by , |
Template items
Template triggers
Debugging
Going further...This step is working with most of the externals scripts
If you got troubles getting an external script working, first :
- Check the Zabbix tab Monitoring > latest data If you select a host, you should see all items linked to it, check for your item, and you should see the lasted data linked to it. If it appears in gray (disabled) that mean there is something wrong with the external script (rights, path, arguments ...) To find more about it, you can check logs
- By default, the logs are in
/var/log/zabbix/zabbix_server.logor you can find the log path in Zabbix configuration filezabbix_server.conf(by default/etc/zabbix/zabbix_server.conf)
To get the last log lines you can use for example:
tail -f /var/log/zabbix/zabbix_server.log
Then look at the script trouble...
Example:
In this case Zabbix cannot find the path of the script as you can see no such file or directory


