Skip to content

Commit

Permalink
Lookup variables in scope from templates.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonhattan committed Oct 26, 2015
1 parent 515300a commit f1b2bdc
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 49 deletions.
6 changes: 3 additions & 3 deletions templates/conf_file.erb
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,9 @@
## It is possible to include additional configuration parts from other files or
## directories.
#
# include <%= @conf_dir %>/*
# include <%= scope['monit::conf_dir'] %>/*
#
#
# Include all files from <%= @conf_dir %>/
include <%= @conf_dir %>/*
# Include all files from <%= scope['monit::conf_dir'] %>/
include <%= scope['monit::conf_dir'] %>/*

54 changes: 27 additions & 27 deletions templates/conf_file_overrides.erb
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
# Managed by Puppet.

set daemon <%= @check_interval %>
with start delay <%= @check_start_delay %>
set daemon <%= scope['monit::check_interval'] %>
with start delay <%= scope['monit::check_start_delay'] %>

set logfile <%= @logfile %>
<% if @mailserver %>
set mailserver <%= @mailserver %>
set logfile <%= scope['monit::logfile'] %>
<% if scope['monit::mailserver'] %>
set mailserver <%= scope['monit::mailserver'] %>
<% end -%>
<% if @eventqueue %>
<% if scope['monit::eventqueue'] %>
set eventqueue
basedir <%= @eventqueue_basedir %>
slots <%= @eventqueue_slots %>
basedir <%= scope['monit::eventqueue_basedir'] %>
slots <%= scope['monit::eventqueue_slots'] %>
<% end -%>
<% if @mmonit_url %>
set mmonit <%= @mmonit_url %>
<% if scope['monit::mmonit_url'] %>
set mmonit <%= scope['monit::mmonit_url'] %>
<% end -%>

set mail-format {
from: <%= @mailformat_from %>
<% if @mailformat_replyto -%>
reply-to: <%= @mailformat_replyto %>
from: <%= scope['monit::mailformat_from'] %>
<% if scope['monit::mailformat_replyto'] -%>
reply-to: <%= scope['monit::mailformat_replyto'] %>
<% end -%>
<% if @mailformat_subject -%>
subject: <%= @mailformat_subject %>
<% if scope['monit::mailformat_subject'] -%>
subject: <%= scope['monit::mailformat_subject'] %>
<% end -%>
<% if @mailformat_message -%>
message: <%= @mailformat_message %>
<% if scope['monit::mailformat_message'] -%>
message: <%= scope['monit::mailformat_message'] %>
<% end -%>
}
<% if @alerts -%>
<% if scope['monit::alerts'] -%>

<%- @alerts.each do |alert| -%>
<%- scope['monit::alerts'].each do |alert| -%>
set alert <%= alert %>
<%- end -%>
<% end %>
<% if @httpserver -%>
<% if scope['monit::httpserver'] -%>
set httpd
port <%= @httpserver_port %>
port <%= scope['monit::httpserver_port'] %>
signature disable
<%- if @httpserver_bind_address -%>
use address <%= @httpserver_bind_address %>
<%- if scope['monit::httpserver_bind_address'] -%>
use address <%= scope['monit::httpserver_bind_address'] %>
<%- end -%>
<%- if @httpserver_ssl and @httpserver_pemfile -%>
<%- if scope['monit::httpserver_ssl'] and scope['monit::httpserver_pemfile'] -%>
ssl enable
pemfile <%= @httpserver_pemfile %>
pemfile <%= scope['monit::httpserver_pemfile'] %>
<%- end -%>
<%- if @httpserver_allow -%>
<%- @httpserver_allow.each do |allow| -%>
<%- if scope['monit::httpserver_allow'] -%>
<%- scope['monit::httpserver_allow'].each do |allow| -%>
allow <%= allow %>
<%- end -%>
<%- end -%>
Expand Down
6 changes: 3 additions & 3 deletions templates/system_test_filesystems.erb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
<% @system_fs.each do |fs| %>
<% scope['monit::system_fs'].each do |fs| %>
fs_<%= fs %> :
path: <%= fs %>
tests:
- type: fsflags
- type: space
operator: '>'
value: <%= @system_fs_space_usage %>
value: <%= scope['monit::system_fs_space_usage'] %>
- type: inode
operator: '>'
value: <%= @system_fs_inode_usage %>
value: <%= scope['monit::system_fs_inode_usage'] %>
<% end %>
32 changes: 16 additions & 16 deletions templates/system_test_resources.erb
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
---
<% if @system_loadavg_1min %>
<% if scope['monit::system_loadavg_1min'] %>
- type : 'loadavg(1min)'
operator : '>'
value : <%= @system_loadavg_1min %>
value : <%= scope['monit::system_loadavg_1min'] %>
<% end %>
<% if @system_loadavg_5min %>
<% if scope['monit::system_loadavg_5min'] %>
- type : 'loadavg(5min)'
operator : '>'
value : <%= @system_loadavg_5min %>
value : <%= scope['monit::system_loadavg_5min'] %>
<% end %>
<% if @system_loadavg_15min %>
<% if scope['monit::system_loadavg_15min'] %>
- type : 'loadavg(15min)'
operator : '>'
value : <%= @system_loadavg_15min %>
value : <%= scope['monit::system_loadavg_15min'] %>
<% end %>
<% if @system_cpu_user %>
<% if scope['monit::system_cpu_user'] %>
- type : 'cpu(user)'
operator : '>'
value : <%= @system_cpu_user %>
value : <%= scope['monit::system_cpu_user'] %>
<% end %>
<% if @system_cpu_system %>
<% if scope['monit::system_cpu_system'] %>
- type : 'cpu(system)'
operator : '>'
value : <%= @system_cpu_system %>
value : <%= scope['monit::system_cpu_system'] %>
<% end %>
<% if @system_cpu_wait %>
<% if scope['monit::system_cpu_wait'] %>
- type : 'cpu(wait)'
operator : '>'
value : <%= @system_cpu_wait %>
value : <%= scope['monit::system_cpu_wait'] %>
<% end %>
<% if @system_memory %>
<% if scope['monit::system_memory'] %>
- type : 'memory'
operator : '>'
value : <%= @system_memory %>
value : <%= scope['monit::system_memory'] %>
<% end %>
<% if @system_swap %>
<% if scope['monit::system_swap'] %>
- type : 'swap'
operator : '>'
value : <%= @system_swap %>
value : <%= scope['monit::system_swap'] %>
<% end %>

0 comments on commit f1b2bdc

Please sign in to comment.