Commit Graph

434 Commits

Author SHA1 Message Date
Alexander A. Klimov fad2dc82ce Systemd: don't kill any running check plugins 2019-05-10 13:14:39 +02:00
Maximilian Falkenstein a205fd0887
Fix logrotate "Operation not permitted"
PR 75 (commit afb6346) added support for the 'su' directive of
logrotate. However, when using 'su', we cannot chown to arbitrary file
owners anymore, which means that unless the file has already been
created with the same permissions we'll get an error.
Fix this by not using chown and su together.
2019-03-31 22:16:06 +02:00
Michael Friedrich 37b715baf1 Replace a few more copyright strings 2019-02-25 16:30:40 +01:00
Michael Friedrich 458f997a18 Replace Copyright header with a short version, part II 2019-02-25 15:09:36 +01:00
Andreas Unterkircher c2b6f6b246 service and host mail-notifications, add line-breaks to very long output strings 2018-12-05 07:53:04 +01:00
Martijn van Duren a763e74a50 Make mail-{host,service}-notification.sh as POSIX-compliant as possible. 2018-11-16 14:23:56 +01:00
Michael Friedrich 6a4c5e6bcb Imitialize ICINGA2_ERROR_LOG inside the Systemd environment
The initscript uses a local default, which is not here for Systemd.
2018-11-13 14:02:03 +01:00
Schanz, Jens 2754175c6e fixes #6758
Add target network-online.target as requirement.
Service Icinga2 won't start before target is finally reached.
This prevents Icinga2 from failing if no entry for hostname.domain
is set in /etc/hosts
2018-11-09 13:17:08 +01:00
Michael Friedrich 3cb2c1d143 icinga.com: Update everything else 2018-10-18 09:50:53 +02:00
Michael Friedrich dea5ec614e icinga.com: Update CMakeLists.txt 2018-10-18 09:35:18 +02:00
Jean Flach 72cc41d14e
Merge pull request #6356 from sourcejedi/fix/systemd
Fix logging under systemd
2018-09-04 15:24:43 +02:00
Michael Friedrich 64305b4466 Fix using full path in prepare-dirs/safe-reload scripts
This won't be visible with packages and overridden paths,
just source builds which invoke the scripts manually.

