11-10-2017, 09:35 AM
I'm trying to do something similar to the ICMP Checks in https://wiki.pandorafms.com/index.php?ti...Operations section 1.7.1
but the outcome of module_exec does not show up as expected in the FMS Console. Running the command locally does indeed work.
The manual gives this example:
My intallation is base on pandorafms.agent_unix_7.0NG.714.deb, pandorafms.console_7.0NG.714.deb and pandorafms.server_7.0NG.714.deb
Excerpt from my /etc/pandora/pandora_agent.conf, where I've cleaned up the configuration to make the bug more obvious:
Running the commands manually in the shell works as expected:
$ echo 0
0
$ echo 1
1
$ false; if [ $? == 0 ]; then echo 1; else echo 0; fi
0
$ true; if [ $? == 0 ]; then echo 1; else echo 0; fi
1
But, the FMS Console shows:
Always 0
0
Always 1
1
Always 0 complicated
0
Always 1 complicated
0
Thus it seems like the if-selection does not work when running in the Pandora Agent, but it works when running from the command line.
but the outcome of module_exec does not show up as expected in the FMS Console. Running the command locally does indeed work.
The manual gives this example:
Code:
module_begin
module_name Ping
module_type generic_proc
module_exec ping -c 1 192.168.100.54 >/dev/null 2>&1; if [ $? == 0 ]; then echo 1; else echo 0; fi
module_end
My intallation is base on pandorafms.agent_unix_7.0NG.714.deb, pandorafms.console_7.0NG.714.deb and pandorafms.server_7.0NG.714.deb
Excerpt from my /etc/pandora/pandora_agent.conf, where I've cleaned up the configuration to make the bug more obvious:
Code:
module_begin
module_name Always 0
module_type generic_proc
module_exec echo 0
module_end
module_begin
module_name Always 1
module_type generic_proc
module_exec echo 1
module_end
module_begin
module_name Always 0 complicated
module_type generic_proc
module_exec false; if [ $? == 0 ]; then echo 1; else echo 0; fi
module_end
module_begin
module_name Always 1 complicated
module_type generic_proc
module_exec true; if [ $? == 0 ]; then echo 1; else echo 0; fi
module_end
Running the commands manually in the shell works as expected:
$ echo 0
0
$ echo 1
1
$ false; if [ $? == 0 ]; then echo 1; else echo 0; fi
0
$ true; if [ $? == 0 ]; then echo 1; else echo 0; fi
1
But, the FMS Console shows:
Always 0
0
Always 1
1
Always 0 complicated
0
Always 1 complicated
0
Thus it seems like the if-selection does not work when running in the Pandora Agent, but it works when running from the command line.