|
| 1 | + |
| 2 | +# Invoke-IcingaCheckDirectory |
| 3 | + |
| 4 | +## Description |
| 5 | + |
| 6 | +Checks how many files are in a directory. |
| 7 | + |
| 8 | +Invoke-IcingaCheckDirectory returns either 'OK', 'WARNING' or 'CRITICAL', based on the thresholds set. |
| 9 | +e.g 'C:\Users\Icinga\Backup' contains 200 files, WARNING is set to 150, CRITICAL is set to 300. In this case the check will return CRITICAL |
| 10 | +More Information on https://github.com/Icinga/icinga-powershell-plugins |
| 11 | + |
| 12 | +## Arguments |
| 13 | + |
| 14 | +| Argument | Type | Required | Default | Description | |
| 15 | +| --- | --- | --- | --- | --- | |
| 16 | +| Path | String | false | | Used to specify a path. e.g. 'C:\Users\Icinga\Downloads' | |
| 17 | +| FileNames | Array | false | | Used to specify an array of filenames or expressions to match against. e.g '*.txt', '*.sql' # Fiends all files ending with .txt and .sql | |
| 18 | +| Recurse | SwitchParameter | false | False | A switch, which can be set to filter through directories recursively. | |
| 19 | +| Critical | Object | false | | Used to specify a Critical threshold. In this case an integer value. | |
| 20 | +| Warning | Object | false | | Used to specify a Warning threshold. In this case an integer value. | |
| 21 | +| ChangeTimeEqual | String | false | | String that expects input format like "20d", which translates to 20 days. Allowed units: ms, s, m, h, d, w, M, y. Thereby all files which have been changed 20 days ago are considered within the check. | |
| 22 | +| ChangeYoungerThan | String | false | | String that expects input format like "20d", which translates to 20 days. Allowed units: ms, s, m, h, d, w, M, y. Thereby all files which have a change date younger then 20 days are considered within the check. | |
| 23 | +| ChangeOlderThan | String | false | | String that expects input format like "20d", which translates to 20 days. Allowed units: ms, s, m, h, d, w, M, y. Thereby all files which have a change date older then 20 days are considered within the check. | |
| 24 | +| CreationTimeEqual | String | false | | String that expects input format like "20d", which translates to 20 days. Allowed units: ms, s, m, h, d, w, M, y. Thereby all files which have been created 20 days ago are considered within the check. | |
| 25 | +| CreationOlderThan | String | false | | String that expects input format like "20d", which translates to 20 days. Allowed units: ms, s, m, h, d, w, M, y. Thereby all files which have a creation date older then 20 days are considered within the check. | |
| 26 | +| CreationYoungerThan | String | false | | String that expects input format like "20d", which translates to 20 days. Allowed units: ms, s, m, h, d, w, M, y. Thereby all files which have a creation date younger then 20 days are considered within the check. | |
| 27 | +| FileSizeGreaterThan | String | false | | | |
| 28 | +| FileSizeSmallerThan | String | false | | | |
| 29 | +| Verbosity | Int32 | false | 0 | | |
| 30 | +| NoPerfData | SwitchParameter | false | False | | |
| 31 | + |
| 32 | +## Examples |
| 33 | + |
| 34 | +### Example Command 1 |
| 35 | + |
| 36 | +```powershell |
| 37 | +Invoke-IcingaCheckDirectory -Path "C:\Users\Icinga\Downloads" -Warning 20 -Critical 30 -Verbosity 3 |
| 38 | +``` |
| 39 | + |
| 40 | +### Example Output 1 |
| 41 | + |
| 42 | +```powershell |
| 43 | +[OK]: Check package "C:\Users\Icinga\Downloads" is [OK] (Match All) \_ [OK]: C:\Users\Icinga\Downloads is 19 |
| 44 | +``` |
| 45 | + |
| 46 | +### Example Command 2 |
| 47 | + |
| 48 | +```powershell |
| 49 | +Invoke-IcingaCheckDirectory -Path "C:\Users\Icinga\Downloads" -Warning 20 -Critical 30 -Verbosity 3 |
| 50 | +``` |
| 51 | + |
| 52 | +### Example Output 2 |
| 53 | + |
| 54 | +```powershell |
| 55 | +[WARNING]: Check package "C:\Users\Icinga\Downloads" is [WARNING] (Match All) \_ [WARNING]: C:\Users\Icinga\Downloads is 24 |
| 56 | +``` |
| 57 | + |
| 58 | +### Example Command 3 |
| 59 | + |
| 60 | +```powershell |
| 61 | +Invoke-IcingaCheckDirectory -Path "C:\Users\Icinga\Downloads" -Warning 20 -Critical 30 -Verbosity 3 -ChangeYoungerThen 20d -ChangeOlderThen 10d |
| 62 | +``` |
| 63 | + |
| 64 | +### Example Output 3 |
| 65 | + |
| 66 | +```powershell |
| 67 | +[OK]: Check package "C:\Users\Icinga\Downloads" is [OK] (Match All) \_ [OK]: C:\Users\Icinga\Downloads is 1 |
| 68 | +``` |
| 69 | + |
| 70 | +### Example Command 4 |
| 71 | + |
| 72 | +```powershell |
| 73 | +Invoke-IcingaCheckDirectory -Path "C:\Users\Icinga\Downloads" -FileNames "*.txt","*.sql" -Warning 20 -Critical 30 -Verbosity 3 |
| 74 | +``` |
| 75 | + |
| 76 | +### Example Output 4 |
| 77 | + |
| 78 | +```powershell |
| 79 | +[OK]: Check package "C:\Users\Icinga\Downloads" is [OK] (Match All) \_ [OK]: C:\Users\Icinga\Downloads is 4 |
| 80 | +``` |
0 commit comments