Closed ExocTBlid closed 8 years ago
Which version of bash? And what is the full command line you are using to run it? I'm not able to repro with bash 4.3.11.
We need to provide ruby wrappers for the non-ruby files.
Sorry, it's been a while since I tried this. I used a different script in the mean time. Thanks for your work on this!
@eheydrick i'm getting this when running from sensu,
Is there anything needed to run as is ?
@Akshaykapoor which platform is this on? Sounds like your sudoers has Defaults requiretty
which requires sudo to run from a login session. You'd to remove that to get sudo working in non-interactive shells.
btw #sensu IRC is a better way to get support for plugins. There are lots of sensu users around to help out.
@eheydrick My bad i read the script and it mentions there to include to allow sensu user sudo access without passwords. And i could resolve that. But came across another issue which is, when i install the gem and specify the check-name to run, it's failing with the following.,
/opt/sensu/embedded/bin/java-heap-pcnt.sh:23:in `load': /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-plugins-java-0.0.3/bin/java-heap-pcnt.sh:15: syntax error, unexpected tCONSTANT, expecting keyword_do_cond or ';' or '\n' (SyntaxError) while getopts 'w:c:n:hp' OPT; do ^ /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-plugins-java-0.0.3/bin/java-heap-pcnt.sh:15: syntax error, unexpected keyword_do_cond, expecting end-of-input from /opt/sensu/embedded/bin/java-heap-pcnt.sh:23:in `<main>'
Note: if i run the script from the terminal it just works fine. Any idea why like this ? Thanks!
@Akshaykapoor The problem is with binstubs - it's trying to execute the shell script as ruby which obviously doesn't work. To get around this we've been adding ruby binstub wrappers. We need to add them for these plugins. I'll do that ASAP.
0.0.4 has been released with ruby binstubs for the non-ruby scripts. Use check-java-heap-pcnt.rb
in your check. See the README for more details.
I'm getting the following error when running java-heap-pcnt.sh:
This is running on an Amazon AMI with Ruby 2.0 and I assume there's an conflict with Ruby loading the gem that runs the Bash script.