nag empty dir; document configuration
This commit is contained in:
		
							
								
								
									
										40
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										40
									
								
								README.md
									
									
									
									
									
								
							@@ -21,3 +21,43 @@ mountpoint.sh
 | 
				
			|||||||
Icinga plugin to check whether a given path is available. Detects
 | 
					Icinga plugin to check whether a given path is available. Detects
 | 
				
			||||||
problems, e.g. with glusterfs: In case of a problem, there is an error
 | 
					problems, e.g. with glusterfs: In case of a problem, there is an error
 | 
				
			||||||
message such as "socket not connected". Called with path to check.
 | 
					message such as "socket not connected". Called with path to check.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Installation
 | 
				
			||||||
 | 
					============
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Install
 | 
				
			||||||
 | 
					-------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Checkout to a path, e.g. `/opt/icinga-checks`:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    cd /opt
 | 
				
			||||||
 | 
					    sudo git co https://mrw.sh/admin-scripts/icinga-checks.git
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Update
 | 
				
			||||||
 | 
					------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    cd /opt/icinga-checks
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Configure
 | 
				
			||||||
 | 
					---------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Go to [Icinga Director](https://mrw.sh/docker/icingaweb2), in `Commands` add one:
 | 
				
			||||||
 | 
					 - Command type: `Plugin Check Command`
 | 
				
			||||||
 | 
					 - Command name: `load per cpu`
 | 
				
			||||||
 | 
					 - Command: `check_by_ssh`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					After adding the command, add the following parameters:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    -C /opt/icinga-checks/load_per_cpu.sh
 | 
				
			||||||
 | 
					    -H $host.name$
 | 
				
			||||||
 | 
					    -oStrictHostKeyChecking=no
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The last argument `-oStrictHostKeyChecking=no` is a key only ith no value.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					To check mountpoint of `/var/volumes` use argument name `-C` with value `/opt/icinga-checks/mountpount.sh /var/volumes`.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Then create a new Service Template, give it a name. e.g. `load per cpu` and assign the check command just created.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Finally add a service, again you can use the same name and import the template just created, then assign the hosts to check. I use a host template for all linux servers, so the command is run in each of them.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Don't forget to deploy the activity log in Icinga Director.
 | 
				
			||||||
@@ -48,8 +48,13 @@ if /usr/bin/time -f "elapsed=%es" -qo $time ls "$path" > $out 2> $err && test -s
 | 
				
			|||||||
        STATUS="WARNING - ${path}:"
 | 
					        STATUS="WARNING - ${path}:"
 | 
				
			||||||
    fi        
 | 
					    fi        
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
    level=2
 | 
					    if test -s $err; then
 | 
				
			||||||
    STATUS="CRITICAL - $(<$err):"
 | 
					        level=2
 | 
				
			||||||
 | 
					        STATUS="CRITICAL - $(<$err):"
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					        level=1
 | 
				
			||||||
 | 
					        STATUS="CRITICAL - ${path} is empty:"
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
echo ${STATUS} $(<$time)
 | 
					echo ${STATUS} $(<$time)
 | 
				
			||||||
rm $time $out $err 2>&1 > /dev/null
 | 
					rm $time $out $err 2>&1 > /dev/null
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user