DX Application Performance Management

  • 1.  EPAgent Custom Stateful Plugin Issue

    Posted Apr 25, 2015 03:22 PM

    I have written a custom java log tailer to monitor logs. We would use the standard EPAgent WebSphere log parser, but we are not allowed to install perl on some Windows servers. The java log parser I wrote is working fine from a command line and it outputs the metric data to System.out once every minute, but rather than sending the data to the EM, the EPAgent is just writing the System.out information to the console and Introscope log file. I've written several stateless java EPA plugins and one stateful java EPA plugin, and I've never had problems with the System output going to the EM instead of the console and log file. Does anyone have any examples of stateful java plugins (code and configuration)?



  • 2.  Re: EPAgent Custom Stateful Plugin Issue

    Broadcom Employee
    Posted Apr 25, 2015 10:17 PM
    The main thing with EPA is reading data from stdout. Can you manually run your plugin and verify the xml output?
    Can you post the output in a reply or as a text file attachment? 


  • 3.  Re: EPAgent Custom Stateful Plugin Issue

    Posted Apr 26, 2015 02:10 AM

    Here is one line of stdout that was found in the log file...

    <metric type="LongCounter" name="Log Monitor|Mobile Logins:Count" value="2"/>

     

    The plugin configuration in the IntroscopeEPAgent.properties file is:

    introscope.epagent.plugins.stateful.names=WSVC1

    introscope.epagent.stateful.WSVC1.class=com.dukeenergy.introscope.io.LogScraper props=d:/cawily/epagent/LogScraper.properties pattern=yyMMdd log=d:/inetpub/logs/LogFiles/W3SVC1/u_exyyMMdd.log increment=day delay=30

     

    The LogScraper class is attached to this post, and that class calls the WilyMetricReporter class, which is also attached. Don't judge the code too harshly as it was written under time constraints .

     

    Thanks for your help!



  • 4.  Re: EPAgent Custom Stateful Plugin Issue

    Broadcom Employee
    Posted Apr 26, 2015 12:08 PM

    Put the EPA logging into DEBUG mode and let us know if anything interesting is in the log.



  • 5.  Re: EPAgent Custom Stateful Plugin Issue

    Posted Apr 26, 2015 09:06 PM

    I tried to set the logging level to DEBUG, but I didn't see any extra information. We are calling the EPAgent through a wrapper service, which may be why. FYI I tried running it out of the wrapper service and got the same result. I just ran the EPAgent with this plugin as a stateless plugin and the data was output to the EM as expected. See screenshot...

    epagent.png



  • 6.  Re: EPAgent Custom Stateful Plugin Issue
    Best Answer

    Posted Apr 27, 2015 01:16 PM

    Well I got it working by a hack. I enabled the socket listener of the EPAgent and wrote the XML packet to the socket in the java code. It works, but I don't like it and would like a better solution if anyone is able to provide one. Below is the code. I'm passing in localhost and 8000 as the host and port parameters.

     

        public WilyMetricReporter(String metricName, long val, String host, int port) {

            try {

                Socket socket = new Socket(host, port);

                PrintWriter out = new PrintWriter(socket.getOutputStream(), true);

                out.write("<metric type=\"LongCounter\" name=\"" + metricName + "\" value=\"" + val + "\"/>");

                out.flush();

                out.close();

            } catch (IOException ex) {

                Logger.getLogger(WilyMetricReporter.class.getName()).log(Level.SEVERE, null, ex);

            }

        }



  • 7.  Re: EPAgent Custom Stateful Plugin Issue

    Broadcom Employee
    Posted Apr 27, 2015 01:19 PM

    That's awesome you worked around the issue!

     

    I'm sorry I haven't had time to dig into this more, but I did start to look at it and will test against my own IIS instance.



  • 8.  Re: EPAgent Custom Stateful Plugin Issue

    Posted Apr 27, 2015 03:45 PM

    Thanks for your help, Hiko! I think we have a workable solution for now, but I do want to figure out what is preventing the original plugin from functioning properly. I am at a loss for what is going on.