Skip to content
This repository has been archived by the owner on Jan 15, 2019. It is now read-only.

[dev.icinga.com #3869] make classic ui work standalone (drop icinga.cfg reading in favor of cmd pipe/status.dat/objects.cache/logs+archive) #1240

Closed
icinga-migration opened this issue Mar 17, 2013 · 16 comments

Comments

@icinga-migration
Copy link

This issue has been migrated from Redmine: https://dev.icinga.com/issues/3869

Created by mfriedrich on 2013-03-17 10:20:33 +00:00

Assignee: mfriedrich
Status: Resolved (closed on 2013-04-15 10:13:39 +00:00)
Target Version: 1.9
Last Update: 2014-12-08 09:15:20 +00:00 (in Redmine)


this is mainly a problem when putting icinga2 compat locations somewhere onto a dedicated classic ui interface, and setting everything via apache env variables just does not work. even further, tricking it with a dummy icinga.cfg with locations of

  • icinga.cmd
  • objects.cache
  • status.dat

does work, but is still ugly. adding those 3 items directly to cgi.cfg (opt-in) will allow us to safely ignore icinga.cfg where no icinga is running.

Attachments

Changesets

2013-03-26 19:50:15 +00:00 by ricardo b1efafc

classic-ui: made classic-ui work standalone #3869

refs: #3869

Added "standalone_installation" to cgi.cfg to determine if a
icinga.cfg is needed or not.
Also added  missing config options from icinga.cfg:
* object_cache_file
* status_file
* resource_file
* command_file
* check_external_commands
* interval_length
* status_update_interval
* log_file
* log_rotation_method
* log_archive_path
* date_format

whatthecommit: I did it for the lulz!

2013-04-13 12:37:52 +00:00 by (unknown) b805935

install: add --enable-classicui-standalone

refs #3869

2013-04-13 13:14:11 +00:00 by (unknown) 530bca9

classic ui: fix logic on "standalone_installation" setting (if set, ignore icinga.cfg but use cgi.cfg)

refs #3869

2013-04-13 13:34:01 +00:00 by (unknown) 9d3c943

classic ui: clarify a bit on cgi.cfg what standalone install means

refs #3869

Relations:

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2013-03-19 12:24:08 +00:00

  • Subject changed from make classic ui work standalone (drop icinga.cfg reading in favor of cmd pipe/status.dat/objects.cache) to make classic ui work standalone (drop icinga.cfg reading in favor of cmd pipe/status.dat/objects.cache/logs+archive)

since icinga2 will write compat log files too, that location should be standalone as well.

@icinga-migration
Copy link
Author

Updated by ricardo on 2013-03-26 20:03:56 +00:00

  • Status changed from Assigned to 7

in current 'dev/cgis'

I think this needs a special make option. What do you think?

@icinga-migration
Copy link
Author

Updated by ricardo on 2013-03-26 20:04:19 +00:00

  • Status changed from 7 to Assigned

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2013-03-26 20:05:30 +00:00

make option for what exactly?

@icinga-migration
Copy link
Author

Updated by ricardo on 2013-03-26 20:25:19 +00:00

sorry.

Was just wondering if then Classic-UI needs to be provided as single package or something. Or "make install-cgi-only" or something like that.

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2013-03-26 21:01:49 +00:00

make install-cgis install-html

works right now. maybe later, we may rip the classic off, and put it standalone somewhere.

@icinga-migration
Copy link
Author

Updated by ricardo on 2013-03-26 23:21:31 +00:00

  • Status changed from Assigned to 7

well then.

please test if it works as expected.

Thanks

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2013-04-13 11:51:05 +00:00

$ sh ./configure --prefix=/tmp/foo --with-htmurl="/icinga-standalone" --with-cgiurl="/icinga-standalone/cgi-bin"

$ make cgis
$ make install-cgis install-html install-config

$ sudo cp sample-config/httpd.conf /etc/apache2/conf.d/icinga-standalone.conf
$ sudo cp icinga.htpasswd /tmp/foo/etc/htpasswd.users

$ sudo vim /tmp/foo/etc/cgi.cfg
standalone_installation=1

now copy the magic from a running icinga instance.

imagine /tmp/foo # mkdir var
imagine /tmp/foo # cp /var/icinga/{objects.cache,status.dat} var/
imagine /tmp/foo # chown -R icinga:icinga var

also tested the error case, when not having the standalone option enabled, if the icinga2 compat option trigger (they do not, but icinga.cfg will be used instead, nicely done!)

  • cgi.cfg
standalone_installation=0
#standalone_installation=1
  • icinga.cfg

    #object_cache_file=/tmp/foo/var/objects.cache
    object_cache_file=/tmp/foo/specialramdiskfoo

still, there's a small bug inside. if standalone is enable, but main_config_file is set, it will still try to read the values from icinga.cfg at first sight and ignores the rest.

commenting main_config_file solves the problem for now.

#main_config_file=/tmp/foo/etc/icinga.cfg

possible todos

  • configure option for standalone (which just set the cgi.cfg option)
  • edit the error text if standalone, where to look at
  • make install option
    • create var/ too (location of objects.cache, status.dat)
  • include htpasswd users in make install-config (i'll add a seperated ticket)

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2013-04-13 12:56:03 +00:00

requires changes from #3962 and #3963 - first attempt.

$ sh ./configure --prefix=/tmp/foo --with-htmurl="/icinga-standalone" --with-cgiurl="/icinga-standalone/cgi-bin" --with-httpd-conf-file=/etc/apache2/conf.d/icinga-standalone.conf --enable-classicui-standalone

$ make classicui-standalone
cd ./cgi && make
make[1]: Entering directory `/home/michi/coding/icinga/icinga-core/cgi'

.....

Standalone Classic UI CGIs built.
Proceed with make install-classicui-standalone

$ sudo make install-classicui-standalone

cd ./cgi && make install
make[1]: Entering directory `/home/michi/coding/icinga/icinga-core/cgi'
make install-basic
make[2]: Entering directory `/home/michi/coding/icinga/icinga-core/cgi'
/usr/bin/install -c -m 775 -o www-data -g www-data -d /tmp/foo/share/log
/usr/bin/install -c -m 775 -o icinga -g icinga -d /tmp/foo/sbin
for file in *.cgi; do \
                /usr/bin/install -c -m 775 -o icinga -g icinga $file /tmp/foo/sbin; \
        done
make[2]: Leaving directory `/home/michi/coding/icinga/icinga-core/cgi'
make strip-post-install
make[2]: Entering directory `/home/michi/coding/icinga/icinga-core/cgi'
for file in *.cgi; do \
                /usr/bin/strip /tmp/foo/sbin/$file; \
        done
make[2]: Leaving directory `/home/michi/coding/icinga/icinga-core/cgi'
make[1]: Leaving directory `/home/michi/coding/icinga/icinga-core/cgi'
cd ./html && make install
make[1]: Entering directory `/home/michi/coding/icinga/icinga-core/html'
/usr/bin/install -c -m 775 -o icinga -g icinga -d /tmp/foo/share
/usr/bin/install -c -m 775 -o icinga -g icinga -d /tmp/foo/share/media
/usr/bin/install -c -m 775 -o icinga -g icinga -d /tmp/foo/share/stylesheets
/usr/bin/install -c -m 775 -o icinga -g icinga -d /tmp/foo/share/docs
/usr/bin/install -c -m 775 -o icinga -g icinga -d /tmp/foo/share/docs/stylesheets
/usr/bin/install -c -m 775 -o icinga -g icinga -d /tmp/foo/share/docs/js
/usr/bin/install -c -m 775 -o icinga -g icinga -d /tmp/foo/share/docs/en
/usr/bin/install -c -m 775 -o icinga -g icinga -d /tmp/foo/share/docs/de
/usr/bin/install -c -m 775 -o icinga -g icinga -d /tmp/foo/share/docs/images
/usr/bin/install -c -m 775 -o icinga -g icinga -d /tmp/foo/share/docs/images/flags
/usr/bin/install -c -m 775 -o icinga -g icinga -d /tmp/foo/share/images
/usr/bin/install -c -m 775 -o icinga -g icinga -d /tmp/foo/share/images/logos
/usr/bin/install -c -m 775 -o icinga -g icinga -d /tmp/foo/share/jquery-ui
/usr/bin/install -c -m 775 -o icinga -g icinga -d /tmp/foo/share/jquery-ui/themes
/usr/bin/install -c -m 775 -o icinga -g icinga -d /tmp/foo/share/jquery-ui/themes/base
/usr/bin/install -c -m 775 -o icinga -g icinga -d /tmp/foo/share/jquery-ui/themes/base/images
/usr/bin/install -c -m 775 -o icinga -g icinga -d /tmp/foo/share/jquery-ui/ui
/usr/bin/install -c -m 775 -o icinga -g icinga -d /tmp/foo/share/jquery-ui-addon
/usr/bin/install -c -m 775 -o icinga -g icinga -d /tmp/foo/share/js
/usr/bin/install -c -m 775 -o icinga -g icinga -d /tmp/foo/share/ssi
/usr/bin/install -c -m 444 -o icinga -g icinga log/.htaccess /tmp/foo/share/log
/usr/bin/install -c -m 644 -o icinga -g icinga log/index.htm /tmp/foo/share/log
/usr/bin/install -c -m 664 -o icinga -g icinga robots.txt /tmp/foo/share
/usr/bin/install -c -m 664 -o icinga -g icinga docs/robots.txt /tmp/foo/share/docs
for file in *.html; \
        do /usr/bin/install -c -m 664 -o icinga -g icinga $file /tmp/foo/share; done
for file in stylesheets/*.css; \
        do /usr/bin/install -c -m 664 -o icinga -g icinga $file /tmp/foo/share/stylesheets; done
for file in docs/*.html; \
        do /usr/bin/install -c -m 664 -o icinga -g icinga $file /tmp/foo/share/docs; done
for file in docs/js/*.js; \
        do /usr/bin/install -c -m 664 -o icinga -g icinga $file /tmp/foo/share/docs/js; done
for file in docs/stylesheets/*.css; \
        do /usr/bin/install -c -m 664 -o icinga -g icinga $file /tmp/foo/share/docs/stylesheets; done
for file in docs/en/*.html; \
        do /usr/bin/install -c -m 664 -o icinga -g icinga $file /tmp/foo/share/docs/en; done
for file in docs/de/*.html; \
        do /usr/bin/install -c -m 664 -o icinga -g icinga $file /tmp/foo/share/docs/de; done
for file in docs/images/*.*; \
        do /usr/bin/install -c -m 664 -o icinga -g icinga $file /tmp/foo/share/docs/images; done
for file in docs/images/flags/*.*; \
        do /usr/bin/install -c -m 664 -o icinga -g icinga $file /tmp/foo/share/docs/images/flags; done
for file in images/*.png; \
        do /usr/bin/install -c -m 664 -o icinga -g icinga $file /tmp/foo/share/images; done
for file in images/*.jpg; \
        do /usr/bin/install -c -m 664 -o icinga -g icinga $file /tmp/foo/share/images; done
for file in images/*.gif; \
        do /usr/bin/install -c -m 664 -o icinga -g icinga $file /tmp/foo/share/images; done
for file in images/*.ico; \
        do /usr/bin/install -c -m 664 -o icinga -g icinga $file /tmp/foo/share/images; done
for file in images/logos/*.*; \
        do /usr/bin/install -c -m 664 -o icinga -g icinga $file /tmp/foo/share/images/logos; done
for file in jquery-ui/ui/*.js; \
        do /usr/bin/install -c -m 664 -o icinga -g icinga $file /tmp/foo/share/jquery-ui/ui; done
for file in jquery-ui/themes/base/*.css; \
        do /usr/bin/install -c -m 664 -o icinga -g icinga $file /tmp/foo/share/jquery-ui/themes/base; done
for file in jquery-ui/themes/base/images/*.png; \
        do /usr/bin/install -c -m 664 -o icinga -g icinga $file /tmp/foo/share/jquery-ui/themes/base/images; done
for file in jquery-ui-addon/*.*; \
        do /usr/bin/install -c -m 664 -o icinga -g icinga $file /tmp/foo/share/jquery-ui-addon; done
for file in js/*.js; \
        do /usr/bin/install -c -m 664 -o icinga -g icinga $file /tmp/foo/share/js; done
make[1]: Leaving directory `/home/michi/coding/icinga/icinga-core/html'
/usr/bin/install -c -m 644 icinga.htpasswd /tmp/foo/etc/htpasswd.users

*** Icinga http auth file installed ***

/bin/mkdir -p -m 775 /etc/apache2/conf.d
/usr/bin/install -c -m 644 sample-config/httpd.conf /etc/apache2/conf.d/icinga-standalone.conf

*** Icinga/Apache conf file installed ***


*** Icinga Classic UI Standalone installed ***

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2013-04-13 13:18:19 +00:00

  • File added icinga_classicui_1.9_standalone_no_cgi_cfg.png

I've corrected the logic on reading the main config file, if the standalone option is set. once set, it should fully ignore the main config file and use the cgi.cfg instead. otherwise, it would be strange to have the standalone option set, but still reading the main config file.

if there's no cgi.cfg available then, it also throws the correct path :-)

icinga_classicui_1.9_standalone_no_cgi_cfg.png

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2013-04-13 13:25:51 +00:00

dnsmichi wrote:

* configure option for standalone (which just set the cgi.cfg option)

--enable-classicui-standalone

this is helped by #3962 which allows you to set your own apache config file location with

--with-httpd-conf-file=

* edit the error text if standalone, where to look at

already modular there.

* make install option

added hidden 'make install-cgiconf' which gets invoked during 'make install-classicui-standalone'
'make classicui-standalone' just calls 'make cgis' currently

**** create var/ too (location of objects.cache, status.dat)

fixed the STATEDIR creation in install-basic, and used that as fix for the install routine for standalone too (creating the log+archives and extcmdfiledir as well).

* include htpasswd users in make install-config (i'll add a seperated ticket)

see #3963 - this works now out of the box, so nothing more needed than:

$ sh ./configure --prefix=/tmp/foo --with-htmurl="/icinga-standalone" --with-cgiurl="/icinga-standalone/cgi-bin" --with-httpd-conf-file=/etc/apache2/conf.d/icinga-standalone.conf --enable-classicui-standalone
$ make classicui-standalone ; sudo make install-classicui-standalone

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2013-04-13 13:48:56 +00:00

i'll prepare the docs update, no extra issue required for now.

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2013-04-13 13:55:24 +00:00

  • Done % changed from 0 to 100

everything done.

@ricardo
please re-test, lives in 'next' now.

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2013-04-15 10:13:39 +00:00

  • Status changed from 7 to Resolved

i've added a howto here: https://wiki.icinga.org/display/howtos/Setting+up+Icinga+Classic+UI+Standalone

so for now, i consider this resolved, thanks.

@icinga-migration
Copy link
Author

Updated by ricardo on 2013-04-17 15:01:45 +00:00

Testet and works as expected.

Great Teamwork ;-)

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2014-12-08 09:15:20 +00:00

  • Project changed from 19 to Core, Classic UI, IDOUtils
  • Category changed from 43 to Classic UI

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant