List of parameters that can be passed with actions component

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

List of parameters that can be passed with actions component

Post by WillemDH »

Hello,

Is there a list of parameters that can be passed with the actions component. At the moment I'm only passing %host % in this command:

Code: Select all

/usr/local/nagios/libexec/naf_install_nscp_0.4.1.101.sh "%host%" wingateway.fqdn
I would like to pass other parameters, but I can't immediately find documentation about this.

Grtz

Willem
Nagios XI 5.8.1
https://outsideit.net
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: List of parameters that can be passed with actions compo

Post by tmcdonald »

Yes sir:

http://assets.nagios.com/downloads/nagi ... ponent.pdf

Bottom of the doc it lists all the macros available.
Former Nagios employee
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

Re: List of parameters that can be passed with actions compo

Post by WillemDH »

Thanks Trevor,

I managed to make it work. Working on a bash script that calls a Powershell script that can create an Infra VMWare Service Manager incident with a quick action. I'm almost there :)

Just a quick question. The script looks like this:

Code: Select all

#!/bin/bash

# Script name: dig_create_infra_call.sh
# Version: 0.14.8.13
# Author: Willem D'Haese
# Created on: 13/08/2014
# Purpose: Quick action bash script that will call a Powershell script through nrpe to create an Infra call
# To do: Everything
# History:
#       15/12/2013 => Creation date
# Copyright:
# This program is free software: you can redistribute it and/or modify it under the terms of the
# GNU General Public License as published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.You should have received a copy of the GNU
# General Public License along with this program.  If not, see <http://www.gnu.org/licenses/>.

# Passed parameters
HOST=$1
SERVICE=$2
SERVICESTATETYPE=$3
SERVICESTATUSTEXT=$4
SERVICESTATUSTEXTLONG=$5
SERVICELASTCHECK=$6

# Logfile
LOGFILE=/var/log/dig_create_infra_call.log

GATEWAY=gatewayserver
NOW=$(date '+%Y-%m-%d -- %H:%M:%S')
echo "$NOW : Infra call creatin initiated." >> $LOGFILE
echo "Parameters => Host : $HOST , Service : $SERVICE , Servicestatetype : $SERVICESTATETYPE" >> $LOGFILE
echo "Parameters => Servicestatustext : $SERVICESTATUSTEXT" >> $LOGFILE
echo "Parameters => Servicestatustextlong : $SERVICESTATUSTEXTLONG" >> $LOGFILE
echo "Parameters => Servicelastcheck : $SERVICELASTCHECK" >> $LOGFILE

/usr/local/nagios/libexec/check_nrpe -H $GATEWAY -t 300 -c dig_create_infra_call -a $HOSTNAME

echo "$NOW : Infra call creation finished." >> $LOGFILE
So I'm passing SERVICESTATUSTEXT and SERVICESTATUSTEXTLONG. But looking at my logfile, apparently the SERVICESTATUSTEXTLONG is empty. Is this normal?

Code: Select all

2014-08-13 -- 17:34:15 : Infra call creatin initiated.
Parameters => Host : hostservername , Service : DRV_C , Servicestatetype : 1
Parameters => Servicestatustextlong :
Parameters => Servicelastcheck : 2014-08-13+17%3A21%3A26
2014-08-13 -- 17:34:15 : Infra call creation finished.
2014-08-13 -- 17:37:16 : Infra call creatin initiated.
Parameters => Host : hostservername , Service : DRV_C , Servicestatetype : 1
Parameters => Servicestatustext : OK%3A+C%3A%3A+Total%3A+25G+-+Used%3A+21.3G+%2885%25%29+-+Free%3A+3.66G+%2815%25%29
Parameters => Servicestatustextlong :
Parameters => Servicelastcheck : 2014-08-13+17%3A36%3A26
2014-08-13 -- 17:37:16 : Infra call creation finished.
Grtz

Willem
Nagios XI 5.8.1
https://outsideit.net
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: List of parameters that can be passed with actions compo

Post by abrist »

It very well could be as it was empty in all of my tests.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: List of parameters that can be passed with actions compo

Post by tmcdonald »

I believe that macro should only populate if the output is long enough, and the macro would then contain all but the first line. We might have to do some testing on this one.
Former Nagios employee
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

Re: List of parameters that can be passed with actions compo

Post by WillemDH »

Ok.

I'm still not sure if I really need it. Would the servicestatustext always contain enough information or not. The problem is also that when I pass the servicestatustextlong and it is empty, Powershell does not see the parameter and will set the next passed parameter (in the above example servicelastcheck) as the value of servicestatustextlong.

This means that I better not use the servicestatustextlong or I need to check if it's empty in the bash script. I was just curious to what it could contain.

Grtz

Willem
Nagios XI 5.8.1
https://outsideit.net
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: List of parameters that can be passed with actions compo

Post by abrist »

Yeah, the long macros *may* be empty. So you are better off not passing it.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Locked