add jenkinsfile to prometheus

add graphana scraper to prometheus
This commit is contained in:
2018-11-03 09:05:48 -04:00
parent 41b35c8689
commit d9fab2b2d2
3 changed files with 42 additions and 1 deletions

View File

@@ -18,7 +18,7 @@ node('docker') {
dir(workdir) { dir(workdir) {
sh """ sh """
docker stack deploy -c docker-compose.yml jenkins docker stack deploy -c docker-compose.yml jenkins
docker service update jenkins_app docker service -q update jenkins_app
""" """
} }
} }

View File

@@ -0,0 +1,32 @@
node('docker') {
def service_name = 'metrics'
def app_name = 'prometheus'
def workdir = 'dockerfiles/services/prometheus'
stage('prepare') {
git credentialsId: 'f1f58215-c789-44a2-9b72-50e4425cb061', url: 'ssh://git@git.xai-corp.net:10022/xai-corp.net/provisioning.git'
sh 'ls'
}
stage('build') {
dir(workdir) {
sh "DOCKER_HOST=dkhost:2376 docker-compose -f docker-compose.yml pull"
}
}
stage('deploy') {
dir(workdir) {
sh """
docker stack deploy -c docker-compose.yml ${service_name}
docker service -q update ${service_name}_${app_name}
"""
}
}
stage('smoke tests') {
dir(workdir) {
sleep 60
sh "curl -If https://metrics.xai-corp.net/metrics"
}
}
}

View File

@@ -68,3 +68,12 @@ scrape_configs:
static_configs: static_configs:
- targets: - targets:
- 'jenkins.xai-corp.net' - 'jenkins.xai-corp.net'
- job_name: graphana
metrics_path: '/metrics'
scrape_interval: 60s
scrape_timeout: 9s
scheme: https
static_configs:
- targets:
- 'metrics.xai-corp.net'