Giter Site home page Giter Site logo

ansible-prometheus-node-exporter's People

Contributors

akosveres avatar clickfreak avatar erichorne avatar florentflament avatar gaizeror avatar hwmrocker avatar lusitaniae avatar mad-ady avatar maximshepelev avatar namnh6893 avatar naseemkullah avatar sispheor avatar svslogiva avatar tokozedg avatar undergreen avatar vmartsynovskyy-sauce avatar

Stargazers

 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ansible-prometheus-node-exporter's Issues

Commits not in galaxy, node-exporter fails to start.

I freely admit that I know nothing of how galaxy works, but:

When I include this role via galaxy, or download it with ansible-galaxy install undergreen.prometheus-node-exporter, what I get in templates/init/prometheus-node-exporter.conf.j2 is:

[ec2-user@ip-172-31-76-131 init]$ cat prometheus-node-exporter.conf.j2
description "Prometheus Node Exporter"
start on (local-filesystems and net-device-up IFACE!=lo)
stop on runlevel [016]

respawn
{% if upstart_version.stdout | replace("init (upstart ", "") |replace(")","") | version_compare('1.4', '>=') %}
setuid {{ prometheus_exporters_common_user }}
setgid {{ prometheus_exporters_common_group }}
{% endif %}

script
exec >> "{{ prometheus_exporters_common_log_dir }}/node-exporter.log"
exec 2>&1
exec {{ prometheus_exporters_common_root_dir }}/node_exporter_current/node_exporter {% for prometheus_node_exporter_collector in prometheus_node_exporter_enabled_collectors %}--collector.{{ prometheus_node_exporter_collector }} {% endfor %} {% for flag, flag_value in prometheus_node_exporter_config_flags.items() %}--{{ flag }}={{ flag_value }} {% endfor %}

end script
[ec2-user@ip-172-31-76-131 init]$

Which says that the version galaxy has does not include commit bc21fe2.

As a result, if i include this role via galaxy, node-exporter does not start on Amazon Linux.

Source '/opt/prometheus/exporters/dist/node_exporter-0.12.0.linux-amd64.tar.gz' does not exist

I've just started to run the playbook in a machine with Ubuntu 16.04 and I get this error:

Source '/opt/prometheus/exporters/dist/node_exporter-0.12.0.linux-amd64.tar.gz' does not exist

Looking at the code, the problem seems to derive from the previous task, get_url, which doesn't specify the file name.
debug information:

ok: [localhost] => {
    "changed": false, 
    "checksum_dest": "aea15b3d58b63527b164c9364005466b930b60a9", 
    "checksum_src": "aea15b3d58b63527b164c9364005466b930b60a9", 
    "dest": "/opt/prometheus/exporters/dist/be2fd42c-1320-11e6-8908-0b2ae94647e9", 
    "gid": 0, 
    "group": "root", 
    "invocation": {
        "module_args": {
            "attributes": null, 
            "backup": null, 
            "checksum": "", 
            "client_cert": null, 
            "client_key": null, 
            "content": null, 
            "delimiter": null, 
            "dest": "/opt/prometheus/exporters/dist", 
            "directory_mode": null, 
            "follow": false, 
            "force": false, 
            "force_basic_auth": false, 
            "group": null, 
            "headers": null, 
            "http_agent": "ansible-httpget", 
            "mode": null, 
            "owner": null, 
            "path": "/opt/prometheus/exporters/dist/be2fd42c-1320-11e6-8908-0b2ae94647e9", 
            "regexp": null, 
            "remote_src": null, 
            "selevel": null, 
            "serole": null, 
            "setype": null, 
            "seuser": null, 
            "sha256sum": "", 
            "src": null, 
            "timeout": 10, 
            "tmp_dest": null, 
            "unsafe_writes": null, 
            "url": "https://github.com/prometheus/node_exporter/releases/download/0.12.0/node_exporter-0.12.0.linux-amd64.tar.gz", 
            "url_password": null, 
            "url_username": null, 
            "use_proxy": true, 
            "validate_certs": true
        }
    }, 
    "md5sum": "efe49b6fae4b1a5cb75b24a60a35e1fc", 
    "mode": "0644", 
    "msg": "OK (4021604 bytes)", 
    "owner": "root", 
    "size": 4021604, 
    "src": "/tmp/tmpmwjqus9l", 
    "state": "file", 
    "status_code": 200, 
    "uid": 0, 
    "url": "https://github.com/prometheus/node_exporter/releases/download/0.12.0/node_exporter-0.12.0.linux-amd64.tar.gz"
}

