Skip to content

Commit

Permalink
add monitoring
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeni committed Nov 13, 2023
1 parent a4acb62 commit f101f6a
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 0 deletions.
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', '2.0.0'
mod 'puppet/selinux', '3.4.1'
mod 'puppet/systemd', '4.2.0'
mod 'puppet/unattended_upgrades', '8.1.0'
mod 'puppet/zabbix', :git => 'https://github.com/voxpupuli/puppet-zabbix', :branch => 'master'
mod 'puppetlabs/apache', '8.6.0'
mod 'puppetlabs/apt', '9.0.2'
mod 'puppetlabs/concat', '7.4.0'
Expand Down
4 changes: 4 additions & 0 deletions puppet/data/vagrant.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ profiles::jenkins::controller::jenkins_job_builder_username: "admin"
profiles::jenkins::node::swap_size_mb: 0

profiles::web::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',
) {
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,
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
}

0 comments on commit f101f6a

Please sign in to comment.