refs #6506
2018-09-03 16:47:38 +02:00
Alan Jenkins a21166dcf8 Fix logging under systemd
icinga2.service used `-e ${ICINGA2_ERROR_LOG}`, but this is documented
as having no effect without `-d`.  Furthermore, icinga2 under systemd
unconditionally logged everything to the system log (but without setting
the log level etc), which contradicted the documentation.  (Issue #6339)

Stop icinga2 on systemd from logging to stdout - and hence the system log -
once it has finished starting up.  Just like when you start icinga2 from a
terminal using `-d`.  And just like -d, we stop logging fatal errors to
stderr, and instead write to the log file passed with `-e`.

As per docs, mainlog (icinga2.log) is already enabled by default.  And
pre-startup messages including config errors will still appear in the
system log.

This uses a new option --close-stdio, which has the same effect on logging as
--daemonize, but does not fork or call setsid().

For this purpose, I moved setsid() up and into Daemonize().

Consequence of that last point: if anyone is weird enough to specify a TTY
device file as the fatal error log (-e option), that will become icinga's
controlling terminal, which you generally don't want as a daemon.  This
makes it consistent with the existing behaviour for icinga mainlog.  For
this reason you're supposed to use O_NOCTTY in Linux daemons.  But I wasn't
sure where icinga would want to put the ugly `#ifdef _WIN32 ... #else ...`.
2018-08-25 10:21:06 +01:00
Markus Frosch 9fbc40615a Improve path handling in cmake and daemon 2018-08-07 14:10:26 +02:00
Jean Flach 383ca5011c Load functions first
refs #6449
2018-07-18 13:36:37 +02:00
Jean Flach 92056c592e Use . instead of source
fixes #6450
2018-07-18 13:35:27 +02:00
Michael Friedrich c4c6f2064d Revert "Fix obsolete parameter in Systemd script"
This reverts commit 592fb22c7f.

We have the problem that Systemd doesn't expand shell variables
into our environment.

During the upgrade cycle this would maybe render a wrong PID file
location, thus resulting in wrong 'safe-reload' behaviour.

This is only for a clean upgrade path from 2.8.x to 2.9.0,
the proper fix is to ensure that the sysconfig file is empty
and keep our own defaults, or modified from the user.

refs #6434
2018-07-17 14:10:26 +02:00
Jean Flach 44fae88d43 Update sysconfig read 2018-06-18 10:27:35 +02:00
Jean Flach 2b5ea38217 Fix sysconfig not bein handled correctly by sysvinit 2018-06-15 17:04:28 +02:00
kiba 415552f355 set correct utf8 email subject headers (RFC1342) 2018-06-13 11:18:14 +11:00
Michael Friedrich 2dafcfa8a9 prepare-dirs: Ensure to always set proper run directory permissions
refs #6328
2018-06-06 14:32:26 +02:00
Michael Friedrich 592fb22c7f Fix obsolete parameter in Systemd script
refs #6328
2018-06-05 14:03:39 +02:00
Jean Flach ed4e008e79 Rework sysconfig file
The sysconfig file now only contains the defaults as comments, changes
made there are given to the init.d script, prepare-dirs, safe-reload and
Icinga 2 itself. If nothing is set in the sysconfig file (as is the
default as all lines are commented out) the defaults are used.

fixes #6255
2018-05-23 15:18:42 +02:00
Michael Friedrich 69f339d229
Merge pull request #6238 from Icinga/fix/notification-script-check-required-parameters
Implement better way to check parameters in notification scripts
2018-05-03 15:36:59 +02:00
Michael Friedrich a45dba15d3 Fix SysconfigFile detection for binary builds
It may happen that the variable is not properly initialized
and we'll have an empty string. Observed on macOS and inside
Docker.

refs #6215
2018-04-19 08:55:05 +02:00
Michael Insel 12a40d7244 Implement better way to check parameters in notification scripts
This changes the function for checking required parameters in the notification scripts.
This also enhances the error message.

refs #5812
2018-04-18 19:17:33 +02:00
Jean Flach ba882079be Don't use shell variables in sysconfig
fixes #6214
2018-04-13 13:03:12 +02:00
Max Rosin b34675cae8 Fix description of the NotificationComponent in notification.conf, fix #6122 2018-02-27 14:31:00 +01:00
Jean Flach f7ec97abd8 Fix typo in prepare-dirs
refs #5850
2018-02-23 14:22:02 +01:00
Jean Flach 87adc88989 Remove need for init.conf 2018-02-20 14:16:43 +01:00
Jean Flach c8c193a9d8 Remove need for RunAsUser/Group
They are now read form the sysconfig file which is owned by root
2018-02-20 14:16:43 +01:00
Jean Flach 6ae376b7fd Add cli tool to send signals as Icinga user
fixes #5991
2018-02-20 14:16:43 +01:00
Jean Flach ba41d7f249 Get ICINGA2_USER and GROUP from sysconfig 2018-02-20 14:16:43 +01:00
Jean Flach 88f77f9f8d Fix prepare-dirs permission exploit
refs #5793
2018-02-20 14:16:43 +01:00
Dirk Goetz 87f8ca5b79 Fixed URL encoding for HOSTNAME and SERVICENAME in mail notification
Refs #5540
2018-02-20 14:16:43 +01:00
Gunnar Beutner 6506a89db3 Update default config and documentation for the "library" keyword 2018-01-22 08:18:05 +01:00
Jean Flach c418a9611e Add systemd watchdog and adjust reload behaviour 2018-01-19 16:52:36 +01:00
Jean Flach 1da6b2c883 Fix whitespaces in CMakeLists files
Uses 2 space indentation as standard
2018-01-19 09:19:40 +01:00
Michael Insel 158ae2188e Change copyright header for 2018 2018-01-02 12:08:55 +01:00
Gunnar Beutner b3b707aba0 Enable installing the init scripts on Solaris 2017-12-20 08:44:06 +01:00
Michael Friedrich 3673bd2201 Fix default configuration example for ElasticsearchWriter 2017-11-15 18:06:52 +01:00
Michael Friedrich 7c0a09cfb6 Rename ElasticWriter to ElasticsearchWriter
This better reflects its purpose as otherwise it would imply
that you need Elastic Stack for it. Graylog also reads from
Elasticsearch instances, this could serve as additional integration
here.
2017-11-09 15:33:10 +01:00
Gunnar Beutner f2d437e96c Implement support for migrating certificates to /var/lib/icinga2/certs
This commit includes documentation too.

Signed-off-by: Michael Friedrich <michael.friedrich@icinga.com>
2017-10-20 14:06:02 +02:00
Michael Friedrich 2d8607d6b0 Enhance documentation with more details on value types for object attributes
Main focus: Object attributes and their value types. Originates from the
API Event Streams patch to document their value types. Now applied to
the entire configuration objects chapter.

The API chapter and their value types has been changed to capitalized
type identifiers.

Value types are now explicitly told about inside monitoring basics. This
has been adopted into the Icinga 2 training material a long time ago
and finds its way into the docs too.

The CheckResult and PerfdataValue value types have been moved into the
advanced topics chapter. mkdocs doesn't like multiple `#` headings in one file
and did just hide it.

Also moved the Influxdb details into the features documentation where it
belongs.

Many small references and URLs to other chapters added.
E.g. dedicated chapters for object accessor examples, to better link against
time dependent thresholds.

Can serve as patch basis and reference for ITL documentation where the
value types are missing too.

This commit also fixes the non-requirement of "legacy-timeperiod" which
also is a default template import since 2.6.

This also fixes the state mapping issue.

fixes #4015
2017-10-10 17:52:49 +02:00
Markus Frosch c90dc34edb Improve documentation and Systemd config for TasksMax setting
This also disables setting a value by default.

Packaging should decide to install the config file:
`/etc/systemd/system/icinga2.service.d`

fixes #5611

Signed-off-by: Michael Friedrich <michael.friedrich@icinga.com>
2017-09-29 17:34:32 +02:00
Michael Friedrich 953d840cc1 Fix certificate paths for installers
refs #5450
2017-09-22 15:00:45 +02:00
Michael Friedrich 16c0fc4177 Drop satellite.conf reference for bottom-up
refs #4799
2017-09-22 14:28:55 +02:00
Michael Friedrich cfd2a93aa6 Remove bottom-up repository.d references
refs #4799
2017-09-22 14:04:59 +02:00
Michael Friedrich 6ab38b6c15 Remove deprecated Classic UI configuration package
refs #5301
2017-09-22 12:26:59 +02:00
Michael Friedrich 086e24f28a Ensure that the cache directory always is set and add a note to upgrading docs
Thanks @dgoetz
2017-09-22 09:31:42 +02:00
Michael Friedrich 37ea6ab1fc Fix wrong certs path in ApiListener config
refs #5450
2017-09-12 12:52:49 +02:00
Gunnar Beutner b08f5477dc Change PKI path from /etc/icinga2/pki to /var/lib/icinga2/pki
refs #5450
2017-09-12 12:52:49 +02:00
Jean Flach e19d3f57c7 Add ElasticWriter
fixes #5538
2017-09-12 12:52:49 +02:00
Michael e2bf7516bb Notification scripts: Fix duplicate variable in mail-{host,service}-notification 2017-08-14 17:34:39 +02:00
Christian Gut 0f0b6f1df9 Notification scripts: More readable & redundancy cleanup 2017-08-14 17:27:39 +02:00
Michael Friedrich f0fbcbba5b Update documentation for optional arguments and add old updated command config
See https://www.icinga.com/docs/icinga2/latest/doc/03-monitoring-basics/#notification-commands-in-27

refs #5474
2017-08-14 17:11:57 +02:00
pv2b 7dabf2fe93 Notification scripts: Make the `-4` parameter optional
Not all hosts may have the `address` attribute set, or just use
`address6` instead.

refs #5474
2017-08-14 17:11:57 +02:00
Michael Friedrich e188686ed4 Merge pull request #5392 from ekohl/cache-dir
Ensure the cache directory exists
2017-08-09 18:22:07 +02:00
Michael Friedrich 874e005284 Systemd: Add DefaultTasksMax=infinity to service file
This solves the problem with Systemd >= 226 and fork errors with
Icinga 2. Seen on SLES 11 SP2.

fixes #4918
2017-08-08 16:11:40 +02:00
Ewoud Kohl van Wijngaarden e83c43435d
Ensure the cache directory exists
As suggested in https://github.com/Icinga/icinga2/issues/4414
2017-07-01 13:59:58 +02:00
Michael Friedrich 6397fedc3d Remove experimental redis feature before 2.7 release 2017-06-20 11:52:24 +02:00
Michael Friedrich f5d3428563 Notification Scripts: Ensure that mail from address works on Debian/RHEL/SUSE (mailutils vs mailx)
fixes #5299
2017-06-16 20:54:24 +02:00
Marianne Spiller 8f670fd96a notification_type mandatory
Make $notification_type$ mandatory in mail-service-notification, too.
2017-06-07 09:54:30 +02:00
Michael Friedrich 1e153f14d7 zones.conf: Add global-templates & director-global by default
This makes it easier for cluster and client setups with or
without the Icinga Director.

Note: Clients will still not receive synced configuration if
accept_config is not enabled (which is the default, and can be changed
during setup).

fixes #5106
2017-06-02 10:54:35 +02:00
Michael Friedrich 6cee5331ec DEPRECATE icinga2-classicui-config package and files
refs #5102
2017-05-29 20:32:40 +02:00
Michael Friedrich aa2408f2c7 Fix verbose mode in notifications scripts
Otherwise it just spams the syslog on frequent notifications

refs #5170
2017-05-24 14:36:52 +02:00
Michael Friedrich 52d986d02b Revert "Add LogstashWriter feature"
This reverts commit f5a971f5b0.

refs #4054
2017-05-23 12:05:01 +02:00
Michael Friedrich 4c7660190f Revert "Review LogstashWriter feature implementation"
This reverts commit bd5ff814f2.

refs #4054
2017-05-23 12:04:08 +02:00
Michael Friedrich 7b9f478bc1 Check for required parameters in notification scripts; add error helpers
refs #5170
2017-05-10 13:23:39 +02:00
Michael Friedrich 91ab8551c7 First review of notification script changes
refs #5170
2017-05-09 17:53:52 +02:00
Marianne M. Spiller 82a5c5a624 Add notification command parameters to the default mail notification script
Replace the previous notification scheme - now using getops in place of ENV
variables, giving the ability to integrate with the Icinga Director.

refs #5170

Signed-off-by: Michael Friedrich <michael.friedrich@icinga.com>
2017-05-09 17:53:52 +02:00
Michael Friedrich 3649a5a0d7 InfluxdbWriter: Use a work queue for async message processing; add stats log/api 2017-05-05 17:56:51 +02:00
Dirk Goetz 7608acd0e2 improve systemd service file 2017-04-04 09:27:19 +02:00
Michael Friedrich 8842aa9b0c Add network requirement to init script
fixes #4921
2017-03-30 18:47:04 +02:00
Michael Friedrich bd5ff814f2 Review LogstashWriter feature implementation
refs #4054
2017-03-20 14:30:03 +01:00
Kai Goller f5a971f5b0 Add LogstashWriter feature
This adds the UdpSocket class.

refs #4054
2017-03-20 14:30:03 +01:00
Michael Friedrich 3e98e3fb2c Better error handling and fixes
refs #4991
2017-03-14 15:18:39 +01:00
Gunnar Beutner 31650b0beb Add RedisWriter class
refs #4991
2017-02-09 16:40:11 +01: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 78cd56e277 Implement support for default templates
fixes #12575
2016-08-28 10:27:43 +02:00
Gunnar Beutner aba62ec0b3 Fix missing constants on Windows
refs #10722
2016-08-23 13:30:50 +02:00
Michael Friedrich 9a455f0c3d icinga2.conf: Include plugins-contrib, manubulon, windows-plugins, nscp by default
This helps a lot when configuring client checks as command endpoint
where the check command definitions are both used on the master
and the client.

fixes #10722
2016-08-16 11:17:29 +02:00
Dirk Goetz bc06ff18e5 Mute chcon during safe-reload
Removes the error message on systems with SELinux enabled but without icinga2 policy.

fixes #11648
2016-08-15 13:33:47 +02:00
Berthold Cogel 47726d7701 Init script: condrestart should only restart a running service
fixes #11650

Signed-off-by: Michael Friedrich <michael.friedrich@netways.de>
2016-08-08 17:55:11 +02:00
Gunnar Beutner 256d936661 Increase systemd startup timeout
fixes #12237
2016-07-27 07:44:11 +02:00
Gunnar Beutner 1c6c4859e1 Fix incorrect variable name in the hosts.conf example config for Windows
fixes #11894
2016-06-06 09:53:43 +02:00
Simon Murray 79c1e883d1 Add InfluxDB Writer
Adds an Icinga2 object to directly interface with InfluxDB's native HTTP API.
This supports optional basic authorization, and TLS transport.  InfluxDB didn't
appear to like having the TLS stream kept open, so instead this object buffers
data points which are then flushed to InfluxDB as a batch write, either driven
by a configurable timeout or threshold.

As InfluxDB is a schema-less database the host and service templates are user
configurable allowing both the measurement field and tags to be set by the
end user via macro expansion.  This allows access to tag fields from arbitrary
data associated with host.vars or service.vars.  If a particular value is
unable to be resolved, the tag will be dropped and not transmitted to InfluxDB.

Also alters URL handling to omit array brackets when only a single value is
attached to a key, otherwise InfluxDB has a strop with non-standard syntax.

fixes #10480

Signed-off-by: Michael Friedrich <michael.friedrich@netways.de>
2016-05-03 14:12:51 +02:00
Gunnar Beutner 327d12295c Implement support for upgrading NSIS-based installations
refs #11449
2016-04-01 08:42:58 +02:00
Louis Sautier 4970c459ee Re-add the 'su' directive to logrotate if supported
- try to detect a recent logrotate version which supports the 'su'
directive (added in 3.8.0, see
5be96cf182 (diff-e4eb329834da3d36278b1b7d943b3bc9R6))
- if logrotate can't be found, assume an old version is used
- allow the parameter to be forced by the user

fixes #9249

Signed-off-by: Gunnar Beutner <gunnar@beutner.name>
2016-03-29 14:59:06 +02:00
Lee Clemens 7bf012ca50 Reload logs after logrotate across distros
Signed-off-by: Jean Flach <jean-marcel.flach@netways.de>

fixes #10935
2016-01-21 10:12:43 +01:00
Lee Clemens 984eaf5a1f Add network.target to unit file
Icinga2 fails with 'Cannot bind TCP socket for host',
if other services requiring network.target are not installed.

Signed-off-by: Jean Flach <jean-marcel.flach@netways.de>

fixes #10968
2016-01-14 10:11:38 +01:00
Gunnar Beutner 599929b0f6 Update copyright headers for 2016 2016-01-12 08:29:59 +01:00
Daniil Yaroslavtsev d739675799 GelfWriter: Add additional fields for 'CHECK RESULT' events
fixes #9858
2015-12-18 11:05:38 +01:00
Dirk Goetz c7c3cceba8 Only execute chcon if selinux is enabled and use full context
fixes #10773
2015-12-07 10:13:40 +01:00
Michael Friedrich ef0f4ca4b4 Fix obsolete file installation
refs #10140
2015-11-26 20:02:17 +01:00
Michael Friedrich 9289971829 Remove IcingaStatusWriter feature
fixes #10140
2015-11-26 19:30:40 +01:00
Gunnar Beutner 9f44fadb65 Fix typo in prepare-dirs / safe-reload
fixes #10663
2015-11-18 20:18:04 +01:00
Gunnar Beutner 991bb0cd7e Don't use 'which' in the 'prepare-dirs' script
refs #10417
2015-11-06 17:43:08 +01:00
Gunnar Beutner 2a2da04af6 Fix: 'which' isn't available on minimal CentOS installs
fixes #10417
2015-10-21 14:41:48 +02:00
Michael Friedrich 84536da221 Implement global modified attributes for the IcingaApplication class
fixes #9859
2015-09-23 15:02:53 +02:00