[Check_mk (english)] OMD Web Site Question

I’m looking for some details about the difference between ~ /share/check_mk/web/htdocs and ~/local/share/check_mk/web/htdocs (assuming su into the site user already for those paths).

At first thought I was under the assumption that I could add a “custom web” page in this location (using python). However when accessing this it just outputs the contents of the file when viewing in a web browser.

So when looking into ~/etc/apache/conf.d/check_mk.conf I see why

The directory section of the configuration is missing the AddHandler mod_python .py and PythonHander options.

I did a quick test, and I can modify the apache configuration here and make it work and do what I want by adding the above to the section for the local shared location; however, does this break something in system by doing that? Is there a better place or option?

Now the problem statement, we have a need to create a custom action that will perform some “outside of checkmk” functions based on an alarm in CheckMK, and we do need to navigate to a custom page to accomplish this, and as of right now this is the only way I thought it could be done, but out of the box it was not what I expect.

Comments?

Thanks,

Jeff Gerschkow

Jeff,

The basic difference between “~/share” and “~/local/share” is that that the former is owned by the omd application and contains all the standard stuff that comes with the OMD installation. When you create a “site” it uses
the stuff from ~/share as defaults. It also builds a similar (but empty) structure under ~/local/share for the site’s personal use.

As a “for instance”, you wish to create a new check so you wander around until you find the checks (in /share/check_mk/checks) and decide to just make a copy of one of the present checks by just copying it to a new name
and changing the guts of it a bit. However, when you go to copy it will not allow you to because the directory is owned by the OS. If you copied the file from ~/share/check_mk/checks/filename over to ~/local/share/check_mk/checks/new-filename then you would
be able to edit it and it would run as the new check.

What is the importance of this ….? Well, the next time you install an updated OMD installation the system will have both the new and old versions installed. YOUR site will continue to use the old stuff until you run the
“omd update” command on your site. When you do, OMD will go in and modify a bunch of pointers to link your site into the new version of OMD. The new version of OMD may have hundreds of new checks but chances are it does not have the new check you created
or, for that matter, any other modifications you did to the system. However, if the modifications you did were done under the ~/local directory then they will stick with your site no matter what version you upgrade to.

I’m not sure why the “AddHandler mod_python .py” section is not in your apache settings. Possibly an oversight on the OMD design people. The good news is …… the ~/etc directory and everything in it is considered “local”
or owned by the site. I do not think anything in here is modified during an upgrade. (psst! I’ve been wrong before!) So you should be able to make the changes to the apache configs to add python web page capability to your ~/local/share/check_mk/web/htdocs”
directory.

Hope this helps. There is a lot of fun to be had playing in the “~/local/share/check_mk” folder. Try this at the command console: “cmk –P find”. It will show you all the stuff under ~/local/ that is not normally there.
(i.e. your new webpage) Further playing with the “cmk –P” command allows you to save the new stuff for transfer/import into other OMD sites.

···

Ken Smith

From: checkmk-en checkmk-en-bounces@lists.mathias-kettner.de on behalf of “Jeffrey J. Gerschkow” jgerschk@capusa.com
Date: Thursday, March 15, 2018 at 2:47 PM
To:checkmk-en@lists.mathias-kettner.decheckmk-en@lists.mathias-kettner.de
Subject: [Check_mk (english)] OMD Web Site Question

I’m looking for some details about the difference between ~ /share/check_mk/web/htdocs and ~/local/share/check_mk/web/htdocs (assuming su into the site user already for those paths).

At first thought I was under the assumption that I could add a “custom web” page in this location (using python). However when accessing this it just outputs the contents of the file when viewing in a web browser.

So when looking into ~/etc/apache/conf.d/check_mk.conf I see why

The directory section of the configuration is missing the AddHandler mod_python .py and PythonHander options.

I did a quick test, and I can modify the apache configuration here and make it work and do what I want by adding the above to the section for the local shared location; however, does this break something in system by doing that?
Is there a better place or option?

