Skip to content

Commit

Permalink
add monitoring
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeni committed Nov 7, 2023
1 parent 3157e80 commit 163de44
Show file tree
Hide file tree
Showing 7 changed files with 67 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.0.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.3.3'
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,
}
}
36 changes: 36 additions & 0 deletions puppet/modules/profiles/manifests/monitoring/server.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
class profiles::monitoring::server (
Stdlib::Host $url = 'monitoring.theforeman.org',
Boolean $https = true,
){
ensure_packages(['make', 'gcc-c++'])

class { 'apache':
default_vhost => false,
}
-> class { 'zabbix':
zabbix_url => $url,
manage_resources => true,
apache_use_ssl => $https,
}
-> class { 'zabbix::agent':
server => '127.0.0.1',
}

if $https {
include apache::mod::md
}

$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 163de44

Please sign in to comment.