-
Notifications
You must be signed in to change notification settings - Fork 28
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
Feature request - more thresholds for Invoke-IcingaCheckPerfcounter #383
Comments
I have two possible solutions for that. Solution 1 - Use Warnings- and Criticals-Hashtable Unfortunatley hashtables are currently not supported for custom datafields within icinga director or at least I haven't found anything about it. So this solution probably only works from the cli because I don't know how to pass a hashtable from icinga director to the powershell framework plugins. But maybe this solution is interessting for the future if some day hashtables will be supported. Add the follwoing to the param section in the Invoke-IcingaCheckPerfCounter.psm1 located at C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-plugins\plugins:
Change Line 113 and 120 from
to
With that you can define individual thresholds for each checked counter. The Thresholds have to be defined in an hashtable as follows: Example:
Output:
Solution 2 - Use Warnings- and Criticals-Array This solution should work for both. CLI and icinga director but it is probably not the smartest solution because I am not very experienced with programming. Maybe some Powershell Geeks out there have a better solution. If so please feel free to comment. For this solution I made the following changes to the Invoke-IcingaCheckPerfCounter.psm1 located at C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-plugins\plugins: Add the follwoing to the param section :
Add the following below the param section to create a Warning Variable for each array entry
Add the following below the line "$IcingaCheck = New-IcingaCheck -Name $counter -Value $Counters[$counter].Value -MetricIndex $CounterInfo.Category -MetricName $CounterInfo.Counter;"
And change line
to
Add the following below the line "$IcingaCheck = New-IcingaCheck -Name $instanceName -Value $instance.Value -MetricIndex $CounterInfo.Category -MetricName $CounterInfo.CounterInstance;"
And change line
to
With that you can define individual thresholds for each checked counter. The Thresholds have to be defined in an array as follows: Example:
Output:
For those interessted, I have attached the full code for both solutions as text-file. |
With Invoke-IcingaCheckPerfcounter it is possible to specify an array of perfcounters to be checked but only one warning and one critical threshold. It would be great if you can specify individual thresholds for each checked perfcounter.
The text was updated successfully, but these errors were encountered: