Alert if a process IS running, rather than if it isn't

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Alert if a process IS running, rather than if it isn't

Post by jdalrymple »

peterooney wrote:what was the significance of all the trailing exclamation marks on the check_command line
Just what I said, separates arguments.

In your case:

Code: Select all

$ARG1$='check_nt -v PROCSTATE -d SHOWALL -l "Notepad++.exe"'
$ARG2$=NULL
$ARG3$=NULL
etc.

Since all trailing args after $ARG1$ are NULL the extra ! characters have no significance to your command and could be omitted. Incidentally, and as a point of illustration, your command could be rewritten:

Code: Select all

        command_line    $USER1$/negate $USER1$/$ARG1$ $ARG2$ $ARG5$ $ARG2$ $ARG3$ $ARG4$ $ARG2$ $ARG5$
And the validity doesn't change. All of those args would be filled with nothing and the resulting command would be identical.

As for your posted config - I don't see any reason it wouldn't work at first glance. Have you tried it?
neworderfac33
Posts: 329
Joined: Fri Jul 24, 2015 11:04 am

Re: Alert if a process IS running, rather than if it isn't

Post by neworderfac33 »

Finally sorted!

It was all down to a typo - I'd missed the trailing $ after $HOSTADDRESS - that's all it was.

But, without everybody's assistance in the first place, I'd still be a million miles away, so thanks to all!

I just noticed jdalrymple's latest response (on page 2, where I've only just looked this morning - Doh!), so I can remove my trailing exclamation marks too!

Code: Select all

define service{
        use                     generic-service
        host_name               MN2SVWBDT001SD0, MN2SVWBDT001SU0
        #hostgroup_name         windows-servers
        service_description     Application - Notepad++ Version 2
        check_command           negatepr!check_nt -H $HOSTADDRESS$ -p 12489 -v PROCSTATE -d SHOWALL -l "Notepad++.exe"!!!!!!!
        }

Regards

Pete
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Alert if a process IS running, rather than if it isn't

Post by hsmith »

peterooney wrote:Finally sorted!

It was all down to a typo - I'd missed the trailing $ after $HOSTADDRESS - that's all it was.

But, without everybody's assistance in the first place, I'd still be a million miles away, so thanks to all!

I just noticed jdalrymple's latest response (on page 2, where I've only just looked this morning - Doh!), so I can remove my trailing exclamation marks too!

Code: Select all

define service{
        use                     generic-service
        host_name               MN2SVWBDT001SD0, MN2SVWBDT001SU0
        #hostgroup_name         windows-servers
        service_description     Application - Notepad++ Version 2
        check_command           negatepr!check_nt -H $HOSTADDRESS$ -p 12489 -v PROCSTATE -d SHOWALL -l "Notepad++.exe"!!!!!!!
        }

Regards

Pete
Awesome, glad this is working!

I am going to go ahead and lock the thread since it is resolved. Let us know if you have any more issues.
Former Nagios Employee.
me.
Locked