<div dir="ltr">Adding Thomas, as this could be interesting for Fuse on Karaf if we proceed with this javaagent.</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 8, 2017 at 6:08 PM, John Mazzitelli <span dir="ltr">&lt;<a href="mailto:mazz@redhat.com" target="_blank">mazz@redhat.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Right now, the Hawkular WildFly Agent runs as a WildFly subsystem extension - which means it must run in EAP.<br>
<br>
To avoid this requirement, I refactored the agent code [1] so it can be run using a standard VM javaagent (using the VM argument -javaagent).<br>
<br>
This means the agent need not run as a subsystem extension, in fact, it can run in any VM (non-EAP/WildFly based). Just pass in the -javaagent command line argument to your VM and you got an agent. You have a Karaf container in a JVM exposing metrics via JMX? You can use this. You got a vert.x server in a JVM exposing metrics via JMX? You can use this.<br>
<br>
This new agent&#39;s config file is a single YAML file that mimics virtually the same settings as you see today in the agent&#39;s &lt;subsystem&gt; XML in standalone.xml.<br>
<br>
Like the EAP-based agent, this new agent can still:<br>
<br>
* collect DMR metrics and inventory from any EAP 6.4, EAP 7.x, or WildFly 10+ servers - local or remote.<br>
* collect JMX metrics and inventory from any remote Jolokia endpoint or local JMX MBeanServer<br>
* receive websocket messages from a Hawkular Server (if running in full Hawkular mode)<br>
* run in metrics-only mode where it only stores data to Hawkular-Metrics and does not connect via websocket to the server nor stores inventory to H-Inventory<br>
* Talk to the Hawkular Server and remote DMR/JMX endpoints via SSL/https using defined security-realms/keystores<br>
<br>
Unlike the EAP-based agent, this new agent:<br>
<br>
* does NOT have a CLI (jboss-cli.sh is the EAP-based agent&#39;s CLI)<br>
* does NOT have a built-in configuration persistent mechanicm (EAP-based agents can persist their config changes to standalone.xml when those changes are made via the WildFly management interface - because the javaagent is completely independent, it has nothing like this for its YAML config).<br>
* does NOT integrate with the lifecycle of any EAP/WildFly running in the same VM (in other words, if you ask to &quot;reload&quot; the EAP server, the javaagent knows nothing about that and won&#39;t also itself reload. Remember, this javaagent is now completely independent of any co-located EAP/WildFly server).<br>
<br>
In addition, if your JVM is installed in OpenShift, you can get the nice option of putting the javaagent&#39;s YAML config in a config map and mount it so your javaagent can access it. This means you can edit your javaagent YAML directly in the OpenShift UI :)<br>
<br>
I still need to see how well this supports the disabling/enabling of metrics on the fly from the websocket commands (e.g. I will need to add the ability to change the YAML config to persist the settings, that is not done yet - the EAP-based agent got this support for free - its config changes go into standalone.xml).<br>
<br>
Other than persisting changes to the YAML file, I believe this javaagent will work essentially the same as the current agent (indeed, the core agent engine is identical - its the same code). Just have to make sure the websocket commands can work considering there is a YAML config backing the settings and not standalone.xml.<br>
<br>
I need people&#39;s feedback on this. Thoughts? If you want to try it, you can build it from my PR right now using the README [2] and the instructions [3].<br>
<br>
--John Mazz<br>
<br>
[1] <a href="https://github.com/hawkular/hawkular-agent/pull/302" rel="noreferrer" target="_blank">https://github.com/hawkular/<wbr>hawkular-agent/pull/302</a><br>
<br>
[2] <a href="https://github.com/jmazzitelli/hawkular-agent/blob/refactor-core/hawkular-javaagent/README.adoc" rel="noreferrer" target="_blank">https://github.com/<wbr>jmazzitelli/hawkular-agent/<wbr>blob/refactor-core/hawkular-<wbr>javaagent/README.adoc</a><br>
<br>
[3] Instructions to build using the PR and test it by collecting EAP metrics:<br>
<br>
1) Build it:<br>
<br>
   $ git clone git@github.com:hawkular/<wbr>hawkular-agent.git<br>
   $ cd hawkular-agent<br>
   $ git checkout -b jmazzitelli-refactor-core master<br>
   $ git pull <a href="https://github.com/jmazzitelli/hawkular-agent.git" rel="noreferrer" target="_blank">https://github.com/<wbr>jmazzitelli/hawkular-agent.git</a> refactor-core<br>
   $ mvn clean install<br>
<br>
2) Install it - assuming you have a base EAP 6.4 or 7.x or WildFly 10+ installed at &lt;eap.dir&gt;<br>
<br>
2a) Change this line in &lt;eap.dir&gt;/bin/standalone.conf:<br>
<br>
   JBOSS_MODULES_SYSTEM_PKGS=&quot;<wbr>org.jboss.byteman&quot;<br>
<br>
to this:<br>
<br>
   JBOSS_MODULES_SYSTEM_PKGS=&quot;<wbr>org.jboss.byteman,org.jboss.<wbr>logmanager&quot;<br>
<br>
2b) Inside that same &lt;eap.dir&gt;/bin/standalone.conf you add this line in the<br>
    appropriate place (you know where, just under where it sets JAVA_OPTS):<br>
<br>
   JAVA_OPTS=&quot;$JAVA_OPTS -Djava.util.logging.manager=<wbr>org.jboss.logmanager.<wbr>LogManager -javaagent:$JBOSS_HOME/bin/<wbr>hawkular-javaagent-*.jar=<wbr>config=$JBOSS_HOME/standalone/<wbr>configuration/real-config*.<wbr>yaml,delay=10&quot;<br>
<br>
2c) Copy the binary/config files you built to that EAP / WildFly install:<br>
<br>
   cp hawkular-agent/hawkular-<wbr>javaagent/target/hawkular-<wbr>javaagent-*-jar-with-<wbr>dependencies.jar &lt;eap.dir&gt;/bin<br>
<br>
   if EAP 7.x/WildFly 10+:<br>
<br>
   cp hawkular-agent/hawkular-<wbr>javaagent/src/test/resources/<wbr>real-config.yaml &lt;eap.dir&gt;/standalone/<wbr>configuration<br>
<br>
   if EAP 6.4:<br>
<br>
   cp hawkular-agent/hawkular-<wbr>javaagent/src/test/resources/<wbr>real-config-eap6.yaml &lt;eap.dir&gt;/standalone/<wbr>configuration<br>
<br>
<br>
<br>
<br>
______________________________<wbr>_________________<br>
hawkular-dev mailing list<br>
<a href="mailto:hawkular-dev@lists.jboss.org">hawkular-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/hawkular-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/<wbr>mailman/listinfo/hawkular-dev</a><br>
<br>
<br>
</blockquote></div><br></div>