Skip to content

Commit 2f9cfb1

Browse files
authored
Merge pull request #224 from Icinga:fix/partition_check_label_name
Fix: UsedPartitionSpace plugin had wrong label name for partitions Fixes label name for `Invoke-IcingaCheckUsedPartitionSpace`, by renaming them from `partition_{0}` back to `used_space_partition_{0}`, as otherwise we run into metric displaying issues with Graphite/InfluxDB.
2 parents 433da73 + bf2b826 commit 2f9cfb1

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

doc/31-Changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
1111

1212
[Issue and PRs](https://github.com/Icinga/icinga-powershell-plugins/milestone/8?closed=1)
1313

14+
## Bugfixes
15+
16+
* [#224](https://github.com/Icinga/icinga-powershell-plugins/pull/224) Fixes `Invoke-IcingaCheckUsedPartitionSpace` label names, which might have caused conflicts with Graphite/InfluxDB, because of changed metric unit
17+
1418
### Enhancements
1519

1620
* [#208](https://github.com/Icinga/icinga-powershell-plugins/issues/208) Adds additional features to `Invoke-IcingaCheckScheduledTask`, allowing to monitor exit codes, missed runs and last/next run time of a task

plugins/Invoke-IcingaCheckUsedPartitionSpace.psm1

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,17 @@ function Invoke-IcingaCheckUsedPartitionSpace()
112112
continue;
113113
}
114114

115+
$FormattedLetter = $partition.DriveLetter.Replace(':', '').ToLower();
116+
115117
foreach ($entry in $Include) {
116118
$ProcessPartition = $FALSE;
117-
if ($entry.Replace(':', '').Replace('\', '').Replace('/', '').ToLower() -eq $partition.DriveLetter.Replace(':', '').ToLower()) {
119+
if ($entry.Replace(':', '').Replace('\', '').Replace('/', '').ToLower() -eq $FormattedLetter) {
118120
$ProcessPartition = $TRUE;
119121
break;
120122
}
121123
}
122124
foreach ($entry in $Exclude) {
123-
if ($entry.Replace(':', '').Replace('\', '').Replace('/', '').ToLower() -eq $partition.DriveLetter.Replace(':', '').ToLower()) {
125+
if ($entry.Replace(':', '').Replace('\', '').Replace('/', '').ToLower() -eq $FormattedLetter) {
124126
$ProcessPartition = $FALSE;
125127
break;
126128
}
@@ -130,7 +132,7 @@ function Invoke-IcingaCheckUsedPartitionSpace()
130132
continue;
131133
}
132134

133-
$IcingaCheck = New-IcingaCheck -Name ([string]::Format('Partition {0}', $partition.DriveLetter)) -Value $partition.UsedSpace -Unit 'B' -Minimum 0 -Maximum $partition.Size -NoPerfData:$SetUnknown -BaseValue $partition.Size;
135+
$IcingaCheck = New-IcingaCheck -Name ([string]::Format('Partition {0}', $partition.DriveLetter)) -Value $partition.UsedSpace -Unit 'B' -Minimum 0 -Maximum $partition.Size -LabelName ([string]::Format('used_space_partition_{0}', $FormattedLetter)) -NoPerfData:$SetUnknown -BaseValue $partition.Size;
134136

135137
if ([string]::IsNullOrEmpty($partition.FreeSpace) -Or [string]::IsNullOrEmpty($partition.Size)) {
136138
if ($SkipUnknown -eq $FALSE) {

0 commit comments

Comments
 (0)