fatal: [localhost]: FAILED! => {
    "changed": false, 
    "failed": true, 
    "invocation": {
        "module_args": {
            "attributes": null, 
            "backup": null, 
            "content": null, 
            "creates": "/opt/prometheus/exporters/dist/node_exporter-0.12.0.linux-amd64/node_exporter", 
            "delimiter": null, 
            "dest": "/opt/prometheus/exporters/dist", 
            "directory_mode": null, 
            "exclude": [], 
            "extra_opts": [], 
            "follow": false, 
            "force": null, 
            "group": null, 
            "keep_newer": false, 
            "list_files": false, 
            "mode": null, 
            "original_basename": "node_exporter-0.12.0.linux-amd64.tar.gz", 
            "owner": null, 
            "regexp": null, 
            "remote_src": true, 
            "selevel": null, 
            "serole": null, 
            "setype": null, 
            "seuser": null, 
            "src": "/opt/prometheus/exporters/dist/node_exporter-0.12.0.linux-amd64.tar.gz", 
            "unsafe_writes": null, 
            "validate_certs": true
        }
    }, 
    "msg": "Source '/opt/prometheus/exporters/dist/node_exporter-0.12.0.linux-amd64.tar.gz' does not exist"
}

I can make a PR with a change to the get_url task to specify the file name.

role creates an empty directory in the ansible user's home

After deploying the Prometheus node exporter using this role, an empty directory (node_exporter-0.17.0.linux-amd64 in my case) is left in the home directory of the user used by ansible.
This directory shouldn't actually be created.

"AnsibleUndefinedVariable: 'dict object' has no attribute 'iteritems'

Hi,

Im receiving this random issue after upgrading. Any idea?

TASK [UnderGreen.prometheus-node-exporter : create systemd service unit] *******
Thursday 23 March 2017  16:58:03 +1300 (0:00:00.286)       0:01:10.353 ********
fatal: [images-worker]: FAILED! => {"changed": false, "failed": true, "msg": "AnsibleUndefinedVariable: 'dict object' has no attribute 'iteritems'"}

prometheus-node-exporter does not start on ubuntu 14.04

i changed the init file to the following. then it started again.

`description "Prometheus Node Exporter"
start on runlevel [2345]

respawn
setuid prometheus
setgid prometheus

script
exec >> "/var/log/prometheus/node-exporter.log"
exec 2>&1
exec /opt/prometheus/exporters/node_exporter_current/node_exporter --collector.conntrack --collector.cpu --collector.diskstats --collector.entropy --collector.filefd --collector.filesystem --collector.loadavg --collector.meminfo --collector.netdev --collector.netstat --collector.stat --collector.textfile --collector.time --collector.vmstat --collector.textfile.directory=/var/log/prometheus/textfile_collector --web.listen-address=0.0.0.0:9100 --log.level=info
end script
`

Support sysvinit service

Actually the role support systemd & upstart service

it's will be good if it's also support the "old" sysvinit

Handler name is very generic

The service reenable handler is super generic. I ran into a conflict with another role, which arguably shouldn't be using that name either.

node_exporter user is root

templates/etc/systemd/system/prometheus-node-exporter.service.j2

...
User=root
Group={{ prometheus_exporters_common_group }}
...

was that deliberate or just an oversight?

i tried it with

