check_by_ssh -C problem

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
lhsch
Posts: 4
Joined: Mon Apr 16, 2012 1:07 pm

check_by_ssh -C problem

Post by lhsch »

Hi all.

I have a little question . . . . Can I do the following?

./check_by_ssh -t XX -H localhost -l <user> -p <port> -C "cd $ARGS1$ ; ./check_cpu_stats.sh -w <WARN> -c <CRIT>"

If i do this from a command line it works fine but If I do frm commands.cfg Nagios only use -C 'cd $ARGS1$ because ";" is a comment char.

Is it possible? Can I tell nagios that ";" is a part of -C command?

Regards.

Luis
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_by_ssh -C problem

Post by scottwilkerson »

First, it should be $ARG1$ not $ARGS1$

I'm not positive, but you may be able to escape it with \

Code: Select all

./check_by_ssh -t XX -H localhost -l <user> -p <port> -C "cd $ARG1$ \; ./check_cpu_stats.sh -w <WARN> -c <CRIT>"
But also, there should be no need to change directory with this command, you could just do

Code: Select all

./check_by_ssh -t XX -H localhost -l <user> -p <port> -C "$ARG1$/check_cpu_stats.sh -w <WARN> -c <CRIT>"
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
lhsch
Posts: 4
Joined: Mon Apr 16, 2012 1:07 pm

Re: check_by_ssh -C problem

Post by lhsch »

I just tired to escape with "\" but it doesn't work.
Tanks Scott.
Regards.
lhsch
Posts: 4
Joined: Mon Apr 16, 2012 1:07 pm

Re: check_by_ssh -C problem

Post by lhsch »

And I tried with multiple -C too, but only executes the first command:

check_by_ssh -t 90 -H localhost -l <user> -p 3331 -s c1:c2:c3 -C "date" -C "uptime" -C "whoami"
Tue Apr 17 08:14:36 CUT 2012

Is there anything wrong?

Thanks.
lhsch
Posts: 4
Joined: Mon Apr 16, 2012 1:07 pm

Re: check_by_ssh -C problem

Post by lhsch »

Hi.
Ijust resolved my problem.
defining $USERX$=; in resource.cfg file . . . .
then . . . .
./check_by_ssh -t XX -H localhost -l <user> -p <port> -C "cd $ARGS1$ $USERX$ ./check_cpu_stats.sh -w <WARN> -c <CRIT>"

Tks.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_by_ssh -C problem

Post by scottwilkerson »

That's a unique way to do it. glad you got it resolved
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked