[icinga-checkins] icinga.org: puppet-icinga2/master: adding erb template for use with apply_notification_to_service define

git at icinga.org git at icinga.org
Mon Nov 17 06:37:40 CET 2014


Module: puppet-icinga2
Branch: master
Commit: ca1f1bbcc8c047a199a823ae0121a0414fa43e4b
URL:    https://git.icinga.org/?p=puppet-icinga2.git;a=commit;h=ca1f1bbcc8c047a199a823ae0121a0414fa43e4b

Author: Steven Bambling <smbambling at gmail.com>
Date:   Thu Nov 13 09:08:11 2014 -0500

adding erb template for use with apply_notification_to_service define

Signed-off-by: Nick Chappell <nick at intronic.org>

Merged this from: https://github.com/Icinga/puppet-icinga2/pull/44

refs#7677: https://dev.icinga.org/issues/7677

---

 .../object_apply_notification_to_service.conf.erb  |   67 ++++++++++++++++++++
 1 file changed, 67 insertions(+)

diff --git a/templates/object_apply_notification_to_service.conf.erb b/templates/object_apply_notification_to_service.conf.erb
new file mode 100644
index 0000000..3549d07
--- /dev/null
+++ b/templates/object_apply_notification_to_service.conf.erb
@@ -0,0 +1,67 @@
+/**
+ * WARNING: This service definition is automatically generated by Puppet.
+ * ANY MANUAL CHANGES TO IT WILL GET OVERWRITTEN!
+ */
+
+/**
+ * A object definition that applys notifications to hosts. You can create your
+ * own configuration files in the conf.d directory (e.g. one per host).
+ * By default all *.conf files in this directory are included.
+ *
+ */
+
+apply Notification "<%= @object_notificationname %>" to Service {
+  <%#- If any of the @ parameters are undefined, don't print anything for them: -%>
+  <%- if @notification_to_import -%>
+  <%#- Otherwise, include the parameter: -%>
+  import "<%= @notification_to_import %>"
+  <%- end -%>
+  <%- if @host_name -%>
+  host_name = "<%= @host_name %>"
+  <%- end -%>
+  <%- if @assign_where -%>
+  assign where <%= @assign_where %>
+  <%- end -%>
+  <%- if @ignore_where -%>
+  ignore where <%= @ignore_where %>
+  <%- end -%>
+  <%- if @command -%>
+  command = "<%= @command %>"
+  <%- end -%>
+  <%- if @vars.empty? != true -%>
+  <%- @vars.each_pair do |key,value| -%>
+  <%= key %> = <% if value.class == String %><%= value %>
+  <%- else -%>{
+    <%- value.each_pair do |k,v| -%>
+    <%= k %> = <%= v %>
+    <%- end -%>
+  }
+    <%- end -%>
+  <%- end -%>
+  <%- end -%>
+  <%- if @users.empty? !=true -%>
+  users = [ <% @users.each_with_index do |usr, i| %>"<%= usr -%>"<%= ', ' if i < (@users.size - 1) %><% end %> ]
+  <%- end -%>
+  <%- if @user_groups.empty? !=true -%>
+  user_groups = [ <% @user_groups.each_with_index do |u_grp, i| %>"<%= u_grp -%>"<%= ', ' if i < (@user_groups.size - 1) %><% end %> ]
+  <%- end -%>
+  <%- if @times.empty? != true -%>
+  times = {
+  <%- @times.each_pair do |key,value| -%>
+    <%= key %> = "<%= value %>"
+  <%- end -%>
+  }
+  <%- end -%>
+  <%- if @interval -%>
+  interval = "<%= @inteval -%>"
+  <%- end -%>
+  <%- if @period -%>
+  period = "<%= @period -%>"
+  <%- end -%>
+  <%- if @types.empty? !=true -%>
+  types = [ <% @types.each_with_index do |typ, i| %><%= typ -%><%= ', ' if i < (@types.size - 1) %><% end %> ]
+  <%- end -%>
+  <%- if @states.empty? !=true -%>
+  states = [ <% @states.each_with_index do |state, i| %><%= state -%><%= ', ' if i < (@states.size - 1) %><% end %> ]
+  <%- end -%>
+}



More information about the icinga-checkins mailing list