Commit Graph

4329 Commits

Author SHA1 Message Date
Alan Jenkins a0fb0bbfe3 fix "Console" log to flush
It's called "Console", which would be line-buffered anyway.  But, it's
implemented as std::cout.  This might be piped to a logger, as in
daemontools or systemd.  In this case it will not be a TTY, and log lines
should be flushed without too much delay.  Let's just flush each message.

Let's not introduce a static instance of StreamLogger (flushed by interval
timer).  That's too stressful to read, because static instances are really
annoying to order.  Example citation: "Yay, our static destructors are
pretty much beyond repair at this point." -- application.cpp.

I don't know if there will be any need to optimize logging syscalls.  The
init script uses `--daemonize`.  I think the systemd service should also
avoid using the "Console" log after startup (see next commit).  The
documentation does not warn that the syslog feature is less efficient
in system calls than mainlog; deferred flusing does not seem to be a highly
prominent feature.  There's no cool comment in the code about how much the
syscalls were slowing down some use case (or qualifying that this
optimization can only eliminate syscalls on platforms with both mutexes and
clocks that can work without syscalls).
2018-08-25 09:54:55 +01:00
Noah Hilverling 01fea22c77 Add child_options to ScheduledDowntime
refs #3935
2018-08-24 14:29:39 +02:00
Michael Friedrich 237fd520db
Merge pull request #6509 from gunnarbeutner/feature/real-constants
Implement support for namespaces
2018-08-24 12:10:10 +02:00
Michael Friedrich 7a22113f86
Merge pull request #6570 from Icinga/bugfix/tls-anonymous-clients-limit
Increase limit for simultaneously connected anonymous TLS clients
2018-08-23 17:13:41 +02:00
Michael Friedrich 0dd168fe80 Increase limit for simultaneously connected anonymous TLS clients 2018-08-23 17:10:51 +02:00
Michael Friedrich 6a71b75f63 ApiListener: Dump the state file port detail as number
refs #6511
2018-08-22 12:57:47 +02:00
Gunnar Beutner e678fa1aa5 Refactor Application::*Const() 2018-08-13 15:27:05 +02:00
Gunnar Beutner 1a0311a49f Implement namespace support for the keys() function 2018-08-13 13:44:31 +02:00
Gunnar Beutner 8fda8d72ac Implement support for the namespace and using keywords 2018-08-13 13:44:31 +02:00
Gunnar Beutner 10d6f70a85 Move constants and functions into different namespaces 2018-08-13 13:44:31 +02:00
Gunnar Beutner 1a8692d972 Implement support for namespaces 2018-08-13 13:44:31 +02:00
Gunnar Beutner 9d513d8f05 Implement support for modifying frozen attributes 2018-08-13 13:44:31 +02:00
Gunnar Beutner d9c0b6f806 Refactor REGISTER_SCRIPTFUNCTION_* macros 2018-08-13 13:44:31 +02:00
Michael Friedrich 060a1ebbd9
Merge pull request #6512 from Icinga/feature/sni-environment
Refactor environment for API connections
2018-08-10 13:15:48 +02:00
Michael Friedrich 2ee6dfaf93 Re-add environment to IcingaApplication feature stats 2018-08-10 13:01:53 +02:00
Michael Friedrich 97513965e6 Introduce IcingaApplication#environment
Precedence as follows:

- DEnvironment=...
- const Environment = ...
- object IcingaApplication "app" { environment = "..." }

