31 Commits

Author SHA1 Message Date
Michael Friedrich
96e18e625f Config Conversion: Refactor hostcheck service as new object, add stats.
now the service template objects get the custom tmpl too.

refs #4715
2013-09-18 16:18:16 +02:00
Michael Friedrich
6a3c1ec7aa Config Conversion: Allow to define external global templates referenced by all objects.
tests:

$ ./icinga2_convert_v1_v2.pl -c /etc/icinga/icinga.cfg -o conf/
--hosttmpl="hostbumstitmpl"
--servicetmpl="servicebumstitmpl"
--usertmpl="userbumstitmpl"
--timeperiodtmpl="timeperiodbumstitmpl"
--notificationtmpl="notificationbumstitmpl"
--checkcommandtmpl="checkcommandbumstitmpl"
--eventcommandtmpl="eventcommandbumstitmpl"
--notificationcommandtmpl="notificationcommandbumstitmpl"

refs #4697
2013-09-18 11:42:16 +02:00
Michael Friedrich
1538579c66 Config Conversion: Detect hosts w/o services and properly add hostcheck.
it's ugly but it works. requires code refactoring.
2013-09-16 14:57:12 +02:00
Michael Friedrich
374b37077f Config Conversion: Add proper check_command detection in templates. 2013-09-16 14:05:41 +02:00
Gunnar Beutner
d38c8ab0bb config: Fix arguments for hostchecks. 2013-09-13 13:48:41 +02:00
Gunnar Beutner
de2a0aaea1 config: Fix attribute lookup functions. 2013-09-13 13:32:42 +02:00
Gunnar Beutner
e0d5e2bf93 config: Temporarily set hostname for services. 2013-09-13 13:05:55 +02:00
Gunnar Beutner
4fdab9e2ac config: Fix looking up host custom attributes. 2013-09-13 12:36:49 +02:00
Gunnar Beutner
2b97884201 config: Fix resolving macros in command arguments. 2013-09-13 12:32:38 +02:00
Michael Friedrich
cc1dbbca0b Config Conversion: Object macros start with name.
refs #4700
2013-09-12 20:24:13 +02:00
Michael Friedrich
a5fe44b81f Config Conversion: Treat command arg macros directly as object macros
- if detected, they will be replaced with their real name on the command
  line (instead of $ARGn$)
- if macro is resolvable, its value will be added to the macro
  dictionary
- if macro is not resolvable, it will be skipped and left for the core
  to resolve the macro on runtime.

caveat: getting host/service attributes requires lookups from the object
into the template tree, as well as host macros on services a search on
the host object itsself.

note: macro resolver is rudimentary implemented. there's space for more
detailed if-macro-name-is-then-return-attribute-abc. main problem are
the missing underscores in macro names, but not in attributes (what the
...?).

fixes #4700
2013-09-12 20:13:28 +02:00
Michael Friedrich
c9497367d2 Config Conversion: Make ADMIN/USER macros global again (in resource.conf)
refs #4701
2013-09-12 18:41:18 +02:00
Michael Friedrich
2e4a37b297 Config Conversion: s/user_macros/global_macros/g 2013-09-12 18:41:18 +02:00
Michael Friedrich
de4e2c6585 Config Conversion: Treat notification option 'r' as StateFilterOK. 2013-09-10 10:28:37 +02:00
Michael Friedrich
14c2e99e4b Config Conversion: fix missing Command macros, avoid duplicates 2013-08-30 17:50:05 +02:00
Michael Friedrich
7f0a210ff9 Config Conversion: support $USERn$ and $ADMINx$ macros in Notification|EventCommand 2013-08-30 17:50:05 +02:00
Michael Friedrich
1a3ecb04fb Config Conversion: Add ADMINPAGER|EMAIL as macros from icinga.cfg
and fix multiple user macros too. and add NotificationFilterCustom by
default.

