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()
 | 
			
		||||
        ) + '\n',
 | 
			
		||||
    },
 | 
			
		||||
    '/usr/lib/nagios/plugins/check_zpool_online': {
 | 
			
		||||
        'mode': '0755',
 | 
			
		||||
    },
 | 
			
		||||
    '/usr/lib/nagios/plugins/check_zpool_space': {
 | 
			
		||||
        'mode': '0755',
 | 
			
		||||
    },
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -36,6 +36,11 @@ defaults = {
 | 
			
		|||
    },
 | 
			
		||||
    'monitoring': {
 | 
			
		||||
        'services': {
 | 
			
		||||
            'zpool online': {
 | 
			
		||||
                'vars.command': f'/usr/lib/nagios/plugins/check_zpool_online',
 | 
			
		||||
                'check_interval': '1h',
 | 
			
		||||
                'vars.sudo': True,
 | 
			
		||||
            },
 | 
			
		||||
            'zpool space': {
 | 
			
		||||
                'vars.command': f'/usr/lib/nagios/plugins/check_zpool_space',
 | 
			
		||||
            },
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue