Page 1 of 2

display registry key values

Posted: Thu Feb 18, 2021 2:27 pm
by localit
Hello guys, i am not the greatest in Nagios and wanted to get your opinion. I want to get your opinion the best way to display a registry key value. I am not trying to setup warning or criticle message at the moment, i simply want to be able to view the output of the value. I have the NSclient installed on most of my devices.

The main goal for me is to get information about mcafee on my devices. for example i run this command below.

cmd: REG QUERY HKEY_LOCAL_MACHINE\Software\McAfee\Endpoint\Common\ /v ProductVersion

output: product version 10.7.0

^^ this is what i am wanting to be able to display for my devices via nagios for information purposes not alerts.

Re: display registry key values

Posted: Thu Feb 18, 2021 4:58 pm
by dchurch
If you can construct a .bat file that will print out what you want reported to Nagios XI, you can plug it into NCPA as a plugin. Something like the Windows "reg query" command

Here's a guide: https://support.nagios.com/kb/article/n ... a-722.html

Re: display registry key values

Posted: Fri Feb 19, 2021 9:40 am
by localit
Thank you for the reply. Most of my machines are using the NSclient. Is it possible to do the same thing using check_nrpe?

Re: display registry key values

Posted: Fri Feb 19, 2021 2:59 pm
by localit
i got the scripts to work via nrpe , my next question is how to make the service display the result for status information?

it appears once i click into the service, but i wont appear in the status information.


the bat file read as this

ECHO OFF
REG QUERY HKEY_LOCAL_MACHINE\Software\McAfee\Endpoint\Common\ /v ProductVersion
EXIT 0


see screen shot 1 in attachments: it shows information i am wanting when i click into the service
script1.JPG
see screen shot 2: no status information appears. i want the highlighted information from screen shot 1 to appear in the status information.
script2.JPG
any suggestions?

Re: display registry key values

Posted: Fri Feb 19, 2021 4:39 pm
by dchurch
Change it to @echo off to suppress that line.

Remember that whatever gets output to the console from the bat file is what's put as the check result from Nagios calling NRPE. Example:

Code: Select all

OK - load average: 0.23, 0.39, 0.36

Code: Select all

CRITICAL - 192.168.254.13: rta nan, lost 100%

Re: display registry key values

Posted: Mon Feb 22, 2021 9:36 am
by localit
I added @ to the echo off. but it still isn't showing the output under status information.

here is screen shot of the bat file. Is this what you was talking about?
bat file.JPG

Re: display registry key values

Posted: Mon Feb 22, 2021 10:36 am
by localit
dchurch wrote:Change it to @echo off to suppress that line.

Remember that whatever gets output to the console from the bat file is what's put as the check result from Nagios calling NRPE. Example:

Code: Select all

OK - load average: 0.23, 0.39, 0.36

Code: Select all

CRITICAL - 192.168.254.13: rta nan, lost 100%

is there something i need to add to the argument to display the information under status information? The goal is for me to see it in green always, i am using this for information purposes not for alerts. so i just want to see the output under status information as OK or green.

Re: display registry key values

Posted: Mon Feb 22, 2021 6:59 pm
by ssax
Try this:

Code: Select all

@echo off
REG QUERY HKEY_LOCAL_MACHINE\Software\McAfee\Endpoint\Common\ /v ProductVersion | findstr ProductVersion
exit 0

Re: display registry key values

Posted: Tue Feb 23, 2021 8:36 am
by localit
ssax wrote:Try this:

Code: Select all

@echo off
REG QUERY HKEY_LOCAL_MACHINE\Software\McAfee\Endpoint\Common\ /v ProductVersion | findstr ProductVersion
exit 0

Thank you very much! thats exactly what i was needing!

Re: display registry key values

Posted: Tue Feb 23, 2021 3:05 pm
by localit
ssax wrote:Try this:

Code: Select all

@echo off
REG QUERY HKEY_LOCAL_MACHINE\Software\McAfee\Endpoint\Common\ /v ProductVersion | findstr ProductVersion
exit 0

is there a way to filter out only the numbers in the results ? for example see screen shot , it shows the whole output but i am wanting to view only the number(highlighted area)
bat file.JPG