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

IcingaCheckPerfCounter - ThresholdInterval not working properly? #295

Closed
DeHook opened this issue Jun 29, 2021 · 9 comments · Fixed by #296
Closed

IcingaCheckPerfCounter - ThresholdInterval not working properly? #295

DeHook opened this issue Jun 29, 2021 · 9 comments · Fixed by #296
Assignees
Labels
Bug There is an issue present
Milestone

Comments

@DeHook
Copy link

DeHook commented Jun 29, 2021

Hi,
we tested the IcingaCheckPerfCounter Powershell Check and we want to use the ThresholdInterval option for average values of the last x minutes.

We installed the icingapowershell Service on the Server and registered the Check.

When we open the performance monitor and run the check simultaniously, the average values will not fit.

I don't know where our mistake is and where we can change the query.

The Check-query is Invoke-IcingaCheckPerfCounter -PerfCounter '\processor(0)\% processor time' -ThresholdInterval 1m

thi

Thank you.

@LordHepipud LordHepipud self-assigned this Jun 29, 2021
@LordHepipud
Copy link
Collaborator

Hello

Thank you for the issue. Could you please share the configuration of the Invoke-IcingaCheckPerfCounter check?

You can fetch them with

Show-IcingaRegisteredServiceChecks

According to the plugin output you provided, the interval values are not present, because otherwise the time interval would be added there, like

processor0_processor_time_1

@DeHook
Copy link
Author

DeHook commented Jun 30, 2021

Thank you for your reply.

Here the configuration of the Invoke-IcingaCheckPerfCounter - Check:
Unbenannt

Thank you.

@LordHepipud
Copy link
Collaborator

Ah, I see, You are missing the arguments. You need to add the arguments as well, otherwise the check does not know, what do to.

  1. Use the Id of the Service to remove it with Unregister-IcingaServiceCheck $id
  2. Register the check again
Register-IcingaServiceCheck -CheckCommand Invoke-IcingaCheckPerfCounter -Arguments @{ '-PerfCounter' = '\processor(0)\% processor time'; } -TimeIndexes 1, 2, 3, 5 -Interval 30;

Please check if I added all your time indexes. Once done, restart the PowerShell daemon with

Restart-Service icingapowershell

and after a short time, this should work properly.

@DeHook
Copy link
Author

DeHook commented Jun 30, 2021

Ok, I was reading the official documentation. There ist just a part about the checkCPU part without arguments. That makes sense. I unregistered the first check, registered it again with the arguments an restarted the icingapowershell.

But it is not working properly:

01

I tested it with 1m, 2m & 2.
The output is still processor(0)_processor_time.

Thank you.

@LordHepipud LordHepipud transferred this issue from Icinga/icinga-powershell-plugins Jun 30, 2021
@LordHepipud LordHepipud added the Bug There is an issue present label Jun 30, 2021
@LordHepipud LordHepipud added this to the v1.5.1 milestone Jun 30, 2021
@LordHepipud
Copy link
Collaborator

Can you please test the linked PR if this resolves the issue?

For testing:

  1. Stop the background daemon service
  2. Update the Framework
  3. Remove the Invoke-IcingaCheckPerfCounter json files within the cache folder for both, checkresult and checkresult_store
  4. Restart the background daemon service
  5. Wait for the files to be written on your disk in the folder
  6. Execute the plugin again within a new PowerShell session

After that, it should work. I will add this fix to v1.5.1 if you report back successfully.

Thank you again!

@DeHook
Copy link
Author

DeHook commented Jul 1, 2021

I have a few questions.
We updated the two files in the lib folder. We reviewed registered checks and restarted the icingapowershell service. This looks OK.
We are waiting for the cache files more than 60 minutes and they aren't created yet. I don't know what we did wrong or why the cache files aren't there now.

The -ThresholdInterval-parameter will not be automatically detected in the powershell console when I begin to write the parameter and use the tabulator. Is this normal for this check?

@LordHepipud
Copy link
Collaborator

LordHepipud commented Jul 1, 2021

Is the background daemon registered? You can check this with

Get-IcingaBackgroundDaemons

You should see Start-IcingaServiceCheckDaemon inside.

If not, please run

Register-IcingaBackgroundDaemon -Command 'Start-IcingaServiceCheckDaemon';

afterwards restart the PowerShell daemon.

If the daemon is already present, it could be a permission problem. Are you running the Icinga Agent on the system as well?
In case you do, please make sure the service user for icinga2 and icingapowershell is identical.

Then run

Test-IcingaAgent

to verify that access to the cache directory is granted for this user. If not, the command will give you the required command to set permissions.

Otherwise you will require manually to grant permissions to the cache folder for the user the icingapowershell service is running with.

@DeHook
Copy link
Author

DeHook commented Jul 1, 2021

Okay, it's working now! Thank you very much.
The Background Daemon were not running and the permissions to the cache folder were not set.

I tested it with a few other counters and it's working fine.

02

@LordHepipud
Copy link
Collaborator

Excellent, thank you very much! Just one important thing:

In case you are using the identical plugin, in this case Invoke-IcingaCheckPerfCounter, please ensure you only register one check command definition and add all required Performance Counters as list to -PerfCounter.

Otherwise they might conflict each other.

Basically your registered service check should cover with processor, memory and even more directly with -PerfCounter.

I will apply the fix directly to v1.5.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug There is an issue present
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants