mirror of https://github.com/Icinga/icinga2.git
a5fe44b81f
- 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 |
||
---|---|---|
.. | ||
Icinga2 | ||
conf | ||
Icinga2.pm | ||
README | ||
icinga2-conv.conf | ||
icinga2_convert_v1_v2.pl | ||
run_icinga2 |
README
ICINGA 2 CONVERSION SCRIPT FOR ICINGA 1.x CONFIGURATION ======================================================= This config conversion script provides support for basic Icinga 1.x configuration format conversion to native Icinga 2.x configuration syntax. It won't just compile all objects and drop them at once, but keep your existing 1.x template structure, only adding a new host->service link relation. The script will also detect the "attach service to hostgroup and put hosts as members" trick from 1.x and convert that into Icinga2's template system. Furthermore the old "service with contacts and notification commands" logic will be converted into Icinga2's logic with new notification objects, allowing to define notifications directly on the service definition then. Commands will be split by type (Check, Event, Notification) and relinked where possible. The host's check_command is dropped, and a possible service hostcheck looked up, if possible. Notifications will be built based on the service->contact relations, and escalations will also be merged into notifications, having times begin/end as additional attributes. Notification options will be converted into the new Icinga2 logic. Dependencies and Parents are resolved into host and service dependencies with many objects tricks as well. Timeperiods will be converted as is, because Icinga2's ITL provides the legacy-timeperiod template which supports that format for compatibility reasons. Custom attributes like custom variables, *_urls, etc will be collected into the custom dictionary, while possible macros are automagically converted into the macro dictionary (freely definable macros in Icinga 2.x). All required templates will be inherited from Icinga2's Template Library (ITL). RUN # ./icinga2_convert_v1_v2.pl -v -o conf/ HELP # ./icinga2_convert_v1_v2.pl -h TEST There's a small icinga2 conversion test config available, including conf/ folder. # ~/i2/sbin/icinga2 -c icinga2-conv.conf (or if icinga2 binary is located in $HOME/i2/sbin/icinga2, simply use run_icinga2) REQUIREMENTS - Perl: Data::Dumper File::Find Storable qw(dclone) Getopt::Long qw(:config no_ignore_case bundling) Pod::Usage - Icinga2 ITL DEBUG Compile Icinga2 with --enable-debug=yes and start it with -x. Alternatively, define the ConsoleLogger Object and set severity to "debug". local object ConsoleLogger "my-debug-log" { severity = "debug" } NOTES - Excludes (will be ignored in member lists) - Wildcards (* means all) - additive + to += logic (only for the current object, does not work with users) - Dependencies (host deps and parents are merged) - Commands will be split into Check|Event|Notification Commands - null (disable inheritance) only works non-converted values (not on contacts, commands, etc) being 0 - notification_options string w,u,f is converted to notification_{state,type}_filter = (StateFilterWarning | StateFilterUnknown | NotificationFilterFlapping) - service escalations are converted into notifications with times = begin/end begin = first_notification * notification_interval (now a time, not a counter) - custom variables, *_url, *image*, notes, 2d_coords will be collected and stashed into the "custom" dictionary similar to the macros dictionary. note: attributes starting with a number must be quoted. TODO - Dependency attributes: failure_criteria, inherits_parents, timeperiods - Flapping Thresholds: old vs new logic - some special object tricks, regex