check_nt checking multiple services using regex

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
User avatar
rhassing
Posts: 416
Joined: Sat Oct 05, 2013 10:29 pm
Location: Netherlands

check_nt checking multiple services using regex

Post by rhassing »

Hello,

Is it possible to use regular expressions in check_nt to see if multiple services are running?
We have a lot of servers running services which all start whit the same three letters, but have different names on all servers.

Instead of creating all these different service check, I would like to create 1 service check to see which services are running starting with the three letters.

Best regards,
Rob Hassing
Rob Hassing
Image
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_nt checking multiple services using regex

Post by scottwilkerson »

You should be able to do something like this to match all services that contain YYYYYY

Code: Select all

./check_nrpe -H HOST -u -t 30 -c check_service -a "filter=name like 'YYYYYY'"
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
User avatar
rhassing
Posts: 416
Joined: Sat Oct 05, 2013 10:29 pm
Location: Netherlands

Re: check_nt checking multiple services using regex

Post by rhassing »

When I try the command on the commandline, this works as expected.
But when I try the same command in Nagios XI it fails with: "Failed to validate filter see log for details: Filter expression is not valid: name like \'uds.c\'

I have tried the following as well:
-a filter=”name like \‘uds.c\’”
-a filter=”name like \"uds.c\"”
With the same result.

Does anyone have another suggestion?
Rob Hassing
Image
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_nt checking multiple services using regex

Post by scottwilkerson »

rhassing wrote:When I try the command on the commandline, this works as expected.
But when I try the same command in Nagios XI it fails with: "Failed to validate filter see log for details: Filter expression is not valid: name like \'uds.c\'

I have tried the following as well:
-a filter=”name like \‘uds.c\’”
-a filter=”name like \"uds.c\"”
With the same result.

Does anyone have another suggestion?
Rob,

Is it just failing when you run a test of the command from inside the CCM? There are some commands that just cannot work from there for security concerns, certain chars must be escaped when coming from a web GUI, this command has several of them. If you save the command as I showed you it should just work when Nagios executes it even though it fails through the CCM
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
User avatar
rhassing
Posts: 416
Joined: Sat Oct 05, 2013 10:29 pm
Location: Netherlands

Re: check_nt checking multiple services using regex

Post by rhassing »

Thank you Scott. That did the trick ;-)
Rob Hassing
Image
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_nt checking multiple services using regex

Post by scottwilkerson »

rhassing wrote:Thank you Scott. That did the trick ;-)
Great!

Locking thread
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked