我正在尝试为Keycloak设置Prometheus导出器,但是遇到了困难。
我有一个使用docker容器构建的基于Web的应用程序,现在我通过使用keycloak添加用户权限
我在github https://github.com/aerogear/keycloak-metrics-spi上发现了这一点,但是我从未真正将这样的东西与Docker结合使用,所以我不确定我是否在自述文件中正确执行了这些步骤
请注意,我手动执行了以下所有步骤。
在此之后,基于github回购,我去了localhost / auth / realms / master / metrics,但是那里什么也没有。我是否要正确设置此设置?另外,有人知道其他任何出口商可能更适合使用docker设置吗?
谢谢
答案 0 :(得分:0)
文件需要进入以下文件夹:
/opt/jboss/keycloak/standalone/deployments
这是我的InSpec测试套件,用于验证提供程序的部署:
control 'keycloak-metrics-1' do
impact 0.6
title 'Metrics endpoint activation script'
desc 'The script should exist and be executable'
tag 'keycloak','prometheus','monitoring'
ref 'KeyCloak Metrics SPI README', url: 'https://github.com/aerogear/keycloak-metrics-spi'
describe file('/opt/jboss/startup-scripts/enable-prometheus-exporter.sh') do
it { should be_file }
it { should be_executable }
end
end
control 'keycloak-metrics-2' do
impact 1.0
title 'Metrics provider artifact'
desc 'The provider jar should exist and be deployed successfully'
tag 'keycloak','prometheus','monitoring'
ref 'KeyCloak Metrics SPI README', url: 'https://github.com/aerogear/keycloak-metrics-spi'
# e.g. keycloak-metrics-spi-1.0.1-SNAPSHOT.jar
describe command('ls /opt/jboss/keycloak/standalone/deployments/*.jar').stdout.chomp do
it { should match /keycloak-metrics-spi/ }
end
# e.g. keycloak-metrics-spi-1.0.1-SNAPSHOT.jar.deployed
describe command('ls /opt/jboss/keycloak/standalone/deployments/*.deployed').stdout.chomp do
it { should match /keycloak-metrics-spi/ }
end
end
control 'keycloak-metrics-3' do
impact 0.6
title 'Metrics endpoint'
desc 'The metrics endpoint returns expected data'
tag 'keycloak','prometheus','monitoring'
ref 'KeyCloak Metrics SPI README', url: 'https://github.com/aerogear/keycloak-metrics-spi'
describe http('http://localhost:8080/auth/realms/master/metrics') do
its('status') { should cmp 200 }
its('body') { should match /keycloak_user_event/ }
end
end