Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix munin_stats plugin when running munin-node only #30426

Merged
merged 2 commits into from Oct 21, 2017

Conversation

florianjacob
Copy link
Contributor

Motivation for this change

If you run munin-node without having munin-cron on the same machine, the automatically enabled munin_stats plugin which prints general statistics fails on every munin call (i.e. every 5 minutes):

munin-node: Error output from munin_stats:
munin-node: Error in tempfile() using template /var/run/munin/XXXXXXXXXX: Parent directory (/var/run/munin/) does not exist at /nix/store/dr4inq7f91d62mbr7qphhmxf8320i44r-munin-2.0.33/lib/perl5/site_perl/Munin/Plugin.pm line 280.
munin-node: Service 'munin_stats' exited with status 2/0.

Happens on 17.09 and master. This is because munin-node does not create the MUNIN_PLUGSTATE directory /var/run/munin. This is fixed with 95bb82d by using systemd.tmpfiles, would be nice to get this cherry-picked to 17.09. 086c0e6 converts munin-cron to systemd.tmpfiles as well, but that commit is not necessary to fix this issue (and not strictly necessary at all, of course. Is there a policy regarding mkdir+chown activationScripts vs. systemd.tmpfiles?)

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@bjornfor
Copy link
Contributor

Is there a policy regarding mkdir+chown activationScripts vs. systemd.tmpfiles?

Not that I know of.

@@ -193,6 +193,9 @@ in
};
};

# munin_stats plugin breaks as of 2.0.33 when this doesn't exist
systemd.tmpfiles.rules = [ "d /var/run/munin 0755 munin munin -" ];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps "serviceConfig.RuntimeDirectory=munin" is more appropriate here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was totally not aware of those serviceConfig options, they look great, thank you! 😃

Problem here would be though that /var/run/munin is not only used as your usual pid file folder, but also the plugin state is redirected from the default location of /var/lib/munin/plugin-state to /var/run/munin via the MUNIN_PLUGSTATE variable – the latter causing the actual problem with munin_stats plugin. It might not be good to clear the plugin state on every restart of the service. But I don't know why that's actually done.

The dual use traces back to the first commit of the service, @domenkozar, do you still know your reasons why you set MUNIN_PLUGSTATE to /var/run/munin?

@domenkozar domenkozar merged commit 43f94ff into NixOS:master Oct 21, 2017
@florianjacob florianjacob deleted the fix-munin_stats-plugin branch October 22, 2017 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants