[omd-devel] Create site in sylinked path fails - suggested fix

Mathias Kettner mk at mathias-kettner.de
Thu Jun 25 20:04:56 CEST 2015


You still are using symlinks. Just create single mount points for each site
below /opt/omd/sites. No symlinks.

> Am 25.06.2015 um 17:42 schrieb Oliver O'Boyle <ooboyle at atlific.com>:
> 
> Mathias,
> 
> Thanks for the info. I tried this and still get an error. The creation of the files and directories was incomplete and symlinks in the new site's directory are broken:
> 
> edpmgmt at 001-l-mon01:/omd/sites$ sudo omd init omd_001_01_01
> Traceback (most recent call last):
>  File "/usr/bin/omd", line 3528, in <module>
>    command_function(args, command_options)
>  File "/usr/bin/omd", line 2354, in main_init
>    init_site(apache_reload = "apache-reload" in options)
>  File "/usr/bin/omd", line 2373, in init_site
>    config_load_hooks()
>  File "/usr/bin/omd", line 1777, in config_load_hooks
>    for hookname in os.listdir(hook_dir):
> OSError: [Errno 2] No such file or directory: '/omd/sites/omd_001_01_01/lib/omd/hooks'
> 
> edpmgmt at 001-l-mon01:/omd/sites$ ls -la
> total 12
> drwxr-xr-x  3 root          root          4096 Jun 25 11:34 .
> drwxr-xr-x 25 omd_001_01_01 omd_001_01_01 4096 Jun 24 22:16 ..
> drwxr-xr-x  5 omd_001_01_01 omd_001_01_01 4096 Jun 25 11:35 omd_001_01_01
> 
> edpmgmt at 001-l-mon01:/omd/sites$ sudo omd init omd_001_01_01
> The site's home directory is not empty. Please add use
> 'omd --force init omd_001_01_01' if you want to erase all data.
> 
> edpmgmt at 001-l-mon01:/omd/sites$ sudo omd --force init omd_001_01_01
> Wiping the contents of /omd/sites/omd_001_01_01...OK
> Traceback (most recent call last):
>  File "/usr/bin/omd", line 3528, in <module>
>    command_function(args, command_options)
>  File "/usr/bin/omd", line 2354, in main_init
>    init_site(apache_reload = "apache-reload" in options)
>  File "/usr/bin/omd", line 2373, in init_site
>    config_load_hooks()
>  File "/usr/bin/omd", line 1777, in config_load_hooks
>    for hookname in os.listdir(hook_dir):
> OSError: [Errno 2] No such file or directory: '/omd/sites/omd_001_01_01/lib/omd/hooks'
> 
> Here's the mount point below the sites directory:
> edpmgmt at 001-l-mon01:/omd$ ls -la
> total 32
> drwxr-xr-x  5 root          root           4096 Jun 25 11:33 .
> drwxr-xr-x 25 omd_001_01_01 omd_001_01_01  4096 Jun 24 22:16 ..
> drwxr-xr-x  2 root          root           4096 Jun 25 11:31 apache
> drwx------  2 root          root          16384 Jun 15 21:59 lost+found
> lrwxrwxrwx  1 root          root              8 Jun 25 11:33 sites -> /omddata
> drwxr-xr-x  4 root          root           4096 Jun 24 22:01 versions
> 
> What am I doing wrong?
> 
> Oliver
> 
> 
> -----Original Message-----
> From: omd-devel-bounces at lists.mathias-kettner.de [mailto:omd-devel-bounces at lists.mathias-kettner.de] On Behalf Of Mathias Kettner
> Sent: June-25-15 11:14 AM
> To: OMD developers mailing list (english)
> Subject: Re: [omd-devel] Create site in sylinked path fails - suggested fix
> 
> Hi Oliver,
> 
> simply create mount points blow /omd/sites. Steps:
> 
> 1. omd create foo --no-init
> 
> # omd create --no-init foo
> Adding /opt/omd/sites/foo/tmp to /etc/fstab.
> Create new site foo in disabled state and with empty /omd/sites/foo.
> You can now mount a filesystem to /omd/sites/foo.
> Afterwards you can initialize the site with 'omd init'.
> 
> 2. Mount your filesystem there
> 
> 3. omd init foo
> 
> And you should be fine...
> 
> Am 25.06.2015 um 16:54 schrieb Oliver O'Boyle:
>> Hi Mathias,
>> 
>> Thanks for the reply. I understand the concern. Is there an alternative way to create sites on different disk volumes? It would help improve a number of areas, including performance of individual sites and some management tasks.
>> 
>> I've been keeping a very close eye on the installation that I did. It's not a production site but I do have live data coming into it from a variety of host types. I'm not seeing any issues at all. The status info is getting updated as expected, all graphs are showing correct data, I'm not seeing any errors in logs or elsewhere. It really looks and feels very stable.
>> 
>> Also, I installed check_mk RAW 1.2.6p5 on top of OMD yesterday, restored all data from the 1.2.4p5 OMD site into it, and it continue to work flawlessly.
>> 
>> I'd be happy to run any tests you want or provide you any information you need. I'd even be happy to run any additional beta or alpha code if that would help you feel more comfortable.
>> 
>> Oliver
>> 
>> -----Original Message-----
>> From: omd-devel-bounces at lists.mathias-kettner.de 
>> [mailto:omd-devel-bounces at lists.mathias-kettner.de] On Behalf Of 
>> Mathias Kettner
>> Sent: June-24-15 3:37 AM
>> To: OMD developers mailing list (english)
>> Subject: Re: [omd-devel] Create site in sylinked path fails - 
>> suggested fix
>> 
>> Hi Oliver,
>> 
>> some tools are *very* picky about the difference between symlinks and physical paths. Some of them are "mount" and the "rrdcached".
>> They do symlink resolution and convert things to absolute paths sometimes and *then* compare with configuration values.
>> 
>> So I personally really cannot forsee into which kinds of trouble these and other tools can run if we change it that way. So I'm a bit frightened to be honest and would rather not apply your patch....
>> 
>> Mathias
>> 
>> 
>> 
>> Am 23.06.2015 um 17:24 schrieb Oliver O'Boyle:
>>> Hello,
>>> 
>>> I recently tried to create an OMD site in a previously symlinked path.
>>> The procedure failed due to broken symlinks. The broken symlinks 
>>> occur because the relative path of '../../versions/<OMD_VERSION>' is 
>>> used during the creation process. The create_version_symlink function 
>>> in /usr/bin/omd can be changed to use the /omd/versions path instead, as such:
>>> 
>>> ORIGINAL:
>>> 
>>> def create_version_symlink(sitename, version):
>>> 
>>>      linkname = site_dir(sitename) + "/version"
>>> 
>>>      if os.path.exists(linkname):
>>> 
>>>          os.remove(linkname)
>>> 
>>>      os.symlink("../../versions/%s" % OMD_VERSION, linkname)
>>> 
>>> LINE 415 CHANGED TO:
>>> 
>>> def create_version_symlink(sitename, version):
>>> 
>>>      linkname = site_dir(sitename) + "/version"
>>> 
>>>      if os.path.exists(linkname):
>>> 
>>>          os.remove(linkname)
>>> 
>>>      os.symlink("/omd/versions/%s" % OMD_VERSION, linkname)   <--line 415
>>> 
>>> I've made this change and tested the creation of new sites. It seems 
>>> to work flawlessly.
>>> 
>>> Is it possible to make this change (or something similar that allows 
>>> for sites to be created in a symlinked path) to the distribution?
>>> 
>>> Regards,
>>> 
>>> Oliver
>>> 
>>> *_________________________________*
>>> 
>>> *Oliver O'Boyle*
>>> 
>>> Director, IT . *Atlific Hotels*
>>> 
>>> 250 Saint-Antoine W., Suite 400 Montreal, Quebec H2Y 0A3
>>> 
>>> T: 514.509.5545   C: 514.608.8533   F: 514.509.5498
>>> 
>>> *ooboyle at atlific.com <mailto:ooboyle at atlific.com>**www.atlific.com*
>>> <http://www.atlific.com/>
>>> 
>>> *_________________________________*
>>> 
>>> 
>>> 
>>> _______________________________________________
>>> omd-devel mailing list
>>> omd-devel at lists.mathias-kettner.de
>>> http://lists.mathias-kettner.de/mailman/listinfo/omd-devel
>>> 
>> 
>> --
>> We'll meet in Munich for the 2nd Check_MK Conference!
>> Book your place now and be part of it.
>> October 18th-20th, 2015
>> http://mathias-kettner.de/conference
>> 
>> 
>> Wir treffen uns zur 2. Check_MK-Konferenz in München!
>> Rechtzeitig buchen und dabei sein!
>> 18.-20. Oktober 2015
>> http://mathias-kettner.de/conference
>> 
>> 
>> Mathias Kettner GmbH
>> Kellerstraße 29, 81667 München, Germany
>> Registergericht: Amtsgericht München,  HRB 165902
>> Geschäftsführer: Mathias Kettner
>> http://mathias-kettner.de
>> Tel. +49 89 1890 435-0
>> Fax. +49 89 1890 435-29
>> _______________________________________________
>> omd-devel mailing list
>> omd-devel at lists.mathias-kettner.de
>> http://lists.mathias-kettner.de/mailman/listinfo/omd-devel
>> _______________________________________________
>> omd-devel mailing list
>> omd-devel at lists.mathias-kettner.de
>> http://lists.mathias-kettner.de/mailman/listinfo/omd-devel
>> 
> 
> --
> We'll meet in Munich for the 2nd Check_MK Conference!
> Book your place now and be part of it.
> October 18th-20th, 2015
> http://mathias-kettner.de/conference
> 
> 
> Wir treffen uns zur 2. Check_MK-Konferenz in München!
> Rechtzeitig buchen und dabei sein!
> 18.-20. Oktober 2015
> http://mathias-kettner.de/conference
> 
> 
> Mathias Kettner GmbH
> Kellerstraße 29, 81667 München, Germany
> Registergericht: Amtsgericht München,  HRB 165902
> Geschäftsführer: Mathias Kettner
> http://mathias-kettner.de
> Tel. +49 89 1890 435-0
> Fax. +49 89 1890 435-29
> _______________________________________________
> omd-devel mailing list
> omd-devel at lists.mathias-kettner.de
> http://lists.mathias-kettner.de/mailman/listinfo/omd-devel
> _______________________________________________
> omd-devel mailing list
> omd-devel at lists.mathias-kettner.de
> http://lists.mathias-kettner.de/mailman/listinfo/omd-devel



More information about the omd-devel mailing list