Now the problem statement, we have a need to create a custom action that will perform some “outside of checkmk” functions based on an alarm in CheckMK, and we do need to navigate to a custom page to accomplish this, and as of right now
this is the only way I thought it could be done, but out of the box it was not what I expect.

Comments?

Thanks,

Jeff Gerschkow

Ken:

Thank you for the very detailed explanation.

I am actually familiar with the usage of ~/local/share/check_mk/checks as I have written custom checks for our monitoring site.

The confusion comes as the behavior of what I had hopped with ~/local/share/check_mk/web/htdocs did not work as expected.

The section of ~/etc/apache/conf.d/check_mk.conf

Alias /[site]/check_mk/local /omd/sites/[site]/local/share/check_mk/web/htdocs

<Directory /omd/sites/[site]/local/share/check_mk/web/htdocs>

Order deny,allow

allow from all

Alias /[site]/check_mk /omd/sites/[site]/share/check_mk/web/htdocs

<Directory /omd/sites/[site]/share/check_mk/web/htdocs>

AddHandler mod_python .py

PythonHandler index

PythonOption mod_python.importer.path “[’/omd/sites/[site]/local/share/check_mk/web/htdocs’, ‘/omd/sites/[site]/share/check_mk/web/htdocs’]”

DirectoryIndex index.py

Just to clarify, the AddHandler is present there in, but only for the “share” code. So nothing in the “local” ever is allowed to execute.

I did try and add the AddHander, PythonHandler to the “local” site and it does then allow the page to run. Can someone confirm if this is needed, should be present for the “local” alias?

I have also looked at the code, and there is a function in modules.py that loads the plugins (from what seems to be the web locations), then it allows for the creation of the pagehandlers, and within the index.py for the given page it calls get_handler, and should then execute the page by calling handler(); however, this is where it seems to all break down (could be my lack of understanding of the design), but I can’t seem to get the new page to act the right way and have a “page handler” to be called from index.py as it should be.

The section of code that is of interest is this….yet I have not figured out that working….I could not find anything specific in pagetypes.py that would lead to an explination. (again could be my lack of knowledge here).

Install page handlers created by the pagetypes.py modules. It is allowed for all

kind of plugins to register own page types, so we need to wait after all plugins

have been loaded to update the pagehandlers

pagehandlers.update(pagetypes.page_handlers())

I look into those commands you listed.

Again, thank you for the help and detailed explanation.

Regards,

Jeff Gerschkow

···

From: Ken Smith [mailto:smithk190@macewan.ca]
Sent: Tuesday, March 20, 2018 1:03 PM
To: Jeffrey J. Gerschkow jgerschk@capusa.com; checkmk-en@lists.mathias-kettner.de
Subject: Re: [Check_mk (english)] OMD Web Site Question

Jeff,

The basic difference between “~/share” and “~/local/share” is that that the former is owned by the omd application and contains all the standard stuff that comes with the OMD installation. When you create a “site” it uses the stuff from ~/share as defaults. It also builds a similar (but empty) structure under ~/local/share for the site’s personal use.

As a “for instance”, you wish to create a new check so you wander around until you find the checks (in /share/check_mk/checks) and decide to just make a copy of one of the present checks by just copying it to a new name and changing the guts of it a bit. However, when you go to copy it will not allow you to because the directory is owned by the OS. If you copied the file from ~/share/check_mk/checks/filename over to ~/local/share/check_mk/checks/new-filename then you would be able to edit it and it would run as the new check.

What is the importance of this ….? Well, the next time you install an updated OMD installation the system will have both the new and old versions installed. YOUR site will continue to use the old stuff until you run the “omd update” command on your site. When you do, OMD will go in and modify a bunch of pointers to link your site into the new version of OMD. The new version of OMD may have hundreds of new checks but chances are it does not have the new check you created or, for that matter, any other modifications you did to the system. However, if the modifications you did were done under the ~/local directory then they will stick with your site no matter what version you upgrade to.

