Check path-rw-test¶
Overview¶
Tests if a path is writable and readable by creating, writing, reading, and deleting a temporary file. Especially useful for mounted filesystems such as NFS or SMB where the mount may silently become read-only or unresponsive. The local temporary directory is always tested as a baseline. Alerts if the path is not writable or readable.
Data Collection:
May require root or sudo depending on the paths being tested
Creates a temporary file in each specified path (and always in the system’s temp directory)
Writes a test string, reads it back, then deletes the temporary file
Reports which paths failed and which were tested
Fact Sheet¶
Fact |
Value |
|---|---|
Check Plugin Download |
https://github.com/Linuxfabrik/monitoring-plugins/tree/main/check-plugins/path-rw-test |
Nagios/Icinga Check Name |
|
Check Interval Recommendation |
Every minute |
Can be called without parameters |
Yes |
Runs on |
Cross-platform |
Compiled for Windows |
Yes |
Help¶
usage: path-rw-test [-h] [-V] [--always-ok] [--path PATH]
[--severity {warn,crit}]
Tests if a path is writable and readable by creating, writing, reading, and
deleting a temporary file. Especially useful for mounted filesystems such as
NFS or SMB where the mount may silently become read-only or unresponsive. The
local temporary directory is always tested as a baseline. Alerts if the path
is not writable or readable. Requires root or sudo.
options:
-h, --help show this help message and exit
-V, --version show program's version number and exit
--always-ok Always returns OK.
--path PATH Path to test for read/write access by creating and
deleting a temporary file. Can be specified multiple
times. Default: ['/tmp']
--severity {warn,crit}
Severity for alerting. Default: warn
Usage Examples¶
./path-rw-test --path /mnt/nfs --path /mnt/smb --path /usr --severity warn
Output:
Error creating/writing/reading/deleting file in `/usr` ([Errno 13] Permission denied: '/usr/tmptbt8daho'). Tested: /tmp, /mnt/nfs, /mnt/smb, /usr
States¶
OK if all paths are writable and readable.
WARN if
--severityis set towarn(default) and any path fails the read/write test.CRIT if
--severityis set tocritand any path fails the read/write test.--always-oksuppresses all alerts and always returns OK.
Perfdata / Metrics¶
There is no perfdata.
Credits, License¶
Authors: Linuxfabrik GmbH, Zurich
License: The Unlicense, see LICENSE file.