Hinweis: Der nachfolgende geschilderte Fehler wurde inzwischen durch einen RHEL-/CentOS-Patch behoben (util-linux-ng) – einfach das System updaten!
Wer Open Monitoring Distribution auf RHEL oder CentOS 6.4 einsetzen möchte, hat vermutlich das Problem, dass das Erstellen von Sites nicht wie gewohnt funktioniert:
# omd create test Adding /omd/sites/test/tmp to /etc/fstab. Creating temporary filesystem /omd/sites/test/tmp...mount: can't find /omd/sites/test/tmp in /etc/fstab or /etc/mtab ERROR
Auch das Starten der Site funktioniert nicht:
# omd start test Creating temporary filesystem /omd/sites/test/tmp...mount: can't find /omd/sites/test/tmp in /etc/fstab or /etc/mtab ERROR Starting dedicated Apache for site test...OK Starting rrdcached...OK Starting npcd...touch: cannot touch `/omd/sites/test/tmp/pnp4nagios/run/npcd.pid': No such file or directory chown: cannot access `/omd/sites/test/tmp/pnp4nagios/run/npcd.pid': No such file or directory An Error occured while reading your config on line 197 Message was: "Could not open pidfile '/omd/sites/test/tmp/pnp4nagios/run/npcd.pid': No such file or directory" OK /omd/sites/test/etc/rc.d/80-nagios: line 58: /omd/sites/test/tmp/nagios/nagios.cfg: No such file or directory Nagios configuration file /omd/sites/test/tmp/nagios/nagios.cfg not found. Terminating... Initializing Crontab...OK
Beim Recherchieren bin ich auf den folgenden Thread in der check_mk-Mailinglist gestoßen: http://comments.gmane.org/gmane.network.nagios.checkmk.german/1694.
Der Fehler wird anscheinend durch ein Update von RHEL / CentOS 6.4 verursacht: https://bugzilla.redhat.com/show_bug.cgi?id=917678.
Das OMD-Skript (/usr/bin/omd) erstellt für den /tmp-Verzeichnisbaum von Sites Ramdisks – in dieser werden dann temporäre Dateien und Pidfiles angelegt. Hierfür werden entsprechende Zeilen in der /etc/fstab des Servers angelegt – mit der Verwendung eines symbolischen Links für den Pfadnamen.
Mit dem letzten 6.4-Update dürfen in der /etc/fstab keine Namen mit symbolischen Links mehr verwendet werden. Ein nachträgliches Anpassen der entsprechenden Zeile in der Textdatei löst das Problem nicht, da beim Ausführen des omd create-Kommandos die Ramdisk auch eingehängt wird – aus diesem Grund stürzt auch das omd start-Kommando mit einem Fehler ab.
Das Problem lässt sich durch Anpassen der Zeile 747 des Skriptes /usr/bin/omd beheben – hier muss einfach ein /opt angefügt werden, damit kein symbolischer Link mehr verwendet wird:
file("/etc/fstab", "a+").write("tmpfs /opt%s tmpfs noauto,user,mode=755,uid=%s,gid=%s 0 0n" %
Ich habe dafür eine Patch-Datei erstellt, mit der man diese Änderung kinderleicht übernehmen kann: omd.patch
# wget http://blog.christian-stankowic.de/wp-content/uploads/2013/03/omd.patch_.txt # cd /usr/bin # cp omd omd.initial # patch < /PATH/omd.patch_.txt
Und schon funktioniert das Anlegen von OMD-Sites wieder:
# omd create test Adding /omd/sites/test/tmp to /etc/fstab. Creating temporary filesystem /omd/sites/test/tmp...OK Created new site test with version 0.56.
Auch der Start von Sites läuft nun ohne Probleme durch:
# omd start test Starting dedicated Apache for site test...OK Starting rrdcached...OK Starting npcd...OK Starting nagios...OK Initializing Crontab...OK
🙂
Hi, thanks for posting this fix, helped me a lot.
Many thanks for this, saved me quite a bit of time, wasn’t aware of the symlink changes for 6.4
Regards,
Matt
Hi Justin and Matt!
Thanks for your feedback – glad to hear that this helped.
Best regards,
Christian.
Hi,
thanks for good information and the patch you created… i have fixed omd error with the patch file.
Thanks
Laxman Singh
Thx 4 sharing this…
helped me fixing this issue ! Worked like a charm on centos 6.4 🙂
Hi Pat!
Thanks for your feedback! Glad to see that it helped you! 🙂
Best regards from Germany,
Christian.
Hi,
there is a bugfix on the way. I created a package/repo with the fix included, until Red Hat ships the fix.
http://jens.fedorapeople.org/rhel64-bz917678/
CU
Jens
Hi Jens,
thanks for the information! 🙂
Best regards,
Christian.
Hello Christian
many thanks for this. Its help me a lot.
Great.
Best regards
Jürgen
Hey Juergen,
thanks! Glad to hear that it helped you. 🙂
Best regards,
Christian.
Thanks for the help, but wouldn’t it be better to change the path in line 345?
def tmp_dir(sitename):
return „/opt/omd/sites/%s/tmp“ % sitename
That would change all references to the tmp path in the script.
Hi Twinkles!
Interesting – that might work, too. Have you tried it?
Best regards,
Christian.
Worked for me on 6.4… Many thanks.
Thanks for the feedback!
Best regards,
Christian.
Thanks so much for your help. It has helped me big time
Hey John,
glad to hear that I was able to help!
But – keep in mind, it should be fixed in newer versions so that this workaround is not required, anymore.
Best wishes!
check your mount binaries permissions.
ls -l /bin/mount
-rwsr-xr-x. 1 root root 77336 May 10 23:58 /bin/mount
Hey!
The behavior was forced by a bug in util-linux-ng – and was fixed in March 2013. Permissions were exactly the same you mentioned!
Best regards,
Christian