Git Product home page Git Product logo

Comments (15)

Mastergalen avatar Mastergalen commented on August 17, 2024 2

I just upgraded from ansible 2.6.4 to 2.7.2 and ran the playbook again.

This time the prometheus service is enabled 👍

Always keep your dependencies up-to-date 😅

Thanks for your help!

from ansible-prometheus.

paulfantom avatar paulfantom commented on August 17, 2024

Could you check if /etc/prometheus/prometheus.yml exists and is readable by prometheus user. And also could you paste content of /etc/systemd/system/prometheus.service ?

from ansible-prometheus.

paulfantom avatar paulfantom commented on August 17, 2024

Also you cannot start prometheus just by running prometheus binary without flags, you need to start it with systemctl start prometheus

from ansible-prometheus.

Mastergalen avatar Mastergalen commented on August 17, 2024

prometheus.yml exists and is readable.

-rw-r-----   1 root       prometheus   465 Oct  3 15:51 prometheus.yml

/etc/systemd/system/prometheus.service

root@liffey:/etc/prometheus# cat /etc/systemd/system/prometheus.service
# Ansible managed
[Unit]
Description=Prometheus
After=network.target

[Service]
Type=simple
Environment="GOMAXPROCS=40"
User=prometheus
Group=prometheus
ExecReload=/bin/kill -HUP $MAINPID
ExecStart=/usr/local/bin/prometheus \
  --config.file=/etc/prometheus/prometheus.yml \
  --storage.tsdb.path=/var/lib/prometheus \
  --storage.tsdb.retention=30d \
  --web.console.libraries=/etc/prometheus/console_libraries \
  --web.console.templates=/etc/prometheus/consoles \
  --web.listen-address=0.0.0.0:9090 \
  --web.external-url=
PrivateTmp=true
PrivateDevices=true
ProtectHome=true
NoNewPrivileges=true
ReadWritePaths=/var/lib/prometheus
ProtectSystem=strict
ProtectControlGroups=true
ProtectKernelModules=true
ProtectKernelTunables=true


SyslogIdentifier=prometheus
Restart=always

[Install]
WantedBy=multi-user.target

from ansible-prometheus.

paulfantom avatar paulfantom commented on August 17, 2024

I don't see any issues with your config. Could you run:

systemctl start prometheus

And check its logs by using journalctl -f -u prometheus.service ?

from ansible-prometheus.

paulfantom avatar paulfantom commented on August 17, 2024

I can see though that prometheus service is disabled on your host. Which looks like a manual intervention or badly executed role since we are enabling that service in the last task:

- name: ensure prometheus service is started and enabled
become: true
systemd:
daemon_reload: true
name: prometheus
state: started
enabled: true
tags:
- prometheus_run

from ansible-prometheus.

Mastergalen avatar Mastergalen commented on August 17, 2024

I did re-run playbook again to ensure that the last task gets executed and I also didn't manually disable the service 🤔 .

from ansible-prometheus.

paulfantom avatar paulfantom commented on August 17, 2024

After running role you should have status "enabled" when checking prometheus service.
Now you had this:

galen@liffey:/$ systemctl status prometheus
prometheus.service - Prometheus
   Loaded: loaded (/etc/systemd/system/prometheus.service; disabled; vendor preset: enabled)
   Active: inactive (dead)

And important part is:

/etc/systemd/system/prometheus.service; disabled; vendor preset: enabled

Which should look more like:

/etc/systemd/system/prometheus.service; enabled; vendor preset: enabled

from ansible-prometheus.

Mastergalen avatar Mastergalen commented on August 17, 2024

I manually enabled the prometheus service with systemctl enable prometheus.

It does prompt for authentication though that forces you to choose an identity. Maybe this unusual prompt breaks the last ansible task?

galen@liffey:/$ systemctl enable prometheus
Synchronizing state of prometheus.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable prometheus
==== AUTHENTICATING FOR org.freedesktop.systemd1.reload-daemon ===
Authentication is required to reload the systemd state.
Multiple identities can be used for authentication:
1.  galen
2. <REDACTED>
...
<REDACTED>

from ansible-prometheus.

paulfantom avatar paulfantom commented on August 17, 2024

You need to do it as root. Prometheus is installed as a system service, not a user service.
Ansible uses become: true for similar purposes.

from ansible-prometheus.

Mastergalen avatar Mastergalen commented on August 17, 2024

Ah, I see thank you 😃

Well since the task ensure prometheus service is started and enabled does have become: true already, I'm not sure why running the role does not automatically enable the service then.

from ansible-prometheus.

paulfantom avatar paulfantom commented on August 17, 2024

Seems like this might be some sort of a bug in ansible systemd module. What OS are you using on your target system (where prometheus is installed)? And which ansible version?

from ansible-prometheus.

Mastergalen avatar Mastergalen commented on August 17, 2024
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.1 LTS"
NAME="Ubuntu"
VERSION="18.04.1 LTS (Bionic Beaver)"

from ansible-prometheus.

paulfantom avatar paulfantom commented on August 17, 2024

Seems like this might be the issue you are running into: ansible/ansible#39116

from ansible-prometheus.

lock avatar lock commented on August 17, 2024

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

from ansible-prometheus.

Related Issues (20)

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.