WebSphere Application Server & Liberty

 View Only
Expand all | Collapse all

Metrics App: Error invalid UTF8 string '\xe9' with WAS 905 & Prometheus

  • 1.  Metrics App: Error invalid UTF8 string '\xe9' with WAS 905 & Prometheus

    IBM Champion
    Posted Sun June 11, 2023 03:30 PM

    Hello,
    I'm trying to use the Metrics application provided by IBM with WAS from version 9.0.5.7.

    I have installed WAS ND version 9.0.5.15, on a Windows 10 workstation in French.
    I've deployed the metrics application, which is available at http://localhost:9019/metrics

    I installed Prometheus (prometheus-2.44.0.windows-amd64.zip), and configured the scrape.
    On http://localhost:9090/targets, I've had the error:
    ---
    help text "M\xe9moire totale (en octets) dans l'environnement d'ex\xe9cution de la JVM." is not a valid utf8 string
    ---

    If I do a:
    curl http://localhost:9019/metrics | promtool check metrics
    I get:
    ---
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
      0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0error while linting: text format parsing error in line 103: invalid label value "Module d'\xe9coute de messages"
      0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
    curl: (23) Failure writing output to destination
    ---
    Any ideas ?
    Thanks in advance.

    ---------



    ------------------------------
    Luc-Michel Demey
    DEMEY CONSULTING
    lmd@demey-consulting.fr
    #IBMChampion
    ------------------------------


  • 2.  RE: Metrics App: Error invalid UTF8 string '\xe9' with WAS 905 & Prometheus

    IBM Champion
    Posted Wed June 21, 2023 05:22 AM

    In my opinion, the error you're encountering seems to be related to encoding issues with the text retrieved from the Metrics application. It appears that the French characters in the help text are causing problems when Prometheus tries to parse the metrics.

    To resolve this, you can try the following steps:

    1. Update Prometheus configuration: In your Prometheus configuration file (prometheus.yml), specify the character encoding explicitly for scraping the metrics. Add the following line at the top of the file:

    scrape_config: encoding: ISO-8859-1

    Save the file and restart Prometheus.

    Verify the Metrics application configuration: Ensure that the Metrics application is configured correctly to provide metrics in a compatible encoding, such as UTF-8. 

    Check JVM settings: Verify the JVM settings for both the Metrics application and Prometheus. Ensure that the JVM is configured to use an appropriate character encoding, such as UTF-8, by setting the file.encoding system property. You can add the following line to the JVM arguments in the startup script (e.g., server.xml):

    -Dfile.encoding=UTF-8

    Restart both the Metrics application and Prometheus after making this change.

    Verify the installation: Double-check that you have installed the correct versions of both the Metrics application and Prometheus. Ensure that they are compatible and support the same encoding.



    ------------------------------
    Youssef Sbai Idrissi
    Software Engineer
    ------------------------------



  • 3.  RE: Metrics App: Error invalid UTF8 string '\xe9' with WAS 905 & Prometheus

    IBM Champion
    Posted Mon June 26, 2023 03:51 AM

    Hello,
    Sorry for the delay in replying, I was travelling.
    Thank you for all this information, but I can't use it.

    Concerning
     encoding: 'ISO-8859-1
    wherever I place it in the .yml file, I get errors.
    Example :

    global:
      scrape_interval: 15s 
      evaluation_interval: 15s
    scrape_configs:
      encoding: 'ISO-8859-1'
        - job_name: 'LMD_905'
          static_configs:
          - targets: ['localhost:9019']  
    Result:
    prometheus.exe --config.file="prometheus_2.yml"
    ts=2023-06-26T06:49:44.489Z caller=main.go:479 level=error msg="Error loading config (--config.file=prometheus_2.yml)" file=D:\prometheus\prometheus_2.yml err="parsing YAML file prometheus_2.yml: yaml: line 5: did not find expected key"

    Without the line "encoding: 'ISO-8859-1'", the file is ok.

    What is the exact syntax to use?

    Regarding the configuration of the Metrics application, I don't know how to configure it to produce UTF-8. 
    Regarding the JVM parameters, I'm in a tWAS ND environment, so adding launch parameters isn't practical (impact on other applications).

    Prometheus is in version 2.44.0, and the metrics.ear application is the one supplied with WAS 9.0.5.15.

    Can you please help me?



    ------------------------------
    Luc-Michel Demey
    DEMEY CONSULTING
    lmd@demey-consulting.fr
    #IBMChampion
    ------------------------------