sensu-plugins / sensu-plugins-java

Sensu Java Plugins
http://sensu-plugins.io
MIT License
5 stars 25 forks source link

Can't get metrics-jstat.rb to work because of the elevated privileges required by jstat #9

Open bradenwright opened 7 years ago

bradenwright commented 7 years ago

metrics-jstat.rb works fine from my local command line metrics-jstat.rb -j :::app_name::: -H :::name::: of course on the command line I have to actually type the app name. But it doesn't seem to work when running from sensu. It simple exits 1 with no output, and I don't see any details in sensu logs.

I've even tried giving sensu user full sudo access.

efontana commented 7 years ago

Bump, same problem here. I can see it's executing in the sensu-client.log and sensu-server.log(s) but there is no output. it's almost as if there is too much output?

efontana commented 7 years ago

I figured out why it isn't working, however I don't know yet how to get around it. In my case, I'm trying to monitor the Jenkins process, which was started by user jenkins.

when you run jps -v as user sensu, it doesn't see the jenkins process, so nothing gets printed. if I run it as root, it does, the question is what's the workaround?

andyfoster05 commented 7 years ago

Bump. Having the same issue. Tried adding sensu user to sudors all over the place, add sensu to admin groups, tried calling a script to sudo command, tried adding sudo before the check in sensu. I still cant figure out a work around.

eheydrick commented 7 years ago

jstat has to run as the user owning the java process. e.g. sudo -u nobody -g sensu metrics-jstat.py -j <processname>