Can you post the "nsclient.log" file?CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages.
Not able to Run Powershell Script using NRPE
Re: Not able to Run Powershell Script using NRPE
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Not able to Run Powershell Script using NRPE
I have attached the log file.lmiltchev wrote:Can you post the "nsclient.log" file?CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages.
You do not have the required permissions to view the files attached to this post.
Re: Not able to Run Powershell Script using NRPE
Did you load the default settings in nsclient.ini file by running:
from the CMD prompt?
I suspect that running PS scripts fails because you are missing the "[/settings/external scripts/wrappings]" section.
Add the "defaults" AND restart the NSClient++ service.
Next, upload the "updated" nsclient.ini file, so that we can review it. We may need to modify some of the "timeout" settings in case this is what is causing the problem.
Code: Select all
nscp settings --generate --add-defaults --load-allI suspect that running PS scripts fails because you are missing the "[/settings/external scripts/wrappings]" section.
Add the "defaults" AND restart the NSClient++ service.
Next, upload the "updated" nsclient.ini file, so that we can review it. We may need to modify some of the "timeout" settings in case this is what is causing the problem.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Not able to Run Powershell Script using NRPE
Hi lmiltchev,lmiltchev wrote:Did you load the default settings in nsclient.ini file by running:from the CMD prompt?Code: Select all
nscp settings --generate --add-defaults --load-all
I suspect that running PS scripts fails because you are missing the "[/settings/external scripts/wrappings]" section.
Add the "defaults" AND restart the NSClient++ service.
Next, upload the "updated" nsclient.ini file, so that we can review it. We may need to modify some of the "timeout" settings in case this is what is causing the problem.
Thanks for your help i am getting the output now. can we only check CPU usage of ? we are giving memwarn and memcrit, can we do similar for CPU usage??
Re: Not able to Run Powershell Script using NRPE
Great! I am glad we are moving to the right direction. 
The CPU usage would be shown if some conditions were met. You have the following condition in the script:
In my case, the "$CPUQueue" was 0 (zero), so I changed this condition to:
for testing purposes (used "less than" instead of "greater than"), and tested it from the CLI to see if the CPU usage will be displayed.
Hope this helps.
The CPU usage would be shown if some conditions were met. You have the following condition in the script:
Code: Select all
if (($CPUQueue -gt $CPUq) -and ($CPUpercent -gt $CPUp)) {
...
}Code: Select all
if (($CPUQueue -lt $CPUq) -and ($CPUpercent -gt $CPUp)) {
...
}Code: Select all
[root@localhost nagiosxi]# /usr/local/nagios/libexec/check_nrpe -H x.x.x.x -c myscript -a 'myPC -memwarn 85 -memcrit 95 -CPUq 1 -CPUp 0'
Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
------- ------ ----- ----- ----- ------ -- -----------
1329 175 538800 669784 1597 ...71.21 1304 firefox
CRITICAL: CPU Queue = 0 CPU% = 13. firefox is using the most resources, its PID is 1304 |'CPU'=13%;;;0 'CPU'=0 'Queue'=0;;;0Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Not able to Run Powershell Script using NRPE
Hi lmiltchev,lmiltchev wrote:Great! I am glad we are moving to the right direction.
The CPU usage would be shown if some conditions were met. You have the following condition in the script:
In my case, the "$CPUQueue" was 0 (zero), so I changed this condition to:Code: Select all
if (($CPUQueue -gt $CPUq) -and ($CPUpercent -gt $CPUp)) { ... }
for testing purposes (used "less than" instead of "greater than"), and tested it from the CLI to see if the CPU usage will be displayed.Code: Select all
if (($CPUQueue -lt $CPUq) -and ($CPUpercent -gt $CPUp)) { ... }
Hope this helps.Code: Select all
[root@localhost nagiosxi]# /usr/local/nagios/libexec/check_nrpe -H x.x.x.x -c myscript -a 'myPC -memwarn 85 -memcrit 95 -CPUq 1 -CPUp 0' Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName ------- ------ ----- ----- ----- ------ -- ----------- 1329 175 538800 669784 1597 ...71.21 1304 firefox CRITICAL: CPU Queue = 0 CPU% = 13. firefox is using the most resources, its PID is 1304 |'CPU'=13%;;;0 'CPU'=0 'Queue'=0;;;0
Our requirement is : if any process usage memory more then 85 % then it should return the warning output with process name and memory usage.
For critical : if process memory usage is more than 90% then output with process name and memory usage.
and if any process CPU usage , For warning, if any process CPU usage with more than 85% then it should return the warning output with process name and cpu usage.
for critical, if any process cpu usage is more than 90% then output with process name and cpu usage of that process.
can you modify the script accordingly? is it possible?
Re: Not able to Run Powershell Script using NRPE
A few lines here and there we can take care of, but anything more than that needs to be quoted as custom development. I can certainly start the conversation with sales and our developers if that is something you are interested in doing.CloudOps wrote:[can you modify the script accordingly? is it possible?
Before we do that though, I would need clarification on the examples you provided. You mention warning and critical behavior twice, but each mention seems to be the same scenario. Is there supposed to be any difference between the two?
Former Nagios employee
Re: Not able to Run Powershell Script using NRPE
can you confirm if any cost is involved in this??tmcdonald wrote:A few lines here and there we can take care of, but anything more than that needs to be quoted as custom development. I can certainly start the conversation with sales and our developers if that is something you are interested in doing.CloudOps wrote:[can you modify the script accordingly? is it possible?
Before we do that though, I would need clarification on the examples you provided. You mention warning and critical behavior twice, but each mention seems to be the same scenario. Is there supposed to be any difference between the two?
in this script its showing the process name in output, but its not showing whether the process is related to CPU or Memory usage.
Re: Not able to Run Powershell Script using NRPE
Definitely - it is a custom development. It could be a very reasonable cost though, depending on how much time our developers will have to spend modifying the script. You can contacts our sales team at [email protected], and request a quote for a custom development.can you confirm if any cost is involved in this??
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Not able to Run Powershell Script using NRPE
lmiltchev wrote:Definitely - it is a custom development. It could be a very reasonable cost though, depending on how much time our developers will have to spend modifying the script. You can contacts our sales team at [email protected], and request a quote for a custom development.can you confirm if any cost is involved in this??
i will check with my team members for this.
Meanwhile this script is giving wrong output. i am attaching the output. Can you help here
You do not have the required permissions to view the files attached to this post.