Commit graph

117 commits

Author SHA1 Message Date
Alan Jenkins
50463a6a10 Daemonize(): use one error convention, not three
Standardize on exit() / _exit() (this depends whether we are considered
to be the "main" fork, which should run anything registered with atexit()).
Exclude `return false` and throwing exceptions.

This fixes the error path for fork().  Daemonize() would return false, but
the `return false` error convention was not tested in the caller.

It also fixes the error message for fork() to show the error code.
Everyone loves `strace`, but sysadmins should not have to rerun their
daemons under it just to see an error code.

Also in case an exception is thrown, show its diagnostic information
instead of dropping it on the floor.  In the log message, I mention why we
are uninitializing and then initializing the app at this point.

For the reader, it pushes all the weirdness into the error convention of
Daemonize().  This comes back to the exit() / _exit() distinction.  Once
we have forked, we technically don't want to allow the parent process to
exit(), so we don't want to return to the caller.
2018-08-25 10:07:02 +01:00
Gunnar Beutner
e678fa1aa5 Refactor Application::*Const() 2018-08-13 15:27:05 +02:00
Michael Friedrich
a2a1f5c8d2 Take a note why the explicit configDir variable is needed on Windows 2018-08-07 18:33:59 +02:00
Markus Frosch
9fbc40615a Improve path handling in cmake and daemon 2018-08-07 14:10:26 +02:00
Michael Friedrich
7519d23892 Add debug logging for daemonize/timers
The previous commit is 1:1 the same I've implemented
here already. Great teamwork with Alex :)

refs #6445
2018-07-19 13:34:12 +02:00
Jean Flach
9a5d464448 Revert "Fix Windows reload"
This reverts commit 691e3cfd57.
2018-06-12 12:19:16 +02:00
Michael Friedrich
e606a443b7 Add support for config validation log timestamps
This also adds implicit support for the startup.log
generated from API config package validation, e.g. used by
the Icinga Director.

