Created
November 11, 2014 12:41
-
-
Save stefanandres/9decb5728a204bf30d00 to your computer and use it in GitHub Desktop.
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
# copied from nova::rabbitmq | |
# | |
class sys11sensu::profile::rabbitmq( | |
$userid = hiera('sys11sensu::rabbitmq_user'), | |
$password = hiera('sys11sensu::rabbitmq_password'), | |
$port ='5672', | |
$virtual_host = hiera('sys11sensu::rabbitmq_vhost'), | |
$cluster_disk_nodes = false, | |
$enabled = true, | |
$rabbitmq_class = '::rabbitmq' | |
) { | |
if ($enabled) { | |
if $userid == 'guest' { | |
$delete_guest_user = false | |
} else { | |
$delete_guest_user = true | |
rabbitmq_user { $userid: | |
admin => true, | |
password => $password, | |
provider => 'rabbitmqctl', | |
require => Class[$rabbitmq_class], | |
} | |
# I need to figure out the appropriate permissions | |
rabbitmq_user_permissions { "${userid}@${virtual_host}": | |
configure_permission => '.*', | |
write_permission => '.*', | |
read_permission => '.*', | |
provider => 'rabbitmqctl', | |
}->Anchor<| title == 'nova-start' |> | |
} | |
$service_ensure = 'running' | |
} else { | |
$service_ensure = 'stopped' | |
} | |
if $cluster_disk_nodes { | |
class { $rabbitmq_class: | |
service_ensure => $service_ensure, | |
port => $port, | |
delete_guest_user => $delete_guest_user, | |
config_cluster => true, | |
cluster_disk_nodes => $cluster_disk_nodes, | |
wipe_db_on_cookie_change => true, | |
} | |
} else { | |
class { $rabbitmq_class: | |
service_ensure => $service_ensure, | |
port => $port, | |
delete_guest_user => $delete_guest_user, | |
} | |
} | |
if ($enabled) { | |
rabbitmq_vhost { $virtual_host: | |
provider => 'rabbitmqctl', | |
require => Class[$rabbitmq_class], | |
} | |
} | |
} |
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
class sys11sensu::profile::server( | |
$rabbitmq_host = hiera('sys11sensu::rabbitmq_host', undef), | |
$rabbitmq_user = hiera('sys11sensu::rabbitmq_user', undef), | |
$rabbitmq_password = hiera('sys11sensu::rabbitmq_password', undef), | |
$rabbitmq_vhost = hiera('sys11sensu::rabbitmq_vhost', undef), | |
$uchiwa_port = hiera('sys11sensu::uchiwa_port', 3001), | |
$uchiwa_version = hiera('sys11sensu::uchiwa_version', installed), | |
) { | |
include sys11sensu::profile::server::handlers | |
include sys11sensu::profile::server::checks | |
vcsrepo { "/opt/sensu-community-plugins": | |
ensure => present, | |
provider => git, | |
source => 'https://github.com/sensu/sensu-community-plugins.git', | |
} | |
class { '::sensu': | |
rabbitmq_password => $rabbitmq_password, | |
rabbitmq_user => $rabbitmq_user, | |
rabbitmq_vhost => $rabbitmq_vhost, | |
server => true, | |
api => true, | |
sensu_plugin_version => installed, | |
#safe_mode => false, | |
#plugins => [ | |
# 'puppet:///data/sensu/plugins/ntp.rb', | |
# 'puppet:///data/sensu/plugins/postfix.rb' | |
#] | |
} | |
#sensu::handler { 'default': | |
# command => 'mail -s \'sensu alert\' [email protected]', | |
#} | |
sensu::check { 'check_ntp': | |
command => 'PATH=$PATH:/usr/lib/nagios/plugins check_ntp_time -H pool.ntp.org -w 30 -c 60', | |
#handlers => 'default', | |
subscribers => 'ntp', | |
standalone => false, | |
} | |
# dashboard | |
#http://sensuapp.org/docs/latest/dashboards_uchiwa | |
package {'uchiwa': | |
ensure => $uchiwa_version, | |
} | |
if versioncmp($uchiwa_version, '0.2.0') > 0 { | |
# new .json for > 0.2 | |
file {'uchiwa.config': | |
ensure => file, | |
path => '/etc/sensu/uchiwa.json', | |
mode => 444, | |
content => template("$module_name/uchiwa.json.erb"), | |
notify => Service['uchiwa'], | |
} | |
} else { | |
file {'uchiwa.config': | |
ensure => file, | |
path => '/etc/sensu/uchiwa.js', | |
mode => 444, | |
content => template("$module_name/uchiwa.js.erb"), | |
notify => Service['uchiwa'], | |
} | |
} | |
service {'uchiwa': | |
ensure => running, | |
enable => true, | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment