Page 1 of 1

List of parameters that can be passed with actions component

Posted: Wed Aug 13, 2014 7:10 am
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

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

Posted: Wed Aug 13, 2014 9:17 am
by tmcdonald
Yes sir:

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

Bottom of the doc it lists all the macros available.

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

Posted: Wed Aug 13, 2014 10:44 am
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

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

Posted: Wed Aug 13, 2014 4:21 pm
by abrist
It very well could be as it was empty in all of my tests.

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

Posted: Wed Aug 13, 2014 4:21 pm
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.

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

Posted: Thu Aug 14, 2014 4:14 am
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

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

Posted: Thu Aug 14, 2014 4:35 pm
by abrist
Yeah, the long macros *may* be empty. So you are better off not passing it.