NCPA-1.7.2: Linux/Windows: Checking running service

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
questrad
Posts: 160
Joined: Wed Mar 21, 2012 3:08 pm
Location: Toronto
Contact:

NCPA-1.7.2: Linux/Windows: Checking running service

Post by questrad »

Hello All,

Can you please explain me how I can check specific service on host using NCPA.
This is the line in how it executed when I use NCPA client:
[Wed Sep 17 10:11:38] root@sq5vrlngs001:~# /usr/local/nagios/libexec/./check_ncpa.py -H sq5vpmacc001.tor.quest.com -P 5693 -t ccc-M 'service?service=AirWatchCloudConnector&status=running' -v

Code: Select all

Connecting to: https://sq5vpmacc001.xxx.com:5693/api/service?service=AirWatchCloudConnector&status=running/?token=ccc&check=1

File returned contained:
<!DOCTYPE html>
<html lang='en'>
    <head>

        <link rel='stylesheet' href='/static/css/bootstrap.min.css' />
        <link rel='stylesheet' href='/static/css/bootstrap-responsive.min.css' />
        <link rel='stylesheet' href='/static/css/ncpa.css' />

        <title>NCPA Web Interface</title>
        <link rel="shortcut icon" type="image/png" href="/static/img/ncpa-favicon.png" />
        <link rel="icon" type="image/png" href="/static/img/ncpa-favicon.png" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="description" content="NCPA Frontend">
        <meta name="author" content="Nicholas Scott">
        <script src='/static/js/jquery-1.8.3.min.js'></script>
        <script src='/static/js/bootstrap.min.js'></script>
        <script src='/static/js/d3.v3.min.js'></script>


    </head>
    <body>
        <div class='navbar navbar-inverse navbar-top'>
            <div class='navbar-inner'>
                <div class='container-fluid'>
                    <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <a class='brand' href='/'>NCPA</a>
                    <div class="nav-collapse collapse">
                        <ul class="nav">

                        </ul>
                        <ul class="nav pull-right">
                            <li><a href="/static/help/index.html">Help</a></li>
                            <li class="divider-vertical"></li>
                            <li><a href="/logout">Logout</a></li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
        <div class='container' id="main-content-container">

<div class='hero-unit'>
        <form class='form-signin' action='/login' method='post'>
                <h4 class='form-signin-heading'>Login</h2>
                <hr />


                <input type='password' class='input-block-level' name='token' placeholder='token' />
                <button class='btn' type='submit'>Sign In</button>
        </form>
</div>

        </div>
    </body>
</html>
An error occurred:No JSON object could be decoded
If I using same line using Firefox I have following output:
https://sq5vpmacc001.xxx.com:5693/api/s ... cc&check=1

Code: Select all

{
  "value": {
    "returncode": 2, 
    "stdout": "CRITICAL: Service AirWatchCloudConnector is running"
  }
}
But if I change place of "check" option it gives me correct output in Firefox:

https://sq5vpmacc001.tor.quest.com:5693 ... 5vplngs001

Code: Select all

{
  "value": {
    "returncode": 0, 
    "stdout": "OK: Service AirWatchCloudConnector is running"
  }
}
But if I execute the same request and I was not logged-in using Login page, the NCPA will forward me to the login page.

Please see attached video (in rar attached file).

Looks like it is bug, but maybe I do something incorrect.

Thanks
You do not have the required permissions to view the files attached to this post.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: NCPA-1.7.2: Linux/Windows: Checking running service

Post by sreinhardt »

Your check for services should look something like:

Code: Select all

Command definition:
$USER1$/check_ncpa.py -H $HOSTADDRESS$ $ARG1$

Service definition:
$ARG1$ = -t 'mytoken' -P 5693 -M 'service/Schedule/running'
In this case, I am looking for the Schedule service and it to be in a running state. Your command might look like:

Code: Select all

/usr/local/nagios/libexec/check_ncpa.py -H sq5vpmacc001.tor.quest.com -P 5693 -t ccc -M 'service/AirWatchCloudConnector/running' -v
I would note, that your first attempt likely had issues due to your token of ccc not having a space between it and the -M flag, just another possibility of what could have been happening. Can I ask why you are not using the wizard? It should make this much easier on you, unless of course you just need a few small additions to an existing host.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Locked