The wrapped script constant handling is required
since we cannot directly link from libremote (SNI handling)
to libicinga where the object resides. Instead we'll
use the Application class helpers for hiding the ScriptGlobal
calls.
2018-08-10 12:49:48 +02:00
Michael Friedrich a4c689e5cf Build fix for CentOS 7 and non-unity builds 2018-08-09 16:23:24 +02:00
Michael Friedrich b350512b11 Rename to Environment constant 2018-08-09 13:19:33 +02:00
Markus Frosch eb02d9041d Refactor environment for API connections
* Const renamed to `ApiEnvironment`
* Handling moved to ApiListener
* Now a property of ApiListener
2018-08-09 13:19:33 +02:00
Michael Friedrich f1e7e635a2
Merge pull request #6531 from Icinga/feature/zone-all_parents
Expose Zone#all_parents via API
2018-08-09 13:11:23 +02:00
Michael Friedrich 3cc8bd2fcc
Merge pull request #6511 from Icinga/feature/apilistener-dynamic-port
ApiListener: Add support for dynamic port handling
2018-08-09 12:09:23 +02:00
Michael Friedrich ecb73e08ed Implement ApiListener status file removal on shutdown 2018-08-09 11:54:34 +02:00
Markus Frosch 20269a89d0 ApiListener: Add support for dynamic port handling 2018-08-08 17:42:57 +02:00
Michael Friedrich ba21a54443
Merge pull request #6530 from Icinga/bugfix/query-was-empty
IDO/MySQL: avoid empty queries
2018-08-08 14:41:57 +02:00
Alexander A. Klimov ea5614f7df Expose Zone#all_parents via API 2018-08-08 14:38:02 +02:00
Alexander A. Klimov 7bcbd9b497 Rename Zone#GetAllParents() to Zone#GetAllParentsRaw() 2018-08-08 14:38:02 +02:00
Alexander A. Klimov 7a31cd4fe7 IDO/MySQL: avoid empty queries 2018-08-08 12:11:37 +02:00
Michael Friedrich 9be3ee1a1a Update output for `--version`
This moves the system and build information before
the application paths which are normally not that important.
2018-08-07 18:46:18 +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 8bac1dc99e
Merge pull request #6521 from gunnarbeutner/feature/references
Implement references
2018-08-07 12:00:19 +02:00
Gunnar Beutner 24de1963b1
Merge pull request #6526 from Icinga/bugfix/wpessimizing-move-6524
icinga::PackObject(): shorten conversion to string
2018-08-07 10:05:18 +02:00
Alexander A. Klimov 137f5363c4 icinga::PackObject(): shorten conversion to string
refs #6524
2018-08-07 09:57:08 +02:00
Gunnar Beutner 8bfd419702 Implement references 2018-08-07 07:44:48 +02:00
Michael Insel eea42c6807 Fix windows build 2018-08-05 20:17:43 +02:00
Michael Insel 51b900b307 Reset terminal on erroneous console exit
This ensures that the terminal is resetted on an erroneous exit when using the Icinga 2 console.

