DX Application Performance Management

Expand all | Collapse all

EPAgent FindBin.pm module

Jump to Best Answer
  • 1.  EPAgent FindBin.pm module

    Posted 09-14-2016 03:24 PM

    Hello,

     

    Can any one provide me the FindBin.pm module which is included in the epagent? I don't see on version 10.x EPAgent packages which are available in download center. 

     

    I did download the module from the CPAN and copied in the epaplugins/lib/perl/Wily but it's not working. 

    I am getting below error.

    /weblogicLogReader.pl: line 30: use: command not found
    ./weblogicLogReader.pl: line 31: syntax error near unexpected token `('
    ./weblogicLogReader.pl: line 31: `use lib ("$FindBin::Bin", "$FindBin::Bin/../lib/perl");'

     

    Thanks in advance.

     

    Regards,

    Nick



  • 2.  Re: EPAgent FindBin.pm module

    Posted 09-14-2016 04:57 PM

    In your IntroscopeEPAgent.properties file, how are you calling the script?  Can you share the property line here?

     

    Also can you run the perl script from the shell?  Is perl in your path?



  • 3.  Re: EPAgent FindBin.pm module

    Posted 09-14-2016 05:46 PM

    Hi,

     

    This is the syntax what i am using the properties file.

     


    introscope.epagent.plugins.stateful.names=VMSTAT,WEBLOGIC
    introscope.epagent.stateful.WEBLOGIC.command=perl /opt/apps/wily/EPAgent10.0.0.12/epagent/epaplugins/weblogic/weblogicLogReader.pl

     

    When i run this from shell

     

    (xxxxxxxxxxx@xxxxxxxxxxxxxx)$ ./weblogicLogReader.pl
    ./weblogicLogReader.pl: line 30: use: command not found
    ./weblogicLogReader.pl: line 31: syntax error near unexpected token `('
    ./weblogicLogReader.pl: line 31: `use lib ("$FindBin::Bin", "$FindBin::Bin/../lib/perl");'

     

    Yes, Perl is added in the path.

     

    Thanks,

    Nick



  • 4.  Re: EPAgent FindBin.pm module

    Posted 09-15-2016 09:19 AM

    Hi Nick,

     

    Ok the reason you get the below is:

     

    (xxxxxxxxxxx@xxxxxxxxxxxxxx)$ ./weblogicLogReader.pl
    ./weblogicLogReader.pl: line 30: use: command not found

     

    you need to specify perl because it is trying to execute it as a shell script and thus, use is unknown to the OS.  Example:

    (xxxxxxxxxxx@xxxxxxxxxxxxxx)$ perl weblogicLogReader.pl

     

    In your properties file, try this (in my environment perl is in /usr/bin.  While I can access perl from my shell without specifying /usr/bin, when I run the EPAgent, it cannot find perl).

     

    introscope.epagent.stateful.WEBLOGIC.command=/usr/bin/perl /opt/apps/wily/EPAgent10.0.0.12/epagent/epaplugins/weblogic/weblogicLogReader.pl

     

    Thanks,
    Matt



  • 5.  Re: EPAgent FindBin.pm module

    Posted 09-15-2016 09:22 AM

    Hi Nick:

        Please let us know if Matt's last suggestion is helpful and helps in getting the module to work.

    Thanks

    Hal German



  • 6.  Re: EPAgent FindBin.pm module

    Posted 09-15-2016 11:37 AM

    Hi Matt,

     

    Thanks for the suggestion, but when i run the below command  it's never closing  and when i put this in EPAgent properties file it's not printing any metrics in the investigator. However the logs are showing the EPAgent plugin is running.I validated this for 30 mins.

    I am trying to match the "ERROR" String  and i see  10 of them in the logs, not sure is there any issue with the CFG or Perl script.I am trying to parse the very small log which is < 3.5K.

    (xxxx@xxxx)$ /usr/bin/perl /opt/apps/wily/EPAgent10.0.0.12/epagent/epaplugins/weblogic/weblogicLogReader.pl

     

    Thanks,

    Nikhil



  • 7.  Re: EPAgent FindBin.pm module

    Posted 09-15-2016 11:42 AM

    Log Readers are meant to run as STATEFUL plugins, which means they start up with EPA and continues to run until it is stopped.



  • 8.  Re: EPAgent FindBin.pm module

    Posted 09-15-2016 12:04 PM

    Can you upload the epagent log here?



  • 9.  Re: EPAgent FindBin.pm module

    Posted 09-15-2016 11:47 AM

    Yes, but i am trying to parse very small logfile (20 lines) and the sleep time for each run in 15 sec, but it's never putting any metrics in the investigator. 

     

    Thanks,

    Nick



  • 10.  Re: EPAgent FindBin.pm module

    Posted 09-15-2016 11:50 AM

    Typical sleep time for a log reader is 30+ seconds per interval. You don't need it to run at 15 seconds because the log reader will read from its current position to the last line of the file.

     

    The easiest way to test this is to insert a line and save it while watch the log reader. If the log reader doesn't pick up the change, then there's something wrong with your pattern matching.



  • 11.  Re: EPAgent FindBin.pm module

    Posted 09-15-2016 01:29 PM

    Hello Matt/Davis,

     

    Thanks for you suggestions. I tried with the new logreader.pm, but no help.

    Please find the attached log and cfg and pl file.



  • 12.  Re: EPAgent FindBin.pm module

    Posted 09-15-2016 01:31 PM

    Please find the attached

    Attachment(s)

    zip
    More details.txt.zip   1K 1 version
    zip
    epagentStartup.log.zip   2K 1 version


  • 13.  Re: EPAgent FindBin.pm module

    Posted 09-15-2016 01:42 PM

    Can you show us how you configured the STATEFUL plugin entry in EPAgent.properties?



  • 14.  Re: EPAgent FindBin.pm module

    Posted 09-15-2016 01:54 PM

    introscope.epagent.plugins.stateful.names=VMSTAT,WEBLOGIC

    introscope.epagent.stateful.WEBLOGIC.command=/usr/bin/perl /opt/apps/wily/EPAgent10.0.0.12/epagent/epaplugins/weblogic/weblogicLogReader.pl



  • 15.  Re: EPAgent FindBin.pm module

    Posted 09-15-2016 05:09 PM

    The default for doing a pattern match on WLS logs is '<Error>' or '(.*<Error>.*)'.

     

    Check your log for the proper syntax and update your .cfg file and try again.



  • 16.  Re: EPAgent FindBin.pm module

    Posted 09-15-2016 05:21 PM

    I did try with the '<ERROR>', but it didn't work. I'll try the other one and let you know.

    Our requirement is to match the string like "ERR_YYY_700_3000", but it's not the Web logic JVM logs, it's in the application logs. As a testing,  i am trying to match the ERROR in weblogic logs and depends on the results, I'll work on  match the string in the application logs.

     

    Thanks,

    Nick



  • 17.  Re: EPAgent FindBin.pm module

    Posted 09-15-2016 05:24 PM

    Can you give me a full string example?

    I'll post my pattern match for you to try.



  • 18.  Re: EPAgent FindBin.pm module

    Posted 09-15-2016 05:33 PM

    For example this is the entry which is in the logs

     

    016-09-15 05:38:00,530 ERROR xxxxxxxxxxxxxxxxxxxxxx -err_code:ERR_YYY_500_0012~referenceId:~sessionId:XXXXXXXXXXXXX

     

    and i want to match ERR_YYY_500_0012 and put the number of occurrences in Epagent metrics

    Thanks,

    Nick



  • 19.  Re: EPAgent FindBin.pm module

    Posted 09-15-2016 06:18 PM

    Try this in your cfg file:

     

    METRICS = [
      {
        match => '^.*(ERR\_\d{3}\_\d{3}\_\d{4}).*$',
        metricType => 'IntAverage',
        metricName => '$1|MessageCount_Error',
        metricValue => '$CURRENTCOUNT'
      },

      {
        match => '\d{3}\-\d{2}\-\d{2}\s\d{2}\:\d{2}:\d{2}\,\d{3}\sERROR\s(\w+)\s\-err\_code\:(ERR\_\d{3}\_\d{3}\_\d{4})\~referenceId\:\~sessionId\:\w+$',
        metricType => 'StringEvent',
        metricName => '$2|Error_Message',
        metricValue => '$1'
      },

      {
        match => '(\d{3}\-\d{2}\-\d{2})\s\d{2}\:\d{2}:\d{2}\,\d{3}\sERROR\s\w+\s\-err\_code\:(ERR\_\d{3}\_\d{3}\_\d{4})\~referenceId\:\~sessionId\:\w+$',
        metricType => 'StringEvent',
        metricName => '$2|Date',
        metricValue => '$1'
      },

      {
        match => '\d{3}\-\d{2}\-\d{2}\s(\d{2}\:\d{2}:\d{2}\,\d{3})\sERROR\s\w+\s\-err\_code\:(ERR\_\d{3}\_\d{3}\_\d{4})\~referenceId\:\~sessionId:\w+$',
        metricType => 'StringEvent',
        metricName => '$2|Time',
        metricValue => '$1'
      },

      {
        match => '^\d{3}\-\d{2}\-\d{2}\s\d{2}\:\d{2}:\d{2}\,\d{3}\sERROR\s\w+\s\-err\_code\:(ERR\d{3}\_\d{3}\_\d{4})\~referenceId\:\~sessionId:(\w+)$',
        metricType => 'StringEvent',
        metricName => '$1|sessionId',
        metricValue => '$2'
      },

    ]


  • 20.  Re: EPAgent FindBin.pm module

    Posted 09-15-2016 06:53 PM

    Thanks Davis,

     

     

    I’ll try this option, there are so many error codes but I don’t want to match all of them. I want to match only some(ex: ERR_YYY_500_0012 and ERR_YYY_900_0073, but don’t match ERR_800_1523) and I don’t want to put any strings to avoid the metric explosion. I just need the match string and get the count.

    Will it be possible to mention like below

     

    METRICS = [
    {
     match => '^.* ERR_YYY_500_0012.*$',
     metricType => 'IntAverage',
     metricName => '$1|MessageCount_Error',
     metricValue => '$CURRENTCOUNT'
     },


    {
     match => '^.*ERR_YYY_900_0073.*$',
     metricType => 'IntAverage',
     metricName => '$1|MessageCount_Error',
     metricValue => '$CURRENTCOUNT'
     },

     

    Thanks,

    Nick



  • 21.  Re: EPAgent FindBin.pm module
    Best Answer

    Posted 09-15-2016 06:58 PM

    You will need to put parenthesis around the error code in order to use '$1'.

     

    METRICS =[
      {
        match =>'^.*(ERR\_YYY\_500\_0012).*$',
        metricType =>'IntAverage',
        metricName =>'$1|MessageCount_Error',
        metricValue =>'$CURRENTCOUNT'
      },

      {
        match =>'^.*(ERR\_YYY\_900\_0073).*$',
        metricType =>'IntAverage',
        metricName =>'$1|MessageCount_Error',
        metricValue =>'$CURRENTCOUNT'
      },

    ]

     

    You must always escape special characters when using regular expressions.



  • 22.  Re: EPAgent FindBin.pm module

    Posted 09-15-2016 07:03 PM

    Thanks David, this is helpful. I'l try this.

     

    Regards,

    Nick



  • 23.  Re: EPAgent FindBin.pm module

    Posted 09-16-2016 07:38 AM

    Hi Nick:

        We started out on FindBin.pm and now gotten into logreader.pm. I am splitting this into two threads and marking the original one as answered since we are not discussing FindBin.PM anymore

    Hal German