diff --git a/data/common/common.yaml b/data/common/common.yaml --- a/data/common/common.yaml +++ b/data/common/common.yaml @@ -2169,12 +2169,49 @@ sentry_dsn: "%{lookup('swh::deploy::webapp::sentry_dsn')}" keycloak: "%{alias('swh::deploy::webapp::config::keycloak')}" history_counters_url: "%{alias('swh::deploy::webapp::history_counters_url')}" - + swh::deploy::webapp::locked_endpoints: - /api/1/content/[^/]+/symbol/ - /api/1/entity/ - /api/1/provenance/ +swh::deploy::webapp::icinga_checks: + get: + counters: + uri: '/api/1/stat/counters/' + string: '"content":' + 'content end to end': + uri: '/browse/content/4dfc4478b1d5f7388b298fdfc06802485bdeae0c/' + string: 'PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2' + post: + content_known: + uri: '/api/1/content/known/search/' + post: 'q=8624bcdae55baeef00cd11d5dfcfa60f68710a02' + string: '"found":true' + regexp: + 'directory end to end': + uri: '/browse/directory/977fc4b98c0e85816348cebd3b12026407c368b6/' + regexp: + - 'Doc.*Grammar.*Include.*Lib.*Mac.*Misc.*Modules.*Objects.*PC.*PCbuild.*LICENSE.*README.rst' + 'revision end to end': + uri: '/browse/revision/f1b94134a4b879bc55c3dacdb496690c8ebdc03f/' + regexp: + - 'Allocate the output vlc pictures with dimensions padded,.*' + - 'as requested by the decoder \\\\(for alignments\\\\).' + 'revision log end to end': + uri: '/browse/revision/b9b0ecd1e2f9db10335383651f8317ed8cec8296/log/' + regexp: + - '/browse/revision/b9b0ecd1e2f9db10335383651f8317ed8cec8296/.*Roberto Di Cosmo.*Moved to github' + 'release end to end': + uri: '/browse/release/a9b7e3f1eada90250a6b2ab2ef3e0a846cb16831/' + regexp: + - 'Linux 4.9-rc8.*' + - '/revision/3e5de27e940d00d8d504dfb96625fb654f641509/' + 'snapshot end to end': + uri: '/browse/snapshot/baebc2109e4a2ec22a1129a3859647e191d04df4/branches/' + regexp: + - 'buster/main/4.13.13-1.*buster/main/4.14.12-2.*buster/main/4.14.13-1.*buster/main/4.14.17-1.*buster/main/4.15.4-1.*buster/main/4.9.65-3.*experimental/main/4.10~rc6-1~exp2.*jessie-backports/main/3.16.39-1.*jessie-backports/main/4.7.8-1~bpo8\\\\+1.*jessie-backports/main/4.9.18-1~bpo8\\\\+1.*jessie-backports/main/4.9.65-3\\\\+deb9u1~bpo8\\\\+1.*jessie-backports/main/4.9.65-3\\\\+deb9u2~bpo8\\\\+1.*jessie-kfreebsd/main/3.16.7-ckt9-2.*jessie-proposed-updates/main/3.16.51-3.*jessie-proposed-updates/main/3.16.51-3\\\\+deb8u1.*jessie-updates/main/3.16.51-3.*jessie/main/3.16.43-1.*jessie/main/3.16.51-2.*jessie/main/3.16.7-ckt2-1.*jessie/main/3.16.7-ckt20-1\\\\+deb8u3' + # local configuration for the scheduler swh::deploy::scheduler::config::local: &swh_scheduler_local_config scheduler: diff --git a/site-modules/profile/manifests/swh/deploy/webapp/icinga_checks.pp b/site-modules/profile/manifests/swh/deploy/webapp/icinga_checks.pp --- a/site-modules/profile/manifests/swh/deploy/webapp/icinga_checks.pp +++ b/site-modules/profile/manifests/swh/deploy/webapp/icinga_checks.pp @@ -2,87 +2,45 @@ $vhost_name = $::profile::swh::deploy::webapp::vhost_name $vhost_ssl_port = $::profile::swh::deploy::webapp::vhost_ssl_port $icinga_checks_file = lookup('icinga2::exported_checks::filename') + $icinga_checks = lookup('swh::deploy::webapp::icinga_checks') - $checks = { - 'counters' => { - http_uri => '/api/1/stat/counters/', - http_string => '"content":', - }, - 'content known' => { - http_uri => '/api/1/content/known/search/', - http_post => 'q=8624bcdae55baeef00cd11d5dfcfa60f68710a02', - http_string => '"found":true', - }, - 'content end to end' => { - http_uri => '/browse/content/4dfc4478b1d5f7388b298fdfc06802485bdeae0c/', - http_string => 'PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2', - }, - 'directory end to end' => { - http_uri => '/browse/directory/977fc4b98c0e85816348cebd3b12026407c368b6/', - http_linespan => true, - http_expect_body_regex => 'Doc.*Grammar.*Include.*Lib.*Mac.*Misc.*Modules.*Objects.*PC.*PCbuild.*LICENSE.*README.rst', - }, - 'revision end to end' => { - http_uri => '/browse/revision/f1b94134a4b879bc55c3dacdb496690c8ebdc03f/', - http_linespan => true, - http_expect_body_regex => join([ - '-:"Allocate the output vlc pictures with dimensions padded,.*', - 'as requested by the decoder \\\\(for alignments\\\\)."' - ]), - }, - 'revision log end to end' => { - http_uri => '/browse/revision/b9b0ecd1e2f9db10335383651f8317ed8cec8296/log/', - http_linespan => true, - http_expect_body_regex => join([ - '-:"', - join([ - '/browse/revision/b9b0ecd1e2f9db10335383651f8317ed8cec8296/', - 'Roberto Di Cosmo', - 'Moved to github', - ], '.*'), - '"', - ]), - }, - 'release end to end' => { - http_uri => '/browse/release/a9b7e3f1eada90250a6b2ab2ef3e0a846cb16831/', - http_linespan => true, - http_expect_body_regex => join([ - '-:"Linux 4.9-rc8.*', - '/revision/3e5de27e940d00d8d504dfb96625fb654f641509/"' - ]), - }, - 'snapshot end to end' => { - http_uri => '/browse/snapshot/baebc2109e4a2ec22a1129a3859647e191d04df4/branches/', - http_linespan => true, - http_expect_body_regex => join([ - '-:"', - join([ - 'buster/main/4.13.13-1', - 'buster/main/4.14.12-2', - 'buster/main/4.14.13-1', - 'buster/main/4.14.17-1', - 'buster/main/4.15.4-1', - 'buster/main/4.9.65-3', - 'experimental/main/4.10~rc6-1~exp2', - 'jessie-backports/main/3.16.39-1', - 'jessie-backports/main/4.7.8-1~bpo8\\\\+1', - 'jessie-backports/main/4.9.18-1~bpo8\\\\+1', - 'jessie-backports/main/4.9.65-3\\\\+deb9u1~bpo8\\\\+1', - 'jessie-backports/main/4.9.65-3\\\\+deb9u2~bpo8\\\\+1', - 'jessie-kfreebsd/main/3.16.7-ckt9-2', - 'jessie-proposed-updates/main/3.16.51-3', - 'jessie-proposed-updates/main/3.16.51-3\\\\+deb8u1', - 'jessie-updates/main/3.16.51-3', - 'jessie/main/3.16.43-1', - 'jessie/main/3.16.51-2', - 'jessie/main/3.16.7-ckt2-1', - 'jessie/main/3.16.7-ckt20-1\\\\+deb8u3', - ], '.*'), - '"', - ]), + # so far 3 types of icinga checks (get, post, and regexp). Walk through them and + # create the expected icinga checks out of those + + $checks_get = $icinga_checks['get'].map | $name, $entry | { + { + $name => { + http_uri => $entry['uri'], + http_string => $entry['string'], + } } } + $checks_post = $icinga_checks['post'].map | $name, $entry | { + { + $name => { + http_uri => $entry['uri'], + http_post => $entry['post'], + http_string => $entry['string'], + } + } + } + + $checks_regexp = $icinga_checks['regexp'].map | $name, $entry | { + { + $name => { + http_uri => $entry['uri'], + http_linespan => true, + http_expect_body_regex => join(['-:"'] + $entry['regexp'] + ['"']), + } + } + } + + # compulse checks as one dict + $checks = ($checks_get + $checks_post + $checks_regexp).reduce({}) |$acc, $entry| { + merge($acc, $entry) + } + each($checks) |$name, $args| { @@::icinga2::object::service {"swh-webapp ${name} ${::fqdn}": service_name => "swh webapp ${name}",