Code Monkey home page Code Monkey logo

prometheus_jmx_exporter_role's Introduction

Logo

Build Status

Prometheus JMX Exporter Ansible role

This ansible role installs a Prometheus Node Exporter in a debian environment.

Getting Started

These instructions will get you a copy of the role for your ansible playbook. Once launched, it will install an Prometheus JMX Exporter server in a Debian system.

Note: Beginning with the 2.1.0 version, the default behaviour is the service sending logs to systemd's journal instead to a log file. You can change it modifying the necessary ansible vars (see defaults/main.yml)

Prerequisities

Ansible 2.9.x.x version installed. Inventory destination should be a Debian environment.

For testing purposes, Molecule with Vagrant as driver (with vagrant-hostmanager) and VirtualBox as provider.

Installing

Create or add to your roles dependency file (e.g requirements.yml):

- src: idealista.prometheus_jmx_exporter_role
  version: 2.1.2
  name: prometheus_jmx_exporter

Install the role with ansible-galaxy command:

ansible-galaxy install -p roles -r requirements.yml -f

Use in a playbook:

---
- hosts: someserver
  roles:
    - role: prometheus_jmx_exporter

Usage

Look to the defaults properties file to see the possible configuration properties.

Providing custom configuration

Starting from role version 2.x.x, in order to provide custom JMX Exporter configuration, set jmx_exporter_config_template_path to the template in your playbook that is the configuration file. For example:

jmx_exporter_config_template_path: "{{ playbook_dir }}/templates/jmx_exporter/config/jmx_config.yml"

In previous versions, this variable pointed to a folder instead of a file. If you are using this role since version 1.x, you may check our migration guide

Testing

Install dependencies

$ pipenv sync

For more information read the pipenv docs.

Testing

$ pipenv run molecule test 

Built With

Ansible Molecule Goss

Versioning

For the versions available, see the tags on this repository.

Additionaly you can see what change in each version in the CHANGELOG.md file.

Authors

See also the list of contributors who participated in this project.

License

Apache 2.0 License

This project is licensed under the Apache 2.0 license - see the LICENSE file for details.

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

prometheus_jmx_exporter_role's People

Contributors

dortegau avatar jmonterrubio avatar sorobon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

prometheus_jmx_exporter_role's Issues

Add privateTmp option in service configuration

Prerequisites

Description

Some environment configurations (i.e. Debian buster docker container running on host Ubuntu 18.04 with Apparmor enabled) fail to restarting JMX exporter service because cgroups conflicts. The issue is solved setting PrivateTmp=no

Versions

All.

Add "jmx_scrape_error" check after provision/deploy

Prerequisites

Description

In the current role version, if the exporter scraping configuration provided is wrong, the role will execute everything and mark it as success, as the service doesn't fail but the scrape does. Adding a check after provision execution will help the role fail faster and mitigate this "silent misconfigurations".

Steps to Reproduce

  1. Add wrong exporter configuration
  2. Run the role in a playbook

Expected behavior: Fail, because configuration is wrong.

Actual behavior: Happily mark the execution as correct and let the exporter scrape wrongly.

Reproduces how often: Always

Versions

All

Copy a single config file in case there are more than one in templates folder

When using this role within a playbook there could be different config files for different exporters in different hosts. In order to choose the proper config file, JMX_EXPORTER | Copy exporter config task will be modified and it will only copy the file if it is named after the host's group. This file must be placed in jmx_exporter_config_template_path directory.

Upgrade to install latest jmx_exporter version (0.2.0)

Prerequisites

Description

This role should install latest jmx_exporter version (0.2.0). There are some improvements, the most interesting IMHO is that dependence on Jetty has been dropped.

Systemd doesn't kill the process on restart

Prerequisites

Description

Sometimes systemctl restart jmx_exporter fails because the jmx process is not killed.

Steps to Reproduce

  1. systemctl restart jmx_exporter

Expected behavior:
Service is restarted.

Actual behavior:
Restart fails with exit 1, because it kills the opened shell not the java process.

Reproduces how often:
Sometimes. Often in container environments.

Versions

All.

Service doesn't go up cause of lack of /run/jmx_exporter directory

Prerequisites

[x] Checked that your issue isn't already filled: https://github.com/issues?utf8=✓&q=is%3Aissue+user%3Aidealista
[x] Checked that there is not already provided the described functionality

Description

Service doesn't go up.

Steps to Reproduce

  1. deploy the role
  2. systemctl status jmx_exporter:
$ sudo systemctl status jmx_exporter
● jmx_exporter.service - prometheus jmx exporter
   Loaded: loaded (/etc/systemd/system/jmx_exporter.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Mon 2019-07-15 12:01:26 UTC; 2min 34s ago
  Process: 13059 ExecStartPost=/bin/sh -c echo $MAINPID > /run/jmx_exporter/jmx_exporter.pid (code=exited, status=0/SUCCESS)
  Process: 13058 ExecStart=/bin/sh -c /usr/bin/java $JAVA_OPTS $JAVA_MEM                        -cp /opt/jmx_exporter/jmx_exporter.jar io.prometheus.jmx.WebServ
 Main PID: 13058 (code=exited, status=127)

Jul 15 12:01:26 mymachine systemd[1]: Starting prometheus jmx exporter...
Jul 15 12:01:26 mymachine systemd[1]: jmx_exporter.service: Main process exited, code=exited, status=127/n/a
Jul 15 12:01:26 mymachine systemd[1]: jmx_exporter.service: PID 13058 read from file /run/jmx_exporter/jmx_exporter.pid does not exist or...
Jul 15 12:01:26 mymachine systemd[1]: Failed to start prometheus jmx exporter.
Jul 15 12:01:26 mymachine systemd[1]: jmx_exporter.service: Unit entered failed state.
Jul 15 12:01:26 mymachine systemd[1]: jmx_exporter.service: Failed with result 'exit-code'.

Expected behavior:

Service is up

Actual behavior:

Fails with error read from file /run/jmx_exporter/jmx_exporter.pid does not exist

Versions

master: 5d0cdf7

[BUG] Unable to install versions >= 0.17.0

Description

Versions > 0.17.0 has other artifact name and this role fails to install it.

Steps to Reproduce

  1. [First Step]
  2. [Second Step]
  3. [and so on...]

Expected behavior:
[What you expect to happen]

Actual behavior:
[What actually happens]

Reproduces how often:
[What percentage of the time does it reproduce?]

Environment

  • The release version/s you are using:
  • OS:
  • Others:

Additional Information

[Any additional information, configuration or data that might be necessary to reproduce the issue.]

Allow adding jar's to the jmx_exporter classpath

Prerequisites

Description

As is described here is necessary to add an external library called jboss-cli-client.jar to connect to JMX subsystem exposed by WildFly.

Actually is impossible to add an external library because the service is using "java -jar" instead of "java -cp" to launch the scrapper.

Versions

<= 1.4.0

Additional Information

Group variable is not used when skeleton paths are created

Prerequisites

Description

Skeleton paths group are using user variable name instead of group variable name

Expected behavior: Should use group name variable

Actual behavior: Uses user name variable

Reproduces how often: 100%

Versions

All

Additional Information

https://github.com/idealista/prometheus_jmx_exporter-role/blob/master/tasks/install.yml#L21

Include logging in service

Prerequisites

Description

Logging can be provided in the java service using the flag java.util.logging.config.file so it would be nice to support it. Also adding a default config file.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.