-
-
Notifications
You must be signed in to change notification settings - Fork 269
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow to configure blocks with the same name
Change most data types from Hash to Array to allow multiple blocks with the same name. The key of each Hash is now the 'name' of each Struct. While here, add an usage example to the README.
- Loading branch information
Showing
10 changed files
with
118 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
<Plugin "threshold"> | ||
<%- $collectd::plugin::threshold::hosts.each |$name, $values| { -%> | ||
<%= collectd::indent(epp('collectd/plugin/threshold/host.epp', {name => $name, values => $values })) -%> | ||
<%- $collectd::plugin::threshold::hosts.each |$host| { -%> | ||
<%= collectd::indent(epp('collectd/plugin/threshold/host.epp', { host => $host })) -%> | ||
<%- } -%> | ||
<%- $collectd::plugin::threshold::plugins.each |$name, $values| { -%> | ||
<%= collectd::indent(epp('collectd/plugin/threshold/plugin.epp', {name => $name, values => $values })) -%> | ||
<%- $collectd::plugin::threshold::plugins.each |$plugin| { -%> | ||
<%= collectd::indent(epp('collectd/plugin/threshold/plugin.epp', { plugin => $plugin })) -%> | ||
<%- } -%> | ||
<%- $collectd::plugin::threshold::types.each |$name, $values| { -%> | ||
<%= collectd::indent(epp('collectd/plugin/threshold/type.epp', {name => $name, values => $values })) -%> | ||
<%- $collectd::plugin::threshold::types.each |$type| { -%> | ||
<%= collectd::indent(epp('collectd/plugin/threshold/type.epp', { type => $type })) -%> | ||
<%- } -%> | ||
</Plugin> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
<Host "<%= $name %>"> | ||
<%- $values['plugins'].each |$name, $values| { -%> | ||
<%= collectd::indent(epp('collectd/plugin/threshold/plugin.epp', {name => $name, values => $values })) -%> | ||
<Host "<%= $host['name'] %>"> | ||
<%- $host['plugins'].each |$plugin| { -%> | ||
<%= collectd::indent(epp('collectd/plugin/threshold/plugin.epp', { plugin => $plugin })) -%> | ||
<%- } -%> | ||
<%- $values['types'].each |$name, $values| { -%> | ||
<%= collectd::indent(epp('collectd/plugin/threshold/type.epp', {name => $name, values => $values })) -%> | ||
<%- $host['types'].each |$type| { -%> | ||
<%= collectd::indent(epp('collectd/plugin/threshold/type.epp', { type => $type })) -%> | ||
<%- } -%> | ||
</Host> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
<Plugin "<%= $name %>"> | ||
<%- if $values['instance'] != undef { -%> | ||
Instance "<%= $values['instance'] %>" | ||
<Plugin "<%= $plugin['name'] %>"> | ||
<%- if $plugin['instance'] != undef { -%> | ||
Instance "<%= $plugin['instance'] %>" | ||
<%- } -%> | ||
<%- $values['types'].each |$name, $values| { -%> | ||
<%= collectd::indent(epp('collectd/plugin/threshold/type.epp', {name => $name, values => $values })) -%> | ||
<%- $plugin['types'].each |$type| { -%> | ||
<%= collectd::indent(epp('collectd/plugin/threshold/type.epp', { type => $type })) -%> | ||
<%- } -%> | ||
</Plugin> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,41 @@ | ||
<Type "<%= $name %>"> | ||
<%- if $values['instance'] != undef { -%> | ||
Instance "<%= $values['instance'] %>" | ||
<Type "<%= $type['name'] %>"> | ||
<%- if $type['instance'] != undef { -%> | ||
Instance "<%= $type['instance'] %>" | ||
<%- } -%> | ||
<%- if $values['failure_max'] != undef { -%> | ||
FailureMax <%= $values['failure_max'] %> | ||
<%- if $type['failure_max'] != undef { -%> | ||
FailureMax <%= $type['failure_max'] %> | ||
<%- } -%> | ||
<%- if $values['failure_min'] != undef { -%> | ||
FailureMin <%= $values['failure_min'] %> | ||
<%- if $type['failure_min'] != undef { -%> | ||
FailureMin <%= $type['failure_min'] %> | ||
<%- } -%> | ||
<%- if $values['warning_max'] != undef { -%> | ||
WarningMax <%= $values['warning_max'] %> | ||
<%- if $type['warning_max'] != undef { -%> | ||
WarningMax <%= $type['warning_max'] %> | ||
<%- } -%> | ||
<%- if $values['warning_min'] != undef { -%> | ||
WarningMin <%= $values['warning_min'] %> | ||
<%- if $type['warning_min'] != undef { -%> | ||
WarningMin <%= $type['warning_min'] %> | ||
<%- } -%> | ||
<%- if $values['data_source'] != undef { -%> | ||
DataSource "<%= $values['data_source'] %>" | ||
<%- if $type['data_source'] != undef { -%> | ||
DataSource "<%= $type['data_source'] %>" | ||
<%- } -%> | ||
<%- if $values['invert'] != undef { -%> | ||
Invert <%= $values['invert'] %> | ||
<%- if $type['invert'] != undef { -%> | ||
Invert <%= $type['invert'] %> | ||
<%- } -%> | ||
<%- if $values['persist'] != undef { -%> | ||
Persist <%= $values['persist'] %> | ||
<%- if $type['persist'] != undef { -%> | ||
Persist <%= $type['persist'] %> | ||
<%- } -%> | ||
<%- if $values['persist_ok'] != undef { -%> | ||
PersistOK <%= $values['persist_ok'] %> | ||
<%- if $type['persist_ok'] != undef { -%> | ||
PersistOK <%= $type['persist_ok'] %> | ||
<%- } -%> | ||
<%- if $values['percentage'] != undef { -%> | ||
Percentage <%= $values['percentage'] %> | ||
<%- if $type['percentage'] != undef { -%> | ||
Percentage <%= $type['percentage'] %> | ||
<%- } -%> | ||
<%- if $values['hits'] != undef { -%> | ||
Hits <%= $values['hits'] %> | ||
<%- if $type['hits'] != undef { -%> | ||
Hits <%= $type['hits'] %> | ||
<%- } -%> | ||
<%- if $values['hysteresis'] != undef { -%> | ||
Hysteresis <%= $values['hysteresis'] %> | ||
<%- if $type['hysteresis'] != undef { -%> | ||
Hysteresis <%= $type['hysteresis'] %> | ||
<%- } -%> | ||
<%- if $values['interesting'] != undef { -%> | ||
Interesting <%= $values['interesting'] %> | ||
<%- if $type['interesting'] != undef { -%> | ||
Interesting <%= $type['interesting'] %> | ||
<%- } -%> | ||
</Type> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
type Collectd::Threshold::Host = Struct[{ | ||
plugins => Hash[String[1], Collectd::Threshold::Plugin], | ||
types => Hash[String[1], Collectd::Threshold::Type], | ||
name => String[1], | ||
plugins => Array[Collectd::Threshold::Plugin], | ||
types => Array[Collectd::Threshold::Type], | ||
}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
type Collectd::Threshold::Plugin = Struct[{ | ||
name => String[1], | ||
instance => Optional[String[1]], | ||
types => Hash[String[1], Collectd::Threshold::Type], | ||
types => Array[Collectd::Threshold::Type], | ||
}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters