Git Product home page Git Product logo

ansible-role-windows_exporter's Introduction

CI

Ansible Role: Windows exporter

This role installs Prometheus' Windows exporter on Windows hosts.

Requirements

N/A

Role Variables

Available variables are listed below, along with default values (see defaults/main.yml):

windows_exporter_version: '0.18.1'

The version of Windows exporter to install. Available releases can be found on the tags listing in the Windows exporter repository. Drop the v off the tag.

If you change the version, the windows_exporter binary will be replaced with the updated version, and the service will be restarted.

windows_exporter_arch: 'amd64'
windows_exporter_download_url: https://github.com/prometheus-community/windows_exporter/releases/download/v{{ windows_exporter_version }}/windows_exporter-{{ windows_exporter_version }}-{{ windows_exporter_arch }}.msi


windows_exporter_bin_path: 'C:\Windows\temp\windows_exporter-{{ windows_exporter_version }}-{{ windows_exporter_arch }}.msi'

The path where the windows_exporter binary will be downloaded and installed from.

windows_exporter_listen_address: '0.0.0.0'
windows_exporter_listen_port: 9182
windows_exporter_textfile_dir: null

Commonly used service options.

windows_exporter_options: ''

Any additional options to pass to windows_exporter when it starts, e.g. --no-collector.wifi if you want to ignore any WiFi data. Need to use MSI Parameters as stated in https://github.com/prometheus-community/windows_exporter#installation

windows_exporter_state: started
windows_exporter_start_mode: delayed

Controls for the windows_exporter service. windows_exporter_start_mode controls the start_mode of the service. windows_exporter_state controls the state of the service on the host.

Dependencies

None.

Example Playbook

- hosts: all
  roles:
    - role: danielweeber.windows_exporter

License

MIT / BSD

Author Information

This role was created in 2021 by Daniel Weeber. Heavily inspired and forked from Jeff Geerling, author of Ansible for DevOps.

ansible-role-windows_exporter's People

Contributors

bluppfisk avatar brandonmcclure avatar chspnk avatar danielweeber avatar dweebertwt avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ansible-role-windows_exporter's Issues

Control the service start_mode

Currently when you change the windows_exporter_state default variable, there is no change on the target machine.
Also, the service gets created with an Automatic start, but I have issues with it not starting after a system reboots. I want to be able to control the start_mode as well.

The way that I implemented this, is I removed the windows_exporter_enabled variable, and use the existing windows_exporter_state and a new windows_exporter_start_mode variable that are used to directly control the win_service task. I added a conditional check for the win_uri task, because if I disabled my service through these variables, then I would not want to check for the web service, becuase I expect it to not be running.

check settings

Hey!

Great job on this role.

Just one question: what happens if you want to update the settings of an existing windows_exporter?

So for example I had

windows_exporter_options: 'ENABLED_COLLECTORS="os,service,system"'

but now I want perhaps

windows_exporter_options: 'ENABLED_COLLECTORS="os,service,process,system"'

(or change the port maybe, etc.??)

As with the current logic that would lead to
is exporter installed -> yes -> skip install (regardless of the settings)

  • is there a way maybe to check the settings of exporter, and if it is not in the desired state, reinstall it?
  • for the time being - since my company just tests exporter on a few machines - I just put a sloppy workaround in, to reinstall exporter if it finds it...but that is not feasible for production, as it would mean each Ansible-run reinstalls it...

windows_exporter_options does not affect the install

When you specify the windows_exporter_options parameter when using this role the installer does not respect it/change the installation.

Desired state

specifying the role in a playbook like:

- role: windows_exporter
      windows_exporter_version: '0.18.1'
      windows_exporter_options: 'ENABLED_COLLECTORS=cpu,cs,logical_disk,memory,net,os,textfile,iis TEXTFILE_DIR=D:\metrics'

results in a installation that has the specific collectors enables, and the textfile directory set to the user specified location.
The readme would need to be updated to specify that you should use the MSI parameters as defined in the prometheus windows_exporter documentation here: https://github.com/prometheus-community/windows_exporter#installation

Optional firewall config

Would it be possible to add a new confirmation item making firewall task optional?

In my case, firewall is off, and there is no need to execute firewall task here.

assert failed

Thank you for creating this great project.

By default, windows_exporter_state is started and windows_exporter_start_mode is delayed.

So the assertion will always fail. What is the assertion for?

windows_exporter_state != 'started' and windows_exporter_start_mode != 'disabled'

https://github.com/DanielWeeber/ansible-role-windows_exporter/pull/4/files#diff-3d0ff1709ca48add100327bb2a468e6c508fb92a159c64c4f99ad1df89d9bddeR2-R6

Error message:

    "assertion": "windows_exporter_state != 'started' and windows_exporter_start_mode != 'disabled'",
    "changed": false,
    "evaluated_to": false,
    "msg": "You cannot manage the service with the windows_exporter_state and windows_exporter_start_mode settings"

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.