I’m not sure why the “AddHandler mod_python .py” section is not in your apache settings. Possibly an oversight on the OMD design people. The good news is …… the ~/etc directory and everything in it is considered “local” or owned by the site. I do not think anything in here is modified during an upgrade. (psst! I’ve been wrong before!) So you should be able to make the changes to the apache configs to add python web page capability to your ~/local/share/check_mk/web/htdocs” directory.

Hope this helps. There is a lot of fun to be had playing in the “~/local/share/check_mk” folder. Try this at the command console: “cmk –P find”. It will show you all the stuff under ~/local/ that is not normally there. (i.e. your new webpage) Further playing with the “cmk –P” command allows you to save the new stuff for transfer/import into other OMD sites.

Ken Smith

From: checkmk-en checkmk-en-bounces@lists.mathias-kettner.de on behalf of “Jeffrey J. Gerschkow” jgerschk@capusa.com
Date: Thursday, March 15, 2018 at 2:47 PM
To:checkmk-en@lists.mathias-kettner.decheckmk-en@lists.mathias-kettner.de
Subject: [Check_mk (english)] OMD Web Site Question

I’m looking for some details about the difference between ~ /share/check_mk/web/htdocs and ~/local/share/check_mk/web/htdocs (assuming su into the site user already for those paths).

At first thought I was under the assumption that I could add a “custom web” page in this location (using python). However when accessing this it just outputs the contents of the file when viewing in a web browser.

So when looking into ~/etc/apache/conf.d/check_mk.conf I see why

The directory section of the configuration is missing the AddHandler mod_python .py and PythonHander options.

I did a quick test, and I can modify the apache configuration here and make it work and do what I want by adding the above to the section for the local shared location; however, does this break something in system by doing that? Is there a better place or option?

Now the problem statement, we have a need to create a custom action that will perform some “outside of checkmk” functions based on an alarm in CheckMK, and we do need to navigate to a custom page to accomplish this, and as of right now this is the only way I thought it could be done, but out of the box it was not what I expect.

Comments?

Thanks,

Jeff Gerschkow

Hi Jeff,

i think you don’t break anything with this modification.

At the update time it can only happen that the update script will copy a new version of your modified configuration beside your file.

The other point is that normally there is no complete own web page inside the local folder structure.

Only components loaded with the normal code inside “/share/”.

With the page handlers I cannot help as had no time and use case until now :slight_smile:

best regards

Andreas

···

Jeffrey J. Gerschkow jgerschk@capusa.com schrieb am Di., 20. März 2018 um 19:28 Uhr: > Ken:

Thank you for the very detailed explanation.

I am actually familiar with the usage of ~/local/share/check_mk/checks as I have written custom checks for our monitoring site.

The confusion comes as the behavior of what I had hopped with ~/local/share/check_mk/web/htdocs did not work as expected.

The section of ~/etc/apache/conf.d/check_mk.conf

Alias /[site]/check_mk/local /omd/sites/[site]/local/share/check_mk/web/htdocs

<Directory /omd/sites/[site]/local/share/check_mk/web/htdocs>

Order deny,allow

allow from all

Alias /[site]/check_mk /omd/sites/[site]/share/check_mk/web/htdocs

<Directory /omd/sites/[site]/share/check_mk/web/htdocs>

AddHandler mod_python .py

PythonHandler index

PythonOption mod_python.importer.path “[‘/omd/sites/[site]/local/share/check_mk/web/htdocs’, ‘/omd/sites/[site]/share/check_mk/web/htdocs’]”

DirectoryIndex index.py

Just to clarify, the AddHandler is present there in, but only for the “share” code. So nothing in the “local” ever is allowed to execute.

I did try and add the AddHander, PythonHandler to the “local” site and it does then allow the page to run. Can someone confirm if this is needed, should be present for the “local” alias?