User={{ prometheus_exporters_common_user }}
Group={{ prometheus_exporters_common_group }}

and, so far, it works fine.

url of prometheus/node_exporter change with version

directory of URL have change for all version >= 0.13.0 :
2 example :

https://github.com/prometheus/node_exporter/releases/download/v0.14.0/node_exporter-0.14.0.linux-amd64.tar.gz
https://github.com/prometheus/node_exporter/releases/download/0.12.0/node_exporter-0.12.0.linux-amd64.tar.gz

Version comparison logic used for downloading node exporter binary fails on Ansible 2.9

The download task fails with this error:

TASK [UnderGreen.prometheus-node-exporter : download prometheus node exporter binary] *********************************************************************** task path: /home/ansible/roles/UnderGreen.prometheus-node-exporter/tasks/main.yml:3 fatal: [server]: FAILED! => { "msg": "An unhandled exception occurred while templating '{% if prometheus_node_exporter_version | version_compare('0.13.0', '>=') %}https://github.com/prometheus/node_exporter/releases/download/v{{ prometheus_node_exporter_version }}/{{ prometheus_node_exporter_release_name }}.tar.gz{% else %}https://github.com/prometheus/node_exporter/releases/download/{{ prometheus_node_exporter_version }}/{{ prometheus_node_exporter_release_name }}.tar.gz{% endif %}'. Error was a <class 'ansible.errors.AnsibleError'>, original message: template error while templating string: no filter named 'version_compare'. String: {% if prometheus_node_exporter_version | version_compare('0.13.0', '>=') %}https://github.com/prometheus/node_exporter/releases/download/v{{ prometheus_node_exporter_version }}/{{ prometheus_node_exporter_release_name }}.tar.gz{% else %}https://github.com/prometheus/node_exporter/releases/download/{{ prometheus_node_exporter_version }}/{{ prometheus_node_exporter_release_name }}.tar.gz{% endif %}" }

Seems like version_compare filter has been deprecated in Ansible 2.9

No support for deploying the value of "web.config"

Recent versions support this feature:

      --web.config=""            [EXPERIMENTAL] Path to config yaml file that
                                 can enable TLS or authentication.

While it's possible to use this role to configure that option, the value for it is a path, which also needs to be there.
It can be added manually, but that has to happen earlier. And if you want that config to be in the prometheus directory, you'd have to duplicate the directory creation logic.
I guess an optional task could be added to allow templating this file.

Exclude metric gathering

Hi!
Is there any way to exclude gathering some metric from specific group?
For example use collector cpu, but not collecting one of its metrics.

FAILED! => {"changed": false, "msg": "AnsibleUndefinedVariable: 'dict object' has no attribute 'stdout'"}

when i run ansible with a script it will return the following error: FAILED! => {"changed": false, "msg": "AnsibleUndefinedVariable: 'dict object' has no attribute 'stdout'"}

i think its issue is further described here:
https://www.middlewareinventory.com/blog/ansible-dict-object-has-no-attribute-stdout-or-stderr-how-to-resolve/

we fixed it the following way:

  • when: service_mgr | default(ansible_service_mgr) == 'upstart'
  • when: service_mgr | default(ansible_service_mgr) == 'upstart' and not ansible_check_mode

/etc/init/prometheus-node-exporter.conf depends on the output of a variable which is set in a previous task. But, in --check mode (dry run) this command is never executed and that rendering of this template fails. So, the fix is here to do not process this template when running in ansible_check_mode.

but maby you would like to fix it another way.

restart node exporter : failed when ansible_service_mgr: upstart

With service manager upstart it fail to start the service via the handler :

RUNNING HANDLER [UnderGreen.prometheus-node-exporter : restart node exporter] ***********************************************
fatal: [XXXXX]: FAILED! => {"changed": false, "failed": true, "msg": "stop: Unknown job: prometheus-node-exporter\nstart: Unknown job: prometheus-node-exporter\n"}

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.