From 9eb3582e397f0a96e23a303f7e5d51b3b5bcac3d Mon Sep 17 00:00:00 2001 From: Julien Palard Date: Mon, 13 Feb 2023 10:49:21 +0100 Subject: [PATCH] Munin: Don't redraw graphs every 5mn, we don't look at them that often. --- munin.yml | 2 +- roles/munin_server/tasks/main.yml | 40 ++++++++++++++++++++++ roles/munin_server/templates/munin.conf.j2 | 8 +++-- 3 files changed, 46 insertions(+), 4 deletions(-) diff --git a/munin.yml b/munin.yml index 5becaba..e9677d9 100644 --- a/munin.yml +++ b/munin.yml @@ -29,7 +29,7 @@ location ^~ /munin-cgi/munin-cgi-graph/ { fastcgi_split_path_info ^(/munin-cgi/munin-cgi-graph)(.*); fastcgi_param PATH_INFO $fastcgi_path_info; - fastcgi_pass unix:/var/run/munin/fcgi-graph.sock; + fastcgi_pass unix:/run/munin/fcgi-graph.sock; include fastcgi_params; } } diff --git a/roles/munin_server/tasks/main.yml b/roles/munin_server/tasks/main.yml index cde2320..865797b 100644 --- a/roles/munin_server/tasks/main.yml +++ b/roles/munin_server/tasks/main.yml @@ -13,3 +13,43 @@ - name: Configure munin template: src=munin.conf.j2 dest=/etc/munin/munin.conf + +- name: Configure Munin FastCGI socket + copy: + dest: /etc/systemd/system/munin-graph.socket + owner: root + mode: 0644 + content: | + [Unit] + Description=Munin FastCGI Graph Socket + + [Socket] + ListenStream=/run/munin/fcgi-graph.sock + + [Install] + WantedBy=sockets.target + +- name: Configure Munin FastCGI service + copy: + dest: /etc/systemd/system/munin-graph.service + owner: root + mode: 0644 + content: | + [Unit] + Description=Munin FastCGI Graph + Requires=munin-graph.socket + + [Service] + User=munin + Group=munin + ExecStart=/usr/lib/munin/cgi/munin-cgi-graph + StandardInput=socket + StandardOutput=inherit + StandardError=journal + +- name: Enable Munin FastCGI socket + systemd: + name: "munin-graph.socket" + state: started + enabled: true + daemon_reload: true diff --git a/roles/munin_server/templates/munin.conf.j2 b/roles/munin_server/templates/munin.conf.j2 index 1e4eb3b..fb1feb2 100644 --- a/roles/munin_server/templates/munin.conf.j2 +++ b/roles/munin_server/templates/munin.conf.j2 @@ -7,9 +7,11 @@ contact.email.command mail -s "Munin-notification for ${var:group} :: ${var:host tmpldir /etc/munin/templates -graph_width 600 -graph_height 400 -max_graph_jobs 2 +# Munin graph +graph_strategy cgi + +# Munin update +fork no {% for host in groups["all"] %} [{{ hostvars[host]['inventory_hostname'] }}]