Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR - Default to shebang-specified interpreter instead of default extension execution for plugins #1214

Open
jasondmichaelson opened this issue Oct 7, 2024 · 2 comments

Comments

@jasondmichaelson
Copy link

From this Forum Post https://support.nagios.com/forum/viewtopic.php?t=75785

Customer reports that the default ncpa.cfg file on Ubuntu systems doesn't handle the setup of Python correctly. The NLS plugin in question is shebang'ed to use /bin/bash, whereas /bin/sh is symlinked on Ubuntu to /bin/dash. switchinf the ncpa.cfg for .sh files to use the bash command results in success.

Since shell scripts are normally shebang'ed (as the NLS script is) to use their shell of choice, do we even need to have the ,sh handler in ncpa.cfg?

@ne-bbahn
Copy link
Contributor

ne-bbahn commented Oct 8, 2024

Can I take this as a feature request to default to the shebang'd shell and to use the default extension only if there is no specified shell?

@ne-bbahn ne-bbahn changed the title ncpa.cfg uses wrong FR - Default to shebang-specified shell instead of default extension execution for plugins Oct 8, 2024
@ne-bbahn ne-bbahn changed the title FR - Default to shebang-specified shell instead of default extension execution for plugins FR - Default to shebang-specified interpreter instead of default extension execution for plugins Oct 8, 2024
@DScrimpsher
Copy link

DScrimpsher commented Dec 19, 2024

I just built a new NLS (2024R1.3) cluster on Ubuntu 24.04. I was adding it to my Nagios XI (2024R1.3.2) system with the NCPA wizard and ran into this issue.

check_es_cluster_status.sh was giving this error:
"usr/local/ncpa/plugins/check_es_cluster_status.sh: 1: python2: not found
UNKNOWN: could not retrieve cluster health data"

check_es_jvm_heap.sh was giving this error:
"/usr/local/ncpa/plugins/check_es_jvm_heap.sh: 24: Syntax error: "(" unexpected"

I edited the file /usr/local/ncpa/etc/ncpa.cfg on the NLS server.
Changed the line towards the bottom of the file from this:
.sh = /bin/sh $plugin_name $plugin_args

to this:
.sh = /bin/bash $plugin_name $plugin_args

Now the check in Nagios is working properly for both of the NCPA plugin files check_es_cluster_status.sh and check_es_jvm_heap.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants