sensu-plugins / sensu-plugins-java

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

Enabling separate metrics pull #39

Open danijel-zima opened 5 years ago

danijel-zima commented 5 years ago

To get separate metrics per JAVA process, following modifications have to be done: in metrics-java-heap-graphite-java8.sh Lines 40 & 65 instead: PID=$(sudo jps | grep " $NAME$" | awk '{ print $1}') & projectName=$(sudo jps | grep $PID | awk '{ print $2}' | cut -d. -f1)

It would be nice to have:

PID=$(sudo jps -l | grep " $NAME$" | awk '{ print $1}') & projectName=$(sudo jps -l | grep $PID | awk '{ print $2}' | cut -d. -f1)

And

in metrics-java-heap-graphite.sh

Line 50 project=$(sudo jps | grep $PID | awk '{ print $2 }' | cut -d. -f1) to project=$(sudo jps -l | grep $PID | awk '{ print $2 }' | cut -d. -f1)

-l is added after jps command

Best Regards