fixes #3455
2018-05-03 11:35:29 +02:00
Jean Flach
a742e64e4d Fix reload handling
Make sure we have written the new PID before letting it take over.
2018-03-14 10:43:59 +01:00
Jean Flach
691e3cfd57 Fix Windows reload 2018-02-23 17:01:46 +01:00
Michael Insel
12c4a1be1f Fix build error on Windows
The `kill` and `SIGUSR2` statements are not available on Windows.
2018-01-28 22:00:36 +01:00
Jean Flach
c418a9611e Add systemd watchdog and adjust reload behaviour 2018-01-19 16:52:36 +01:00
Gunnar Beutner
ac155d1dda Apply clang-tidy fix 'modernize-redundant-void-arg' 2018-01-04 12:24:57 +01:00
Michael Insel
158ae2188e Change copyright header for 2018 2018-01-02 12:08:55 +01:00
Jean Flach
2636e6a77a Whitespace fix
What does this change?
* Remove use of spaces for formatting
These could be found by using `grep -r -l -P '^\t+ +[^*]'
* Removal of training whitespaces
* A few lines longer than 120 chars
2017-12-20 14:53:52 +01:00
Gunnar Beutner
1ad83886ac Replace a few more NULLs with nullptr 2017-12-14 15:37:20 +01:00
Gunnar Beutner
3c60fbf75d Use std::vector::emplace_back instead of std::vector::push_back 2017-11-30 17:47:09 +01:00
Gunnar Beutner
4134f7fe42 Make sure modified attributes are applied before calling the objects' Start method
refs #4696
2017-05-03 12:02:19 +02:00
Michael Friedrich
b7caf0820d Ensure that *.icinga.com is used everywhere
fixes #13897
fixes #13277
2017-01-10 17:19:12 +01:00
Gunnar Beutner
288413f046 Replace BOOST_FOREACH with range-based for loops
fixes #12538
2016-08-25 06:46:17 +02:00
Gunnar Beutner
f3bb628d6e Improve logging for the WorkQueue class
fixes #12336
2016-08-09 12:39:07 +02:00
Michael Friedrich
915ebe17cd ConfigCompiler should not log included files by default
fixes #11419
2016-07-05 15:43:48 +02:00
Michael Friedrich
8b742e841f Ensure that obsolete comment/downtime objects are deleted after activating objects
Config validation shouldn't be able to purge the files, only on
restart.

fixes #11890
2016-06-06 13:07:49 +02:00
Gunnar Beutner
0bc139af93 Improve timing behavior for UpdateObjectAuthority calls
refs #11765
2016-05-11 13:04:39 +02:00
Gunnar Beutner
fc1168ed3e Only activate HARunOnce objects once there's a cluster connection
fixes #11765
2016-05-11 12:50:40 +02:00
Gunnar Beutner
599929b0f6 Update copyright headers for 2016 2016-01-12 08:29:59 +01:00
Michael Friedrich
8b6d3350b8 Fix failed reload via systemd
fixes #10226
2015-12-16 15:57:59 +01:00
Gunnar Beutner
3505ca3c16 Fix race condition in the ConfigItem class
fixes #10643
2015-11-19 19:38:49 +01:00
Gunnar Beutner
3c6f0e31d9 Make sure the timer thread is gone when calling fork()
refs #10410
2015-10-20 23:02:11 +02:00
Gunnar Beutner
6fa58a520c Implement config object sync
Adds object version.

refs #9927
2015-09-17 14:20:43 +02:00
Gunnar Beutner
e2290d5012 Implement support for unregistering objects
refs #9101
2015-08-15 20:07:11 +02:00
Gunnar Beutner
6c96d5bc98 Clean up the start-up process a bit
fixes #8791
2015-03-18 11:14:51 +01:00
Gunnar Beutner
ac7a55cf56 Fix file descriptor leak in SetDaemonIO 2015-03-03 07:36:43 +01:00
Gunnar Beutner
7c31654552 Remove the return type for Utility::LoadExtensionLibrary 2015-03-03 07:19:34 +01:00
Jean-Marcel Flach
9ed21563ff Use RequestShutdown with exitcode instead of Application::Exit
fixes #8436
2015-02-27 14:43:30 +01:00
Jean Flach
cc5a8da6e8 CLI: Add 'troubleshoot collect' command
By calling `icinga2 troubleshoot collect [--console]` a small file
containing basic application information and a tail of all found logs
and the latest crash report will be created [or displayed].
It does not collect config files at the moment.

refs #3446
2015-02-15 12:38:28 +01:00
Gunnar Beutner
cb6f1043e1 Replace if( with if ( 2015-02-11 15:47:45 +01:00
Michael Friedrich
78bfd0204c Update copyright year 2015-01-22 12:00:23 +01:00
Gunnar Beutner
310278344c Make sure we don't include zones.d directories for zones which were removed
fixes #8256
2015-01-20 13:18:40 +01:00
Gunnar Beutner
4e5649f0d7 Disable vfork() on OS X
fixes #8131
2014-12-19 16:04:34 +01:00
Gunnar Beutner
97168378e8 Rename _DEBUG to I2_DEBUG
fixes #7767
2014-12-19 12:19:28 +01:00
Gunnar Beutner
873e294158 Refactor the WorkQueue class to make error reporting easier
refs #7709
2014-12-18 15:11:57 +01:00
Gunnar Beutner
c3cf7682b9 Clean up the DebugInfo class
refs #7709
2014-12-18 12:58:46 +01:00
Gunnar Beutner
f800630c10 Implement Livestatus support for the "repl" command
refs #7805
2014-12-16 19:28:46 +01:00
Gunnar Beutner
1cb0231c05 Refactor how variable scopes work
refs #8074
2014-12-14 11:33:45 +01:00
Gunnar Beutner
cfd775c948 Move the VMFrame class to libbase
refs #8065
2014-12-12 15:33:56 +01:00
Gunnar Beutner
2720333d6e Fix missing location information for included files
fixes #7927
2014-12-10 15:06:09 +01:00
Gunnar Beutner
ab63fca3d5 Make the config parser thread-safe
fixes #7822
2014-11-28 06:48:27 +01:00
Gunnar Beutner
8d0ddb7c8c Implement more unit tests
refs #7805
2014-11-23 12:35:13 +01:00
Gunnar Beutner
f5766f9118 Refactor the stack frame handling for scripts
fixes #7748
2014-11-22 19:24:03 +01:00
Gunnar Beutner
764d72a61a Improve error messages for the config parser
refs #7699
2014-11-21 09:07:08 +01:00
Gunnar Beutner
8e265b7b7f Implement a C++ code generator for libconfig
fixes #7699
fixes #7704
fixes #7706
2014-11-20 21:53:32 +01:00
Gunnar Beutner
f84cc8de39 Implement support for signals
fixes #7744
2014-11-20 06:54:48 +01:00
Gunnar Beutner
a2c5887e51 Fix crash when daemonizing Icinga
refs #7648
2014-11-12 12:44:14 +01:00
Gunnar Beutner
dfd24e6359 Fix _DEBUG define on *NIX 2014-11-12 11:34:59 +01:00
Gunnar Beutner
478f03b49a Replace boost::shared_ptr with boost::intrusive_ptr
refs #7622
2014-11-09 16:54:41 +01:00
Gunnar Beutner
e1c95d4fa0 Improve config compiler's memory usage 2014-11-08 13:21:51 +01:00
Michael Friedrich
bc83c9a698 CLI Commands: Remove timestamp prefix when logging output
fixes #7376
2014-10-31 22:01:36 +01:00
Gunnar Beutner
2972c6bfe8 Implement the "variable" CLI command
fixes #7370
2014-10-20 21:14:56 +02:00
Gunnar Beutner
26b9c5a81b Move clicommand.{cpp,hpp} to lib/cli
refs #7246
2014-10-20 14:06:21 +02:00
Gunnar Beutner
2d5e9514a5 Refactor logging code 2014-10-19 17:52:17 +02:00
Gunnar Beutner
b18f57a745 Remove logger_fwd.hpp 2014-10-19 14:50:39 +02:00
Gunnar Beutner
7db8588980 Implement auto-completion for positional arguments
refs #7255
2014-10-17 15:54:46 +02:00
Gunnar Beutner
2a60ce8625 Improve auto-completion for arguments
fixes #7375
2014-10-14 16:45:00 +02:00
Michael Friedrich
3513d1f2f9 CLI framework: Add support for unrecognized parameters
Required for feature enable command for example.

fixes #7371
2014-10-13 18:07:52 +02:00
Gunnar Beutner
a01fb6d6e6 Make sure we're using the right user/group for CLI commands
refs #7246
2014-10-13 13:44:45 +02:00
Gunnar Beutner
50a1b243ed Hide some of the internal command-line arguments
refs #7246
2014-10-10 11:08:24 +02:00
Gunnar Beutner
a4081f1445 Implement support for CLI commands
fixes #7246
2014-10-08 15:33:10 +02:00