Skip to content

Commit aef3951

Browse files
committed
Add monitor.pl metrics exporters to web servers
This implements everything except the http check, which I believe we are only using for fulcrum. Everything that can has a 1-second timeout, so slow services will be considered down.
1 parent 4ed832b commit aef3951

File tree

18 files changed

+402
-0
lines changed

18 files changed

+402
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Copyright (c) 2024 The Regents of the University of Michigan.
2+
# All Rights Reserved. Licensed according to the terms of the Revised
3+
# BSD License. See LICENSE.txt for details.
4+
5+
class nebula::profile::prometheus::exporter::webserver::base (
6+
Hash[String, Hash[String, String]] $mariadb_connect = {},
7+
Hash[String, Array[String]] $nfs_mounts = {},
8+
Hash[String, Array[String]] $solr_instances = {},
9+
Hash[String, Boolean] $check_shibd = {},
10+
String $target,
11+
) {
12+
include stdlib
13+
$target_mariadb = pick_default($mariadb_connect[$target], {})
14+
$target_nfs = pick_default($nfs_mounts[$target], [])
15+
$target_solr = pick_default($solr_instances[$target], [])
16+
$target_shibd = pick_default($check_shibd[$target], false)
17+
18+
file { "/usr/local/lib/prom_web_exporter/metrics":
19+
mode => "0755",
20+
content => template("nebula/profile/prometheus/exporter/webserver/metrics.sh.erb"),
21+
require => File["/usr/local/lib/prom_web_exporter"],
22+
}
23+
24+
file { "/usr/local/lib/prom_web_exporter":
25+
ensure => "directory",
26+
}
27+
28+
if $target_mariadb != {} {
29+
package { "mariadb-client": }
30+
}
31+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Copyright (c) 2024 The Regents of the University of Michigan.
2+
# All Rights Reserved. Licensed according to the terms of the Revised
3+
# BSD License. See LICENSE.txt for details.
4+
5+
class nebula::profile::prometheus::exporter::webserver::fulcrum {
6+
class { "nebula::profile::prometheus::exporter::webserver::base":
7+
target => "fulcrum"
8+
}
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Copyright (c) 2024 The Regents of the University of Michigan.
2+
# All Rights Reserved. Licensed according to the terms of the Revised
3+
# BSD License. See LICENSE.txt for details.
4+
5+
class nebula::profile::prometheus::exporter::webserver::hathitrust {
6+
class { "nebula::profile::prometheus::exporter::webserver::base":
7+
target => "hathitrust"
8+
}
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Copyright (c) 2024 The Regents of the University of Michigan.
2+
# All Rights Reserved. Licensed according to the terms of the Revised
3+
# BSD License. See LICENSE.txt for details.
4+
5+
class nebula::profile::prometheus::exporter::webserver::quod {
6+
class { "nebula::profile::prometheus::exporter::webserver::base":
7+
target => "quod"
8+
}
9+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright (c) 2024 The Regents of the University of Michigan.
2+
# All Rights Reserved. Licensed according to the terms of the Revised
3+
# BSD License. See LICENSE.txt for details.
4+
5+
class nebula::profile::prometheus::exporter::webserver::vhost (
6+
Boolean $testing = false
7+
) {
8+
if $testing {
9+
include apache
10+
}
11+
12+
apache::vhost { "prometheus-webserver-exporter":
13+
port => "9180",
14+
docroot => "/usr/local/lib/prom_web_exporter",
15+
aliases => [{ scriptalias => "/", path => "/usr/local/lib/prom_web_exporter/" }],
16+
rewrites => [{ rewrite_rule => ["^/$ /metrics [last,redirect=permanent]"]}],
17+
}
18+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Copyright (c) 2024 The Regents of the University of Michigan.
2+
# All Rights Reserved. Licensed according to the terms of the Revised
3+
# BSD License. See LICENSE.txt for details.
4+
5+
class nebula::profile::prometheus::exporter::webserver::www_lib {
6+
class { "nebula::profile::prometheus::exporter::webserver::base":
7+
target => "www_lib"
8+
}
9+
}

manifests/role/app_host/quod_dev.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,5 @@
1919
include nebula::profile::quod::dev::perl
2020
include nebula::profile::prometheus::exporter::mysql
2121
include nebula::profile::tesseract
22+
include nebula::profile::prometheus::exporter::webserver::quod
2223
}

manifests/role/app_host/quod_prod.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@
1717
include nebula::profile::quod::prod::perl
1818
include nebula::profile::quod::prod::haproxy
1919
include nebula::profile::networking::firewall::http
20+
include nebula::profile::prometheus::exporter::webserver::quod
2021
}

manifests/role/webhost/fulcrum_www_and_app.pp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,7 @@
6060
}
6161

6262
ensure_packages(['pigz'])
63+
64+
include nebula::profile::prometheus::exporter::webserver::vhost
65+
include nebula::profile::prometheus::exporter::webserver::fulcrum
6366
}

manifests/role/webhost/htvm.pp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,7 @@
3939

4040
# for HathiTrust deployment scripts
4141
package { 'rdist': }
42+
43+
include nebula::profile::prometheus::exporter::webserver::vhost
44+
include nebula::profile::prometheus::exporter::webserver::hathitrust
4245
}

0 commit comments

Comments
 (0)