NRPE not giving the correct output

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
RebeccaIlene
Posts: 164
Joined: Tue Apr 02, 2019 8:38 pm

NRPE not giving the correct output

Post by RebeccaIlene »

Hi Team,

There is a custom powershell script that I am using to get the count of file in a folder.

When I run the powershell it gives the correct output but when the same command is checked in Nagios it gives the wrong output.

What can be causing this?

Powershell output:

PS C:\Program Files\NSClient++\scripts> .\check_file.ps1 -Path "\\folder.lan\Apps\Uat\*.CSV" -Time 6000 -crit 0
Ok: 2 files found - 8172_1_20201124104257.CSV 8170_1_20201124093016.CSV.|found_files=2;0;0;
PS C:\Program Files\NSClient++\scripts>


nsc_custom file command definition:

check_file_Apps_UAT=check_file.ps1 -Path "\\folder.lan\Apps\Uat\*.CSV" -Time 6000 -crit 0

Nagios output:

[root@hostname libexec]# ./check_nrpe -H $hostname$ -t 120 -c check_file_Apps_UAT
Critical: 0 files found - .|found_files=0;0;0;
You do not have the required permissions to view the files attached to this post.
dchurch
Posts: 858
Joined: Wed Oct 07, 2020 12:46 pm
Location: Yo mama

Re: NRPE not giving the correct output

Post by dchurch »

RebeccaIlene wrote:same command is checked in Nagios
If you mean by this that you're running this in the "Run Check Command" modal dialog from within the Nagios XI web interface, then that's a known issue. There's a bug in the escaping of the command when you run it from that dialog box.

Best workaround I can give is to take what that the command line says in the dialog, and try running that directly on the command line.

If you're still having issues, please post the contents of C:\Program Files (x86)\Nagios\NCPA\var\log\ncpa_listener.log
If you didn't get an 8% raise over the course of the pandemic, you took a pay cut.

Discussion of wages is protected speech under the National Labor Relations Act, and no employer can tell you you can't disclose your pay with your fellow employees.
RebeccaIlene
Posts: 164
Joined: Tue Apr 02, 2019 8:38 pm

Re: NRPE not giving the correct output

Post by RebeccaIlene »

Yes, have checked this in command line as well and it still throws the wrong output.
dchurch
Posts: 858
Joined: Wed Oct 07, 2020 12:46 pm
Location: Yo mama

Re: NRPE not giving the correct output

Post by dchurch »

Can you please post the contents of C:\Program Files (x86)\Nagios\NCPA\var\log\ncpa_listener.log
If you didn't get an 8% raise over the course of the pandemic, you took a pay cut.

Discussion of wages is protected speech under the National Labor Relations Act, and no employer can tell you you can't disclose your pay with your fellow employees.
RebeccaIlene
Posts: 164
Joined: Tue Apr 02, 2019 8:38 pm

Re: NRPE not giving the correct output

Post by RebeccaIlene »

We are not using NCPA for this. Using NSClient ++
dchurch
Posts: 858
Joined: Wed Oct 07, 2020 12:46 pm
Location: Yo mama

Re: NRPE not giving the correct output

Post by dchurch »

I think the NRPE listener is having issues accessing the "\\folder.lan\Apps\Uat" directory. The NRPE listener runs as the Local System account by default. Under a Windows "domain," there's probably going to be difficulty granting that user access to network resources, since it's not a "domain" user - it's a system local one. The full name of the account it runs as is prefixed by your local machine name, e.g. MYCOMPUTERNAME\Local System.

What you could do to test this is pop open a shell as Local System and run your PowerShell script, but I wasn't able to get this working - probably due to my computer being joined to a domain.

If you open the Service in the Windows management console, you should be able to set the NSClient++ service's login user to someone with access to the Windows shared folder.

If you're still having issues, please post the contents of C:\Program Files\NSClient++\nsclient.log so we can diagnose further.
If you didn't get an 8% raise over the course of the pandemic, you took a pay cut.

Discussion of wages is protected speech under the National Labor Relations Act, and no employer can tell you you can't disclose your pay with your fellow employees.
RebeccaIlene
Posts: 164
Joined: Tue Apr 02, 2019 8:38 pm

Re: NRPE not giving the correct output

Post by RebeccaIlene »

This is fixed now. The NSClient service was running using the local account rather than the service account that has access.

After updating the service to run with the service account it worked.

You can close this case.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: NRPE not giving the correct output

Post by scottwilkerson »

RebeccaIlene wrote:This is fixed now. The NSClient service was running using the local account rather than the service account that has access.

After updating the service to run with the service account it worked.

You can close this case.
Locking thread
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked