Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add monitoring #1960

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,14 @@ Vagrant.configure("2") do |config|
provider.vm.box_url = CENTOS_9_BOX_URL
end
end

config.vm.define "monitoring" do |override|
override.vm.hostname = "monitoring"
override.vm.box = "centos/stream9"

override.vm.provider "libvirt" do |libvirt, provider|
libvirt.memory = "2048"
provider.vm.box_url = CENTOS_9_BOX_URL
end
end
end
1 change: 1 addition & 0 deletions puppet/Puppetfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ mod 'puppet/rvm', '3.0.0'
mod 'puppet/selinux', '4.1.0'
mod 'puppet/systemd', '6.3.0'
mod 'puppet/unattended_upgrades', '8.1.0'
mod 'puppet/zabbix', :git => 'https://github.com/voxpupuli/puppet-zabbix', :branch => 'master'
mod 'puppetlabs/apache', '11.1.0'
mod 'puppetlabs/apt', '9.2.0'
mod 'puppetlabs/concat', '9.0.2'
Expand Down
4 changes: 4 additions & 0 deletions puppet/data/vagrant.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ profiles::jenkins::node::swap_size_mb: 0
profiles::web::https: false

redmine::https: false

profiles::monitoring::server::url: 127.0.0.1
profiles::monitoring::server::https: false
profiles::monitoring::client::server: 127.0.0.1
5 changes: 5 additions & 0 deletions puppet/manifests/site.pp
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,8 @@
include profiles::base
include profiles::web
}

node /^monitoring\d+\.([a-z]+\.)?theforeman\.org$/ {
include profiles::base
include profiles::monitoring::server
}
7 changes: 7 additions & 0 deletions puppet/modules/profiles/manifests/monitoring/client.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class profiles::monitoring::client (
Stdlib::Host $server = 'monitoring.theforeman.org',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should not expose this as a parameter but instead set zabbix::agent::server via Hiera. Then we can simply include profiles::monitoring::client in our base profile. Or even just include zabbix::agent in profiles::base.

If we then include profiles::monitoring::server before profiles::base the explicit server for the agent should work.

) {
class { 'zabbix::agent':
server => $server,
}
}
39 changes: 39 additions & 0 deletions puppet/modules/profiles/manifests/monitoring/server.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
class profiles::monitoring::server (
Stdlib::Host $url = 'monitoring.theforeman.org',
Boolean $https = true,
) {
if $https {
$apache_vhost_custom_params = {
mdomain => true,
}
} else {
$apache_vhost_custom_params = {}
}

class { 'zabbix::database': }
-> class { 'zabbix::server': }
-> class { 'zabbix::web':
zabbix_url => $url,
manage_resources => true,
apache_use_ssl => $https,
apache_vhost_custom_params => $apache_vhost_custom_params,
}

class { 'zabbix::agent':
server => '127.0.0.1',
}

$api_user = getvar('foreman_api_user')
$api_pass = getvar('foreman_api_password')
if $api_user and $api_pass {
$foreman_hosts = foreman::foreman('hosts', '', '20', lookup('foreman_url'), $api_user, $api_pass)
$foreman_hosts.each |$host| {
zabbix_host { $host['name']:
use_ip => false,
port => 10050,
ekohl marked this conversation as resolved.
Show resolved Hide resolved
groups => ['Linux servers'],
templates => ['Linux by Zabbix agent'],
}
}
}
}
4 changes: 4 additions & 0 deletions vagrant/manifests/default.pp
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@
node /^discourse.*/ {
include profiles::discourse
}

node /^monitoring.*/ {
include profiles::monitoring::server
}
Loading