Created
November 1, 2016 18:08
-
-
Save ccooke/d0c31edfaa01f11bcc06f539f0bfee28 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Zabbix LLD to show mounted filesystems that use true block devices (for use with items such as vfs.dev.read/write) | |
exec 3<"/proc/mounts" | |
echo -n '{"data":[' | |
opts=( FSDEV FSNAME FSTYPE FSOPTS FSDUMPFREQ FSDUMPPASS ) | |
linesep="" while read -u3 -a line; do | |
[[ -b "${line[0]}" ]] || continue echo -n "$linesep" linesep="}," | |
sep='{' | |
i=0 | |
for field in "${opts[@]}"; do | |
printf '%s"{#%s}":"%s"' "$sep" "$field" "${line[i]}" | |
sep=',' | |
(( i++ )) | |
done | |
done | |
echo "}]}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example: