Unable to execute a application specific cmd using check_nrp
-
- Madmin
- Posts: 9190
- Joined: Thu Oct 30, 2014 9:02 am
Re: Unable to execute a application specific cmd using check
The NRPE agent is used to run commands on remote systems without opening a TTY, if your command requires a terminal to run, then it would have to be changed to not need a terminal.
Be sure to check out our Knowledgebase for helpful articles and solutions!
-
- Posts: 28
- Joined: Tue Nov 04, 2014 4:19 am
Re: Unable to execute a application specific cmd using check
Changing command to not use terminal is not possible. As while command is architect to be run on different shell prompt and execute commands on that prompt then get the output. Anyhow it's depend upon application owner to raise it further.
What if I give nagios user to open a terminal which command use its on while nrpe executes it? What are the possibilities for the same??
If you can also share your views on check_by_ssh(If that is in scope of this forum). Why check_by_ssh getting failed while implemented in command.cfg but running fine for nagios server's cli.
What if I give nagios user to open a terminal which command use its on while nrpe executes it? What are the possibilities for the same??
If you can also share your views on check_by_ssh(If that is in scope of this forum). Why check_by_ssh getting failed while implemented in command.cfg but running fine for nagios server's cli.
-
- Madmin
- Posts: 9190
- Joined: Thu Oct 30, 2014 9:02 am
Re: Unable to execute a application specific cmd using check
I would guess that the check_by_ssh failed because of not having a local tty when running the command in nagios, will not open a tty on the remote system to run the command.
Be sure to check out our Knowledgebase for helpful articles and solutions!
-
- Posts: 28
- Joined: Tue Nov 04, 2014 4:19 am
Re: Unable to execute a application specific cmd using check
Thanks tgriep for your responses and valuable time. If some one want, I would like a second opinion on check_by_ssh plugin. After so much discussions, I am still at day 1 situation and need some way to figure out the Solution.
As default check_by_ssh plugin do not have feature to forcing a tty session on remote host. To overcome this scenerio, I referred a customised check_by_ssh plugin which is same as feature of check_by_ssh plugin with typical ssh protocol application potential of forcing a remote tty. (Detailed on check_by_ssh is available in my previous post on same thread) .
As default check_by_ssh plugin do not have feature to forcing a tty session on remote host. To overcome this scenerio, I referred a customised check_by_ssh plugin which is same as feature of check_by_ssh plugin with typical ssh protocol application potential of forcing a remote tty. (Detailed on check_by_ssh is available in my previous post on same thread) .
Re: Unable to execute a application specific cmd using check
The nrpe process on the remote does not even try to allocate a tty and is probably unable to do so. I can check into that further. But right now it looks like the only option is to use check_by_ssh.
Is there some reason why you want to use nrpe instead of check_by_ssh?
Is there some reason why you want to use nrpe instead of check_by_ssh?
-
- Posts: 28
- Joined: Tue Nov 04, 2014 4:19 am
Re: Unable to execute a application specific cmd using check
My 1st preference was nrpe, if that is not working then check_by_ssh.
Currently I have deployed check using check_by_ssh.
Results already shared on my previous post on this thread. Check_by_ssh is also not working while used from nagios, but working fine while used from cli.
Currently I have deployed check using check_by_ssh.
Results already shared on my previous post on this thread. Check_by_ssh is also not working while used from nagios, but working fine while used from cli.
Re: Unable to execute a application specific cmd using check
In your source for check_by_ssh.c where it checks for -z, change it to use -tt instead of -t and see if that makes any difference.
-
- Posts: 28
- Joined: Tue Nov 04, 2014 4:19 am
Re: Unable to execute a application specific cmd using check
Hi,
Sorry for delay response as I was away from system.
I am no good with C, but how much I learn by seeing source code. I made below changes
then
output from cli:
output from nagios UI: (it works)
But output is placing with junk characters too.
If I implemented with below option in command.cfg
I start getting below snapshot on nagios UI and CLI
Any further suggestions on this characters, this may be leading to not plot graph details.
BR//
Sorry for delay response as I was away from system.
I am no good with C, but how much I learn by seeing source code. I made below changes
Code: Select all
case 'z': /* -4 for IPv4 */
comm_append("-tt");
break;
Code: Select all
make
make all
make install
Code: Select all
[nagios@Nagiosserver ~]$ /usr/local/nagios/libexec/check_by_ssh -z -E -H <Remote server IP> -C /usr/local/nagios/libexec/check_watchque
Ok: Message rate is 2 | 2
If I implemented with below option in command.cfg
Code: Select all
# 'check_by_ssh' command definition
define command{
command_name check_by_ssh_watchque
command_line $USER1$/check_by_ssh -z -E -S -t 20 -H $HOSTADDRESS$ -C "/usr/local/nagios/libexec/check_watchque"
}
-S, --skip-stdout[=n]
Ignore all or (if specified) first n lines on STDOUT [optional]
-E, --skip-stderr[=n]
Ignore all or (if specified) first n lines on STDERR [optional]
Code: Select all
[nagios@nagiosserver~]$ /usr/local/nagios/libexec/check_by_ssh -v -z -E -S -H <Remote server IP> -C /usr/local/nagios/libexec/check_watchque
Command: /usr/bin/ssh
Argument 1: -tt
Argument 2: (remote server ip)
Argument 3: /usr/local/nagios/libexec/check_watchque
OK - check_by_ssh: Remote command '/usr/local/nagios/libexec/check_watchque' returned status 0
BR//
You do not have the required permissions to view the files attached to this post.
Last edited by diwakar0304 on Wed May 03, 2017 1:00 pm, edited 1 time in total.
Re: Unable to execute a application specific cmd using check
Ok, it sounds like we're making progress.
Those junk characters look like terminal control sequences (move cursor, set colors, etc.).
Try replacing this part: /bin/sed 's/(//g' with this: /bin/sed 's/\x1b[\[(0-9a-zA-Z;]*//g and see if that gets rid of the garbage.
Those junk characters look like terminal control sequences (move cursor, set colors, etc.).
Try replacing this part: /bin/sed 's/(//g' with this: /bin/sed 's/\x1b[\[(0-9a-zA-Z;]*//g and see if that gets rid of the garbage.
-
- Posts: 28
- Joined: Tue Nov 04, 2014 4:19 am
Re: Unable to execute a application specific cmd using check
No Luck!!!!
Attaching strace output for same. Can you please help me to understand why performance data is not processing?
Attaching strace output for same. Can you please help me to understand why performance data is not processing?
You do not have the required permissions to view the files attached to this post.