refs #6382
2018-08-05 16:30:36 +02:00
Michael Friedrich 33492420f3
Merge pull request #6427 from gunnarbeutner/fix/recursive-serialize
Improve error message for serializing objects with recursive references
2018-08-03 11:03:42 +02:00
Gunnar Beutner 56cf64f590 Improve error message for serializing objects with recursive references 2018-08-02 11:06:24 +02:00
Jean Flach 065bc23d9a
Merge pull request #6508 from gunnarbeutner/feature/dictionary-clear
Implement the Dictionary#clear script function
2018-08-02 10:30:08 +02:00
Gunnar Beutner a5a0119799 Implement the Dictionary#clear script function 2018-08-02 08:45:19 +02:00
Christopher Schirner b870e84904 Only check lag if connected 2018-07-31 10:41:14 +02:00
Christopher Schirner 35038f72d6 Invert connected check 2018-07-31 10:40:54 +02:00
Peter Eckel b5a7af126d Fixed indentation 2018-07-29 15:39:02 +02:00
Peter Eckel f788795415 Reduce the log level for missing env macros to debug
refs #6460
2018-07-29 15:17:50 +02:00
Jean Flach 2e3a1ff0c6
Merge pull request #6498 from Icinga/bugfix/match-regex-match-any-regression
Fix regression with MatchAny false conditions on match/regex/cidr_match
2018-07-27 17:28:13 +02:00
Jean Flach a5afaf5b40
Merge pull request #6497 from Icinga/bugfix/match-dictionary-error-handling
Improve error logging for match/regex/cidr_match functions and unsupported dictionary usage
2018-07-27 17:26:12 +02:00
Michael Friedrich 72c0f07661 Fix regression with MatchAny false conditions on match/regex/cidr_match
fixes #6496
2018-07-27 16:55:37 +02:00
Michael Friedrich 8e682ce9b1 Improve error logging for match/regex/cidr_match functions and unsupported dictionary usage
fixes #6442
2018-07-27 16:34:50 +02:00
Michael Friedrich 1d22b6e176
Merge pull request #6410 from Icinga/remove-dead-code
Remove unused code
2018-07-27 15:56:52 +02:00
Michael Friedrich b16d96d197
Merge pull request #6489 from Icinga/feature/object-packer
Implement object packer for consistent hashing
2018-07-27 12:49:28 +02:00
Alexander A. Klimov dd8cb42969 Implement object packer for consistent hashing 2018-07-26 17:36:48 +02:00
Markus Frosch ddc5b951b3
Revert "Implement support for the --env command-line argument" 2018-07-26 17:09:06 +02:00
Michael Friedrich 46e71a83dc
Merge pull request #6414 from Icinga/feature/icinga-envs
Implement support for the --env command-line argument
2018-07-26 10:09:42 +02:00
Michael Friedrich e519d6bbc6
Merge pull request #6110 from gunnarbeutner/feature/for-loop-var
Implement support for optionally specifying the 'var' keyword in 'for' loops
2018-07-26 10:05:17 +02:00
Michael Friedrich 272176e2d0
Merge pull request #6475 from dh-harald/master
lib->compat->statusdatawriter: fix notifications_enabled
2018-07-26 10:03:57 +02:00
Michael Friedrich 3fc3d86fbb
Merge pull request #6386 from Icinga/fix/timeperiods-do-not-clear-after-restart
Fix that TimePeriod segments are not cleared on restart
2018-07-26 10:02:46 +02:00
Michael Friedrich 020bd86b4c
Merge pull request #6408 from Icinga/bugfix/objectlock-unlock-m_lockowner
ObjectLock#Unlock(): don't reset m_Object->m_LockOwner too early
2018-07-26 10:02:26 +02:00
Michael Friedrich 038b2fb94c
Merge pull request #6379 from Icinga/global-zone-validation
Throw config error when using global zones as parent
2018-07-26 10:01:46 +02:00
Michael Friedrich fcc32957cb
Merge pull request #6455 from Icinga/feature/filelogger-started
Log something when the Filelogger has been started
2018-07-26 10:01:06 +02:00
Michael Friedrich 62e91e1891
Merge pull request #6430 from Icinga/fix/workqueue-log-message
Fix negative 'empty in' value in WorkQueue log message
2018-07-26 09:59:53 +02:00
Michael Friedrich 89d42fee72
Merge pull request #6440 from Icinga/bugfix/typo
Fix typo
2018-07-26 09:59:20 +02:00
Michael Friedrich b1adad0a42
Merge pull request #6456 from Icinga/feature/logger-flush-dev
Keep notes for immediately log flushing
2018-07-26 09:58:59 +02:00
Michael Friedrich 45a0518c78
Merge pull request #6458 from Icinga/bugfix/configitem-debug-log
Fix debug build log entry for ConfigItem activation priority
2018-07-26 09:57:19 +02:00
Michael Friedrich 5a8e98213c
Merge pull request #6487 from Icinga/bugfix/discard-warning-6485
Fix "Discard" message being warning
2018-07-26 09:52:33 +02:00
Jean Flach 2b44eff8da Fix "Discard" message being warning 2018-07-26 09:39:03 +02:00
dh.harald d9d701a05c
lib->compat->statusdatawriter: fix notifications_enabled 2018-07-23 22:28:09 +01:00
Michael Friedrich 14d88d90a0
Merge pull request #6470 from sebastic/spelling-errors
Fix spelling errors.
2018-07-23 17:59:45 +02:00
Bas Couwenberg 0891380789 Fix spelling errors.
* occured -> occurred
 * dosen't -> doesn't
2018-07-21 10:38:09 +02:00
Alexander A. Klimov f71bad96d5 Start and stop the timer thread lazily
refs #6461
2018-07-20 15:36:15 +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
Alexander A. Klimov d15e1006f3 Re-introduce Timer::Initialize()
refs #6445
2018-07-19 13:22:37 +02:00
Michael Friedrich fc2da5047c Fix debug build log entry for ConfigItem activation priority
This is not visible in release builds, minor fix.
2018-07-19 12:53:28 +02:00
Michael Friedrich fd381ff5e0 Keep notes for immediately log flushing
Disabled, but kept for future debugging sessions.
Helps with things like #6455
2018-07-19 12:51:30 +02:00
Michael Friedrich 7c2e999f1f Log something when the Filelogger has been started
Helps to see whether the logger object is active,
spotted during #6445
2018-07-19 12:48:29 +02:00
Alexander A. Klimov 030afee8b0 Fix typo 2018-07-17 14:23:20 +02:00
Michael Insel 4170bd5205 Fix negative 'empty in' value in WorkQueue log message
This fixes a negative 'empty in' value in WorkQueue log messages.
2018-07-10 19:21:04 +02:00
Alexander A. Klimov ac6afadb5a Make HttpServerConnection#m_DataHandlerMutex a boost::recursive_mutex
refs #6428
2018-07-09 14:40:32 +02:00
Gunnar Beutner 2eb46f1203 Implement support for optionally specifying the 'var' keyword in 'for' loops 2018-07-03 11:03:22 +02:00
Michael Friedrich ab9a32d67d Fix missing next check update causing the scheduler to execute checks too often
Regression from #6217, only in git master.

