display registry key values

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
localit
Posts: 40
Joined: Thu Oct 29, 2020 12:50 pm

display registry key values

Post 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.
dchurch
Posts: 858
Joined: Wed Oct 07, 2020 12:46 pm
Location: Yo mama

Re: display registry key values

Post 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
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.
localit
Posts: 40
Joined: Thu Oct 29, 2020 12:50 pm

Re: display registry key values

Post 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?
localit
Posts: 40
Joined: Thu Oct 29, 2020 12:50 pm

Re: display registry key values

Post 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?
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: display registry key values

Post 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%
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.
localit
Posts: 40
Joined: Thu Oct 29, 2020 12:50 pm

Re: display registry key values

Post 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
You do not have the required permissions to view the files attached to this post.
localit
Posts: 40
Joined: Thu Oct 29, 2020 12:50 pm

Re: display registry key values

Post 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.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: display registry key values

Post by ssax »

Try this:

Code: Select all

@echo off
REG QUERY HKEY_LOCAL_MACHINE\Software\McAfee\Endpoint\Common\ /v ProductVersion | findstr ProductVersion
exit 0
localit
Posts: 40
Joined: Thu Oct 29, 2020 12:50 pm

Re: display registry key values

Post 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!
localit
Posts: 40
Joined: Thu Oct 29, 2020 12:50 pm

Re: display registry key values

Post 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
You do not have the required permissions to view the files attached to this post.
Locked