Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invoke-IcingaCheckDirectory doesn't work without filename parameter #155

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/director/Invoke-IcingaCheckDirectory.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion config/director/Plugins_Bundle.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion config/icinga/Invoke-IcingaCheckDirectory.conf
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ object CheckCommand "Invoke-IcingaCheckDirectory" {
order = 6
}
"-FileNames" = {
description = "Used to specify an array of filenames or expressions to match against results to filter for specific files. e.g '*.txt', '*.sql' # Fiends all files ending with .txt and .sql"
description = "Used to specify an array of filenames or expressions to match against results to filter for specific files. e.g '*.txt', '*.sql', finds all files ending with .txt and .sql"
value = {{
var arr = macro("$IcingaCheckDirectory_Array_FileNames$");
if (len(arr) == 0) {
Expand Down
2 changes: 1 addition & 1 deletion config/icinga/Plugins_Bundle.conf
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ object CheckCommand "Invoke-IcingaCheckDirectory" {
order = 6
}
"-FileNames" = {
description = "Used to specify an array of filenames or expressions to match against results to filter for specific files. e.g '*.txt', '*.sql' # Fiends all files ending with .txt and .sql"
description = "Used to specify an array of filenames or expressions to match against results to filter for specific files. e.g '*.txt', '*.sql', finds all files ending with .txt and .sql"
value = {{
var arr = macro("$IcingaCheckDirectory_Array_FileNames$");
if (len(arr) == 0) {
Expand Down
1 change: 1 addition & 0 deletions doc/31-Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
### Bugfixes

* [#144](https://github.com/Icinga/icinga-powershell-plugins/pull/144) Fixes filtering for `Invoke-IcingaCheckEventLog` which resulted in wrong results, depending on the plugin configuration
* [#154](https://github.com/Icinga/icinga-powershell-plugins/issues/154) Fixes `Invoke-IcingaCheckDirectory` by setting `-FileNames` argument to `*` as default for allowing to fetch all files for a given directory by default

## 1.4.0 (2021-03-02)

Expand Down
2 changes: 1 addition & 1 deletion doc/plugins/05-Invoke-IcingaCheckDirectory.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ No special permissions required.
| Argument | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| Path | String | false | | Used to specify a path. e.g. 'C:\Users\Icinga\Downloads' |
| FileNames | Array | false | | Used to specify an array of filenames or expressions to match against results to filter for specific files. e.g '*.txt', '*.sql' # Fiends all files ending with .txt and .sql |
| FileNames | Array | false | @( '*' ) | Used to specify an array of filenames or expressions to match against results to filter for specific files. e.g '*.txt', '*.sql', finds all files ending with .txt and .sql |
| Recurse | SwitchParameter | false | False | A switch, which can be set to search through directories recursively. |
| Critical | Object | false | | Used to specify a Critical threshold. Follows the Icinga plugin threshold |
| Warning | Object | false | | Used to specify a Warning threshold. Follows the Icinga plugin threshold |
Expand Down
20 changes: 10 additions & 10 deletions doc/plugins/06-Invoke-IcingaCheckEventlog.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ To execute this plugin you will require to grant the following user permissions.
| Warning | Object | false | | Used to specify a Warning threshold. |
| Critical | Object | false | | Used to specify a Critical threshold. |
| LogName | String | false | | Used to specify a certain log. |
| IncludeEventId | Array | false | | Used to specify an array of events identified by their id to be included. |
| ExcludeEventId | Array | false | | Used to specify an array of events identified by their id to be excluded. |
| IncludeUsername | Array | false | | Used to specify an array of usernames within the eventlog to be included. |
| ExcludeUsername | Array | false | | Used to specify an array of usernames within the eventlog to be excluded. |
| IncludeEntryType | Array | false | | Used to specify an array of entry types within the eventlog to be included. |
| ExcludeEntryType | Array | false | | Used to specify an array of entry types within the eventlog to be excluded. |
| IncludeMessage | Array | false | | Used to specify an array of messages within the eventlog to be included. |
| ExcludeMessage | Array | false | | Used to specify an array of messages within the eventlog to be excluded. |
| IncludeSource | Array | false | | Used to specify an array of message sources within the eventlog to be included. |
| ExcludeSource | Array | false | | Used to specify an array of message sources within the eventlog to be excluded. |
| IncludeEventId | Array | false | @() | Used to specify an array of events identified by their id to be included. |
| ExcludeEventId | Array | false | @() | Used to specify an array of events identified by their id to be excluded. |
| IncludeUsername | Array | false | @() | Used to specify an array of usernames within the eventlog to be included. |
| ExcludeUsername | Array | false | @() | Used to specify an array of usernames within the eventlog to be excluded. |
| IncludeEntryType | Array | false | @() | Used to specify an array of entry types within the eventlog to be included. |
| ExcludeEntryType | Array | false | @() | Used to specify an array of entry types within the eventlog to be excluded. |
| IncludeMessage | Array | false | @() | Used to specify an array of messages within the eventlog to be included. |
| ExcludeMessage | Array | false | @() | Used to specify an array of messages within the eventlog to be excluded. |
| IncludeSource | Array | false | @() | Used to specify an array of message sources within the eventlog to be included. |
| ExcludeSource | Array | false | @() | Used to specify an array of message sources within the eventlog to be excluded. |
| After | Object | false | | Used to specify time data of which point the plugin should start to read event logs from. You can either use a fixed date and time like "2021/01/30 12:00:00", a fixed day "2021/01/30" or use more dynamic approaches like "1d", "10h" and so on. Allowed units: ms, s, m, h, d, w, M, y |
| Before | Object | false | | Used to specify time data of which point the plugin should stop considering event logs. You can either use a fixed date and time like "2021/01/30 12:00:00", a fixed day "2021/01/30" or use more dynamic approaches like "1d", "10h" and so on. By using "2h" for example, log files of the last 2 hours will be ignored. Please ensure to manually set the `-After` argument and ensure you go back further in time with the `-After` argument than the `-Before` argument. Allowed units: ms, s, m, h, d, w, M, y |
| DisableTimeCache | SwitchParameter | false | False | Switch to disable the time cache on a check. If this parameter is set the time cache is disabled. After the check has been run once, the next check instance will filter through the eventlog from the point the last check ended. This is due to the time cache, when disabled the whole eventlog is checked instead. |
Expand Down
6 changes: 3 additions & 3 deletions plugins/Invoke-IcingaCheckDirectory.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
.PARAMETER FileNames
Used to specify an array of filenames or expressions to match against results to filter for specific files.

e.g '*.txt', '*.sql' # Fiends all files ending with .txt and .sql
e.g '*.txt', '*.sql', finds all files ending with .txt and .sql
.PARAMETER Recurse
A switch, which can be set to search through directories recursively.
.PARAMETER ChangeYoungerThan
Expand Down Expand Up @@ -89,8 +89,8 @@ function Invoke-IcingaCheckDirectory()
{
param(
[string]$Path,
[array]$FileNames,
[switch]$Recurse,
[array]$FileNames = @( '*' ),
[switch]$Recurse = $FALSE,
$Critical = $null,
$Warning = $null,
[string]$ChangeTimeEqual,
Expand Down