fixes #6421
2018-07-02 16:17:53 +02:00
Michael Friedrich 601c54e44e Add more debug logging for check scheduling 2018-07-02 16:17:33 +02:00
Gunnar Beutner c577554073 Implement support for the --env command-line argument 2018-06-27 13:15:52 +02:00
Jean Flach 4159682cf8 Remove unused code
These methods and types were used only by the Icinga Studio
2018-06-25 10:09:30 +02:00
Alexander A. Klimov 02645c59ff ObjectLock#Unlock(): don't reset m_Object->m_LockOwner too early 2018-06-22 14:13:09 +02:00
Michael Friedrich ba680dc829
Merge pull request #6405 from Icinga/bugfix/windows-reload-behaviour-6378
TcpSocket#Bind(): reuse socket addresses on Windows, too
2018-06-22 12:25:28 +02:00
Michael Friedrich a1c2eb3d87 Ensure to _unlink before renaming replay log on Windows 2018-06-22 11:12:09 +02:00
Alexander A. Klimov 79878ea286 TcpSocket#Bind(): reuse socket addresses on Windows, too
refs #6378
2018-06-22 10:33:31 +02:00
Michael Friedrich 0ffb8af8e3 Conform to RFC for CRLF in HTTP requests
refs #6242
2018-06-21 16:53:44 +02:00
Michael Friedrich 1b2af3f0c4
Merge pull request #6402 from Icinga/fix/tls-stream-read-pending
Use SSL_pending() for remaining TLS stream data
2018-06-21 16:43:03 +02:00
Michael Friedrich 257ad12646 Use SSL_pending() for remaining TLS stream data
We've used this previously, and according to the OpenSSL
docs we should just use it. From our experience everything
done different to the API functions from OpenSSL causes
undefined behaviour in the worst case.

This commit also breaks the packet size limit into a more
readable version, including logs for development debug builds.

refs #6242
2018-06-21 15:58:05 +02:00
Michael Friedrich 9ea0650edc Fix connection error handling in Elasticsearch and InfluxDB features
Previously this would just throw the entire exception stack trace
which is not needed here.

fixes #6394
2018-06-21 15:41:40 +02:00
Michael Friedrich cc294e14d2
Merge pull request #6393 from Icinga/bugfix/elasticsearchwriter-not-writing-6354
Stream#ReadLine(): fix false positive buffer underflow indicator
2018-06-21 15:06:21 +02:00
Alexander A. Klimov 1c213877a4 Stream#ReadLine(): simplify algorithm
refs #6354
2018-06-20 17:28:52 +02:00
Alexander A. Klimov 3c7851107c TlsStream#IsEof(): fix false positive EOF indicator
refs #6242
2018-06-20 16:55:33 +02:00
Alexander A. Klimov 02d1f1cc57 Stream#ReadLine(): fix false positive buffer underflow indicator
refs #6354
2018-06-20 09:59:18 +02:00
Michael Friedrich cfd6c79a03
Merge pull request #6387 from Icinga/fix/remove-broken-api-user-hash
Remove ApiUser password_hash functionality
2018-06-19 14:26:32 +02:00
Michael Friedrich 2fd6709952 Remove ApiUser password_hash functionality
This affects and fixes

- Windows reload
- Config validation
- RHEL 7.5 OpenSSL memory corruption
- Hash algorithm, requested changes

refs #6378
refs #6279
refs #6278
2018-06-19 11:32:03 +02:00
Noah Hilverling ea08c85424 Fix that TimePeriod segments are not cleared on restart
refs #6282
2018-06-19 10:30:34 +02:00
Noah Hilverling 233d00d648
Merge pull request #6311 from Reamer/timeperiod_bugfix
refs #6282
2018-06-19 10:29:27 +02:00
Michael Friedrich 9b99c9d106 Remove leftover for sysconfig file parsing
refs #6255
2018-06-18 19:25:48 +02:00
Alexander A. Klimov a0fca599da HttpRequest#ParseBody(): indicate success on complete body
refs #6184
2018-06-18 16:02:22 +02:00