zpool check online
This commit is contained in:
parent
047403c2a5
commit
e897ef6898
3 changed files with 24 additions and 0 deletions
16
bundles/zfs/files/check_zpool_online
Executable file
16
bundles/zfs/files/check_zpool_online
Executable file
|
@ -0,0 +1,16 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
for pool in $(zpool get name -H -o value)
|
||||||
|
do
|
||||||
|
status=$(zpool get health -H -o value $pool)
|
||||||
|
if [ "$status" != ONLINE ]
|
||||||
|
then
|
||||||
|
errors="$error\"$pool\" status is $status\n"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "$errors" != "" ]
|
||||||
|
then
|
||||||
|
echo "CRITICAL - $errors"
|
||||||
|
exit 2
|
||||||
|
fi
|
|
@ -14,6 +14,9 @@ files = {
|
||||||
for k, v in node.metadata.get('zfs/kernel_params').items()
|
for k, v in node.metadata.get('zfs/kernel_params').items()
|
||||||
) + '\n',
|
) + '\n',
|
||||||
},
|
},
|
||||||
|
'/usr/lib/nagios/plugins/check_zpool_online': {
|
||||||
|
'mode': '0755',
|
||||||
|
},
|
||||||
'/usr/lib/nagios/plugins/check_zpool_space': {
|
'/usr/lib/nagios/plugins/check_zpool_space': {
|
||||||
'mode': '0755',
|
'mode': '0755',
|
||||||
},
|
},
|
||||||
|
|
|
@ -36,6 +36,11 @@ defaults = {
|
||||||
},
|
},
|
||||||
'monitoring': {
|
'monitoring': {
|
||||||
'services': {
|
'services': {
|
||||||
|
'zpool online': {
|
||||||
|
'vars.command': f'/usr/lib/nagios/plugins/check_zpool_online',
|
||||||
|
'check_interval': '1h',
|
||||||
|
'vars.sudo': True,
|
||||||
|
},
|
||||||
'zpool space': {
|
'zpool space': {
|
||||||
'vars.command': f'/usr/lib/nagios/plugins/check_zpool_space',
|
'vars.command': f'/usr/lib/nagios/plugins/check_zpool_space',
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue