Last active
November 29, 2019 01:00
-
-
Save albatrossflavour/3e3ae8096a279285c5c220a328268c67 to your computer and use it in GitHub Desktop.
VERY rough nagios profile that doesn't require a nagios module
This file contains hidden or 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
--- | |
profile::soe::monitoring::nagios::rules: | |
nagios_command: | |
process-service-perfdata: | |
ensure: present | |
command_line: '/usr/bin/printf "%b" "$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEATTEMPT$\t$SERVICESTATETYPE$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\n" >> /var/log/nagios/service-perfdata.out' | |
target: '/etc/nagios/objects/nagios_command.cfg' | |
profile::soe::monitoring::nagios::plugins: | |
- nagios-plugins-pgsql | |
- nagios-plugins-check-updates | |
- nagios-plugins-openmanage | |
- nagios-plugins-radius | |
- nagios-plugins-apt | |
- nagios-plugins | |
- nagios-plugins-breeze | |
- nagios-plugins-wave |
This file contains hidden or 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
# @summary | |
# A class to manage the nagios agents and config | |
# | |
# @example Basic usage | |
# include profile::soe::monitoring::nagios | |
# | |
class profile::soe::monitoring::nagios { | |
$nagios_rules = lookup('profile::soe::monitoring::nagios::rules',Hash,deep,{}) | |
$nagios_plugins = lookup('profile::soe::monitoring::nagios::plugins',Array,unique,[]) | |
$enable_firewall = lookup('profile::soe::enable_firewall',Boolean,first,true) | |
if $enable_firewall { | |
firewall { '020 nagios web server': | |
dport => '80', | |
proto => tcp, | |
action => accept, | |
} | |
} | |
package { 'nagios': | |
ensure => installed, | |
} | |
package { $nagios_plugins: | |
ensure => installed, | |
require => Package['nagios'], | |
} | |
service { 'nagios': | |
ensure => running, | |
enable => true, | |
require => Package['nagios'], | |
} | |
$nagios_rules.each | String $type, Hash $entries | { | |
$entries.each | String $name, Hash $options | { | |
nagios_command { $name: | |
* => $options, | |
notify => Service['nagios'], | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment