Reputation: 6861
I recently installed munin on my (Fedora based) server. Now, I wanted to get all the graphs in a static directory (The application runs on Django). So, I edited the file \etc\munin\munin.conf
by setting the htmldir
as the absolute path to my static folder. Then, when I did a munin-cron
, I got the following error:
This program will easily break if you run it as root as you are
trying now. Please run it as user 'nobody'. The correct 'su' command
on many systems is 'su - munin --shell=/bin/bash'
Aborting.
So, I changed the user and tried running the same with munin as a user. I then got the following error:
[ERROR] Could not copy contents from /etc/munin/static/ to /[path to static
file] at /usr/share/perl5/vendor_perl/Munin/Master/HTMLOld.pm line 716.
I chown
-ed the static directory (recursively for the munin user) and even tried with chmod 777
(which actually one shouldn't do), so basically it doesn't seem to be a permission issue.
Also, my dev server is Ubuntu (12.04) based. It worked fine there. It worked fine even with my local machine running Ubuntu (14.04). Can this be an OS issue? That is highly unlikely it seems. What other thing could I be missing? Any help would be appreciated.
PS: There is one more catch. When I ran munin-cron
as root in my Ubuntu(s), the error it gave was:
This program will easily break if you run it as root as you are
trying now. Please run it as user 'munin'. The correct 'su' command
on many systems is 'su - munin --shell=/bin/bash'
Aborting.
whereas it was nobody
here. Can it be a configuration issue?
Upvotes: 2
Views: 1135
Reputation: 31
It could be that you do not have write permissions not not on the target directory but to the subdirectory "static" under it.
This would be fixed by running:
# chown -R munin:munin /var/www/html/munin/static/
Explanation below:
In my case the error was: Could not copy contents from /etc/munin/static/ to /var/www/html/munin at /usr/share/perl5/vendor_perl/Munin/Master/HTMLOld.pm line 795
, which is:
unless(dircopy($staticdir, "$htmldir/static")){
ERROR "[ERROR] Could not copy contents from $staticdir to $htmldir";
die "[ERROR] Could not copy contents from $staticdir to $htmldir";
}
And indeed that directory was incorrectly owned by root:
$ ls -l /var/www/html/munin
total 0
drwxr-xr-x 2 munin munin 51 Jun 25 13:44 cgi
drwxr-xr-x 2 root root 24 Jun 25 13:44 static
This happened with munin-2.0.75-1.el9.noarch on a RHEL9.
Upvotes: 1
Reputation: 316
I had same issue on CentOS 6.5. None possible permissions fixed this. So I had to run the cron under root's crontab behalf of munin user. Sounds crazy, but it works:
*/5 * * * * sudo -u munin crontab -e
Defaults requiretty
in /etc/sudoers
Upvotes: 0