I have also looked at the code, and there is a function in modules.py that loads the plugins (from what seems to be the web locations), then it allows for the creation of the pagehandlers, and within the index.py for the given page it calls get_handler, and should then execute the page by calling handler(); however, this is where it seems to all break down (could be my lack of understanding of the design), but I can’t seem to get the new page to act the right way and have a “page handler” to be called from index.py as it should be.

The section of code that is of interest is this….yet I have not figured out that working….I could not find anything specific in pagetypes.py that would lead to an explination. (again could be my lack of knowledge here).

Install page handlers created by the pagetypes.py modules. It is allowed for all

kind of plugins to register own page types, so we need to wait after all plugins

have been loaded to update the pagehandlers

pagehandlers.update(pagetypes.page_handlers())

I look into those commands you listed.

Again, thank you for the help and detailed explanation.

Regards,

Jeff Gerschkow

From: Ken Smith [mailto:smithk190@macewan.ca]
Sent: Tuesday, March 20, 2018 1:03 PM
To: Jeffrey J. Gerschkow jgerschk@capusa.com; checkmk-en@lists.mathias-kettner.de
Subject: Re: [Check_mk (english)] OMD Web Site Question

Jeff,

The basic difference between “~/share” and “~/local/share” is that that the former is owned by the omd application and contains all the standard stuff that comes with the OMD installation. When you create a “site” it uses the stuff from ~/share as defaults. It also builds a similar (but empty) structure under ~/local/share for the site’s personal use.

As a “for instance”, you wish to create a new check so you wander around until you find the checks (in /share/check_mk/checks) and decide to just make a copy of one of the present checks by just copying it to a new name and changing the guts of it a bit. However, when you go to copy it will not allow you to because the directory is owned by the OS. If you copied the file from ~/share/check_mk/checks/filename over to ~/local/share/check_mk/checks/new-filename then you would be able to edit it and it would run as the new check.

What is the importance of this ….? Well, the next time you install an updated OMD installation the system will have both the new and old versions installed. YOUR site will continue to use the old stuff until you run the “omd update” command on your site. When you do, OMD will go in and modify a bunch of pointers to link your site into the new version of OMD. The new version of OMD may have hundreds of new checks but chances are it does not have the new check you created or, for that matter, any other modifications you did to the system. However, if the modifications you did were done under the ~/local directory then they will stick with your site no matter what version you upgrade to.

I’m not sure why the “AddHandler mod_python .py” section is not in your apache settings. Possibly an oversight on the OMD design people. The good news is …… the ~/etc directory and everything in it is considered “local” or owned by the site. I do not think anything in here is modified during an upgrade. (psst! I’ve been wrong before!) So you should be able to make the changes to the apache configs to add python web page capability to your ~/local/share/check_mk/web/htdocs” directory.

Hope this helps. There is a lot of fun to be had playing in the “~/local/share/check_mk” folder. Try this at the command console: “cmk –P find”. It will show you all the stuff under ~/local/ that is not normally there. (i.e. your new webpage) Further playing with the “cmk –P” command allows you to save the new stuff for transfer/import into other OMD sites.

Ken Smith

From: checkmk-en checkmk-en-bounces@lists.mathias-kettner.de on behalf of “Jeffrey J. Gerschkow” jgerschk@capusa.com
Date: Thursday, March 15, 2018 at 2:47 PM
To:checkmk-en@lists.mathias-kettner.decheckmk-en@lists.mathias-kettner.de
Subject: [Check_mk (english)] OMD Web Site Question

I’m looking for some details about the difference between ~ /share/check_mk/web/htdocs and ~/local/share/check_mk/web/htdocs (assuming su into the site user already for those paths).

At first thought I was under the assumption that I could add a “custom web” page in this location (using python). However when accessing this it just outputs the contents of the file when viewing in a web browser.