fixes #4662
2013-08-30 15:58:58 +02:00
Michael Friedrich
42b98d2c89 Config Conversion: Detect user macros properly. 2013-08-29 14:59:46 +02:00
Michael Friedrich
de159b0133 Config Conversion: always add type NotificationFilterProblem. 2013-08-29 14:51:38 +02:00
Michael Friedrich
6b649b8d4c configconvert: lookup host check_command in template tree for hostcheck magic
requires recursive template tree lookup in order to create the new
service linked as hostcheck directly on the host object.

refs #2743
2013-07-02 13:03:29 +02:00
Michael Friedrich
2dc7cd20c8 configconvert: make host check_command a new service and link it as hostcheck
refs #2743
2013-07-02 13:03:29 +02:00
Michael Friedrich
f3ccb88bae configconvert: custom attr (CVs, *_url, notes, *image*, 2d_coords)
collect attributes
* notes
* icon_image
* icon_image_alt
* action_url
* notes_url
* statusmap_image
* 2d_coords
* _CVs
* !__I2CONVERT

and stash it onto the custom dictionary.

note: attribute names starting with a number need to be quoted.

fixes #3096
2013-06-26 16:01:22 +02:00
Michael Friedrich
18e3bdc581 configconvert: fix 'n' and 'a' notification_options (filter = 0, filter = ...)
refs #4060
2013-06-26 14:12:38 +02:00
Michael Friedrich
6586c6da2e configconvert: disable some debug leftovers
$ find -type f -name '*.pm' | xargs sed -i 's/[^#]say Dumper/ #say
Dumper/g'
2013-06-26 13:30:26 +02:00
Michael Friedrich
e7ab01aa6d configconvert: notification_options -> notification_{state,type}_filter
parsing the existing comma separated list and using some perl hash magic
to convert it to the new notification_type_filter and
notification_state_filter logic.

fixed missing file permission check on writing config files too.

fixes #4060
2013-06-26 13:22:15 +02:00
Michael Friedrich
6e186ac814 configconvert: remove trailing whitespaces 2013-06-26 09:23:01 +02:00
Michael Friedrich
bb2cbd044e configconvert: rename unique notification object identifier
refs #2743
2013-06-26 09:23:01 +02:00
Michael Friedrich
dae5ac8939 configconvert: serviceescalations with servicegroup_name
requires a new functionality to grab all service names by a given
servicegroup name. this only works after reprocessing all services with
their updated "servicegroups" attribute as array in the 2.x objects
hive.

after fetching the service names and their logical objects, it's quite
the same procedure as for the hostgroups and single
host_names/service_descriptions - for better reading, code remains
duplicated for now.

furthermore, escalation notification template objects are only added
based on the old contact->notification_command, and only a reference
template added when using within the service linking.

refs #4009
2013-06-26 09:23:01 +02:00
Michael Friedrich
97dd38051e configconvert: convert service escalation to notification escalation logic
- fixed bug with contactgroups in plain notifications
- fix bug with duplicated notifications (duplicate detection logic based
  on names, not template names)
- contacts may use templates too, and hide required values there
  (commands)
- added attribute getters which take templates into account (required
  for service -> notification_interval multiplied with service escalation
  first|last_notification too)
- apply the service escalation -> users -> commands as well as linking
  new notification with users, and services, defined either with
  * host_name/service_description
  * hostgroup_name/service_description
  * servicegroup_name (TODO)
- code duplication due to many nested loops with group wildcards

in short - we know why icinga 1.x takes ages to apply escalation.
because they look like added under pressure, and make no logical sense
compared to the rest. in short - they suck.

refs #4009
2013-06-26 09:23:01 +02:00
Michael Friedrich
a5355e63a3 configconvert: treat address* and other attributes directly as macros
also for user attributes.

fixes #4333
2013-06-24 17:03:34 +02:00
Michael Friedrich
8039aa1a08 configconvert: move to tools/
fixes #4337
2013-06-24 16:14:20 +02:00