So when looking into ~/etc/apache/conf.d/check_mk.conf I see why

The directory section of the configuration is missing the AddHandler mod_python .py and PythonHander options.

I did a quick test, and I can modify the apache configuration here and make it work and do what I want by adding the above to the section for the local shared location; however, does this break something in system by doing that? Is there a better place or option?

Now the problem statement, we have a need to create a custom action that will perform some “outside of checkmk” functions based on an alarm in CheckMK, and we do need to navigate to a custom page to accomplish this, and as of right now this is the only way I thought it could be done, but out of the box it was not what I expect.

Comments?

Thanks,

Jeff Gerschkow


checkmk-en mailing list

checkmk-en@lists.mathias-kettner.de

http://lists.mathias-kettner.de/mailman/listinfo/checkmk-en

Hi Andreas:

Thank you for the information, very much appreciated.

Looks like I have a few options to continue playing with, without breaking the site itself, to get what I am trying to do accomplished.

Thank you Ken and Andreas again for the feedback.

Regards,

Jeff Gerschkow

···

From: Andreas Döhler [mailto:andreas.doehler@gmail.com]
Sent: Tuesday, March 20, 2018 2:16 PM
To: Jeffrey J. Gerschkow jgerschk@capusa.com
Cc: Ken Smith smithk190@macewan.ca; checkmk-en@lists.mathias-kettner.de
Subject: Re: [Check_mk (english)] OMD Web Site Question

Hi Jeff,

i think you don’t break anything with this modification.

At the update time it can only happen that the update script will copy a new version of your modified configuration beside your file.

The other point is that normally there is no complete own web page inside the local folder structure.

Only components loaded with the normal code inside “/share/”.

With the page handlers I cannot help as had no time and use case until now :slight_smile:

best regards

Andreas

Jeffrey J. Gerschkow jgerschk@capusa.com schrieb am Di., 20. März 2018 um 19:28 Uhr: > Ken:

Thank you for the very detailed explanation.

I am actually familiar with the usage of ~/local/share/check_mk/checks as I have written custom checks for our monitoring site.

The confusion comes as the behavior of what I had hopped with ~/local/share/check_mk/web/htdocs did not work as expected.

The section of ~/etc/apache/conf.d/check_mk.conf

Alias /[site]/check_mk/local /omd/sites/[site]/local/share/check_mk/web/htdocs

<Directory /omd/sites/[site]/local/share/check_mk/web/htdocs>

Order deny,allow

allow from all

Alias /[site]/check_mk /omd/sites/[site]/share/check_mk/web/htdocs

<Directory /omd/sites/[site]/share/check_mk/web/htdocs>

AddHandler mod_python .py

PythonHandler index

PythonOption mod_python.importer.path “[‘/omd/sites/[site]/local/share/check_mk/web/htdocs’, ‘/omd/sites/[site]/share/check_mk/web/htdocs’]”

DirectoryIndex index.py

Just to clarify, the AddHandler is present there in, but only for the “share” code. So nothing in the “local” ever is allowed to execute.

I did try and add the AddHander, PythonHandler to the “local” site and it does then allow the page to run. Can someone confirm if this is needed, should be present for the “local” alias?

I have also looked at the code, and there is a function in modules.py that loads the plugins (from what seems to be the web locations), then it allows for the creation of the pagehandlers, and within the index.py for the given page it calls get_handler, and should then execute the page by calling handler(); however, this is where it seems to all break down (could be my lack of understanding of the design), but I can’t seem to get the new page to act the right way and have a “page handler” to be called from index.py as it should be.

The section of code that is of interest is this….yet I have not figured out that working….I could not find anything specific in pagetypes.py that would lead to an explination. (again could be my lack of knowledge here).

Install page handlers created by the pagetypes.py modules. It is allowed for all

kind of plugins to register own page types, so we need to wait after all plugins

have been loaded to update the pagehandlers

pagehandlers.update(pagetypes.page_handlers())

I look into those commands you listed.

Again, thank you for the help and detailed explanation.

Regards,

Jeff Gerschkow

From: Ken Smith [mailto:smithk190@macewan.ca]
Sent: Tuesday, March 20, 2018 1:03 PM
To: Jeffrey J. Gerschkow jgerschk@capusa.com; checkmk-en@lists.mathias-kettner.de
Subject: Re: [Check_mk (english)] OMD Web Site Question

Jeff,

The basic difference between “~/share” and “~/local/share” is that that the former is owned by the omd application and contains all the standard stuff that comes with the OMD installation. When you create a “site” it uses the stuff from ~/share as defaults. It also builds a similar (but empty) structure under ~/local/share for the site’s personal use.

As a “for instance”, you wish to create a new check so you wander around until you find the checks (in /share/check_mk/checks) and decide to just make a copy of one of the present checks by just copying it to a new name and changing the guts of it a bit. However, when you go to copy it will not allow you to because the directory is owned by the OS. If you copied the file from ~/share/check_mk/checks/filename over to ~/local/share/check_mk/checks/new-filename then you would be able to edit it and it would run as the new check.

What is the importance of this ….? Well, the next time you install an updated OMD installation the system will have both the new and old versions installed. YOUR site will continue to use the old stuff until you run the “omd update” command on your site. When you do, OMD will go in and modify a bunch of pointers to link your site into the new version of OMD. The new version of OMD may have hundreds of new checks but chances are it does not have the new check you created or, for that matter, any other modifications you did to the system. However, if the modifications you did were done under the ~/local directory then they will stick with your site no matter what version you upgrade to.

I’m not sure why the “AddHandler mod_python .py” section is not in your apache settings. Possibly an oversight on the OMD design people. The good news is …… the ~/etc directory and everything in it is considered “local” or owned by the site. I do not think anything in here is modified during an upgrade. (psst! I’ve been wrong before!) So you should be able to make the changes to the apache configs to add python web page capability to your ~/local/share/check_mk/web/htdocs” directory.

Hope this helps. There is a lot of fun to be had playing in the “~/local/share/check_mk” folder. Try this at the command console: “cmk –P find”. It will show you all the stuff under ~/local/ that is not normally there. (i.e. your new webpage) Further playing with the “cmk –P” command allows you to save the new stuff for transfer/import into other OMD sites.

Ken Smith

From: checkmk-en checkmk-en-bounces@lists.mathias-kettner.de on behalf of “Jeffrey J. Gerschkow” jgerschk@capusa.com
Date: Thursday, March 15, 2018 at 2:47 PM
To:checkmk-en@lists.mathias-kettner.decheckmk-en@lists.mathias-kettner.de
Subject: [Check_mk (english)] OMD Web Site Question

I’m looking for some details about the difference between ~ /share/check_mk/web/htdocs and ~/local/share/check_mk/web/htdocs (assuming su into the site user already for those paths).

At first thought I was under the assumption that I could add a “custom web” page in this location (using python). However when accessing this it just outputs the contents of the file when viewing in a web browser.

So when looking into ~/etc/apache/conf.d/check_mk.conf I see why

The directory section of the configuration is missing the AddHandler mod_python .py and PythonHander options.

I did a quick test, and I can modify the apache configuration here and make it work and do what I want by adding the above to the section for the local shared location; however, does this break something in system by doing that? Is there a better place or option?

Now the problem statement, we have a need to create a custom action that will perform some “outside of checkmk” functions based on an alarm in CheckMK, and we do need to navigate to a custom page to accomplish this, and as of right now this is the only way I thought it could be done, but out of the box it was not what I expect.

Comments?

Thanks,

Jeff Gerschkow


checkmk-en mailing list
checkmk-en@lists.mathias-kettner.de
http://lists.mathias-kettner.de/mailman/listinfo/checkmk-en