Skip to content

Instantly share code, notes, and snippets.

@landervdb
Last active February 5, 2019 08:59
Show Gist options
  • Save landervdb/b9708cde8b022edbcbb363913c8831f0 to your computer and use it in GitHub Desktop.
Save landervdb/b9708cde8b022edbcbb363913c8831f0 to your computer and use it in GitHub Desktop.
Config used in CfgMgmtCamp 2019 Ignite
global:
resolve_timeout: 5m
route:
group_by: ['alertname']
group_wait: 10s
group_interval: 10s
repeat_interval: 1h
receiver: 'mail'
receivers:
- name: 'mail'
email_configs:
- to: devs@localhost.localdomain
from: prom@localhost.localdomain
smarthost: localhost:1025
require_tls: False
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"editable": true,
"gnetId": null,
"graphTooltip": 0,
"id": 2,
"iteration": 1549273030603,
"links": [],
"panels": [
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"fill": 1,
"gridPos": {
"h": 7,
"w": 12,
"x": 0,
"y": 0
},
"id": 2,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [
{
"alias": "/.*/",
"fill": 0,
"linewidth": 2
}
],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "jenkins:deploydelta:devuat{result=\"successful\",folder=\"$Pipeline\"}",
"format": "time_series",
"intervalFactor": 1,
"legendFormat": "UAT",
"refId": "A"
},
{
"expr": "jenkins:deploydelta:devprod{result=\"successful\",folder=\"$Pipeline\"}",
"format": "time_series",
"intervalFactor": 1,
"legendFormat": "PROD",
"refId": "B"
}
],
"thresholds": [
{
"colorMode": "critical",
"fill": true,
"line": true,
"op": "gt",
"value": 3,
"yaxis": "left"
}
],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Version Delta",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": false,
"colors": [
"#299c46",
"rgba(237, 129, 40, 0.89)",
"#d44a3a"
],
"format": "none",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"gridPos": {
"h": 7,
"w": 4,
"x": 12,
"y": 0
},
"id": 4,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"tableColumn": "",
"targets": [
{
"expr": "jenkins_custom_last_checkout_build_number{folder=\"$Pipeline\",jenkins_job=\"deploy-dev\",result=\"successful\"}",
"format": "time_series",
"instant": true,
"intervalFactor": 1,
"refId": "A"
}
],
"thresholds": "",
"title": "Current build in DEV",
"type": "singlestat",
"valueFontSize": "150%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "avg"
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": false,
"colors": [
"#299c46",
"rgba(237, 129, 40, 0.89)",
"#d44a3a"
],
"format": "none",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"gridPos": {
"h": 7,
"w": 4,
"x": 16,
"y": 0
},
"id": 5,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"tableColumn": "",
"targets": [
{
"expr": "jenkins_custom_last_checkout_build_number{folder=\"$Pipeline\",jenkins_job=\"deploy-uat\",result=\"successful\"}",
"format": "time_series",
"instant": true,
"intervalFactor": 1,
"refId": "A"
}
],
"thresholds": "",
"title": "Current build in UAT",
"type": "singlestat",
"valueFontSize": "150%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "avg"
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": false,
"colors": [
"#299c46",
"rgba(237, 129, 40, 0.89)",
"#d44a3a"
],
"format": "none",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"gridPos": {
"h": 7,
"w": 4,
"x": 20,
"y": 0
},
"id": 8,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"tableColumn": "",
"targets": [
{
"expr": "jenkins_custom_last_checkout_build_number{folder=\"$Pipeline\",jenkins_job=\"deploy-prod\",result=\"successful\"}",
"format": "time_series",
"instant": true,
"intervalFactor": 1,
"refId": "A"
}
],
"thresholds": "",
"title": "Current build in PROD",
"type": "singlestat",
"valueFontSize": "150%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "avg"
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"fill": 1,
"gridPos": {
"h": 7,
"w": 12,
"x": 0,
"y": 7
},
"id": 9,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [
{
"alias": "/.*/",
"fill": 0,
"linewidth": 2
},
{}
],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "jenkins:deploytimedelta:devuat{result=\"successful\",folder=\"$Pipeline\"}",
"format": "time_series",
"intervalFactor": 1,
"legendFormat": "UAT",
"refId": "A"
},
{
"expr": "jenkins:deploytimedelta:devprod{result=\"successful\",folder=\"$Pipeline\"}",
"format": "time_series",
"intervalFactor": 1,
"legendFormat": "PROD",
"refId": "B"
},
{
"expr": "300 ",
"format": "time_series",
"intervalFactor": 1,
"legendFormat": "Threshold",
"refId": "C"
}
],
"thresholds": [
{
"colorMode": "critical",
"fill": true,
"line": true,
"op": "gt",
"value": 300,
"yaxis": "left"
}
],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Version Time Delta",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "s",
"label": null,
"logBase": 1,
"max": null,
"min": "0",
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": false,
"colors": [
"#299c46",
"rgba(237, 129, 40, 0.89)",
"#d44a3a"
],
"format": "dateTimeAsUS",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"gridPos": {
"h": 7,
"w": 4,
"x": 12,
"y": 7
},
"id": 11,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"tableColumn": "",
"targets": [
{
"expr": "jenkins_last_build_timestamp_seconds{folder=\"$Pipeline\", result=\"successful\", jenkins_job=\"deploy-dev\"} * 1000",
"format": "time_series",
"instant": true,
"intervalFactor": 1,
"refId": "A"
}
],
"thresholds": "",
"title": "Last deploy to DEV",
"type": "singlestat",
"valueFontSize": "100%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "avg"
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": false,
"colors": [
"#299c46",
"rgba(237, 129, 40, 0.89)",
"#d44a3a"
],
"format": "dateTimeAsUS",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"gridPos": {
"h": 7,
"w": 4,
"x": 16,
"y": 7
},
"id": 18,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"tableColumn": "",
"targets": [
{
"expr": "jenkins_last_build_timestamp_seconds{folder=\"$Pipeline\", result=\"successful\", jenkins_job=\"deploy-dev\"} * 1000",
"format": "time_series",
"instant": true,
"intervalFactor": 1,
"refId": "A"
}
],
"thresholds": "",
"title": "Last deploy to DEV",
"type": "singlestat",
"valueFontSize": "100%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "avg"
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": false,
"colors": [
"#299c46",
"rgba(237, 129, 40, 0.89)",
"#d44a3a"
],
"format": "dateTimeAsUS",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"gridPos": {
"h": 7,
"w": 4,
"x": 20,
"y": 7
},
"id": 13,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"tableColumn": "",
"targets": [
{
"expr": "jenkins_last_build_timestamp_seconds{folder=\"$Pipeline\", result=\"successful\", jenkins_job=\"deploy-prod\"} * 1000",
"format": "time_series",
"instant": true,
"intervalFactor": 1,
"refId": "A"
}
],
"thresholds": "",
"title": "Last deploy to PROD",
"type": "singlestat",
"valueFontSize": "100%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "avg"
},
{
"columns": [],
"fontSize": "100%",
"gridPos": {
"h": 7,
"w": 12,
"x": 0,
"y": 14
},
"id": 17,
"links": [],
"pageSize": null,
"scroll": true,
"showHeader": true,
"sort": {
"col": 0,
"desc": true
},
"styles": [
{
"alias": "Time",
"dateFormat": "YYYY-MM-DD HH:mm:ss",
"pattern": "Time",
"type": "hidden"
},
{
"alias": "Alert",
"colorMode": null,
"colors": [
"rgba(245, 54, 54, 0.9)",
"rgba(237, 129, 40, 0.89)",
"rgba(50, 172, 45, 0.97)"
],
"dateFormat": "YYYY-MM-DD HH:mm:ss",
"decimals": 2,
"mappingType": 1,
"pattern": "alertname",
"thresholds": [],
"type": "number",
"unit": "short"
},
{
"alias": "",
"colorMode": null,
"colors": [
"rgba(245, 54, 54, 0.9)",
"rgba(237, 129, 40, 0.89)",
"rgba(50, 172, 45, 0.97)"
],
"dateFormat": "YYYY-MM-DD HH:mm:ss",
"decimals": 2,
"mappingType": 1,
"pattern": "/^(?!alertname).*$/",
"thresholds": [],
"type": "hidden",
"unit": "short"
},
{
"alias": "",
"colorMode": null,
"colors": [
"rgba(245, 54, 54, 0.9)",
"rgba(237, 129, 40, 0.89)",
"rgba(50, 172, 45, 0.97)"
],
"decimals": 2,
"pattern": "/.*/",
"thresholds": [],
"type": "number",
"unit": "short"
}
],
"targets": [
{
"expr": "ALERTS{folder=\"$Pipeline\"}",
"format": "table",
"instant": true,
"intervalFactor": 1,
"legendFormat": "{{ $labels.summary }}",
"refId": "A"
}
],
"title": "Current Alerts",
"transform": "table",
"type": "table"
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": false,
"colors": [
"#299c46",
"rgba(237, 129, 40, 0.89)",
"#d44a3a"
],
"format": "none",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"gridPos": {
"h": 7,
"w": 4,
"x": 12,
"y": 14
},
"id": 12,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"tableColumn": "",
"targets": [
{
"expr": "changes(jenkins_last_build_timestamp_seconds{folder=\"$Pipeline\", result=\"successful\", jenkins_job=\"deploy-dev\"}[24h])",
"format": "time_series",
"instant": true,
"intervalFactor": 1,
"refId": "A"
}
],
"thresholds": "",
"title": "Deploys to DEV in the last 24h",
"type": "singlestat",
"valueFontSize": "150%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "current"
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": false,
"colors": [
"#299c46",
"rgba(237, 129, 40, 0.89)",
"#d44a3a"
],
"format": "none",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"gridPos": {
"h": 7,
"w": 4,
"x": 16,
"y": 14
},
"id": 19,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"tableColumn": "",
"targets": [
{
"expr": "changes(jenkins_last_build_timestamp_seconds{folder=\"$Pipeline\", result=\"successful\", jenkins_job=\"deploy-uat\"}[24h])",
"format": "time_series",
"instant": true,
"intervalFactor": 1,
"refId": "A"
}
],
"thresholds": "",
"title": "Deploys to UAT in the last 24h",
"type": "singlestat",
"valueFontSize": "150%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "current"
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": false,
"colors": [
"#299c46",
"rgba(237, 129, 40, 0.89)",
"#d44a3a"
],
"format": "none",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"gridPos": {
"h": 7,
"w": 4,
"x": 20,
"y": 14
},
"id": 20,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"tableColumn": "",
"targets": [
{
"expr": "changes(jenkins_last_build_timestamp_seconds{folder=\"$Pipeline\", result=\"successful\", jenkins_job=\"deploy-prod\"}[24h])",
"format": "time_series",
"instant": true,
"intervalFactor": 1,
"refId": "A"
}
],
"thresholds": "",
"title": "Deploys to PROD in the last 24h",
"type": "singlestat",
"valueFontSize": "150%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "current"
}
],
"schemaVersion": 16,
"style": "dark",
"tags": [],
"templating": {
"list": [
{
"allValue": null,
"current": {
"tags": [],
"text": "pipelines/puppet",
"value": "pipelines/puppet"
},
"datasource": "Prometheus",
"definition": "label_values(folder)",
"hide": 0,
"includeAll": false,
"label": null,
"multi": false,
"name": "Pipeline",
"options": [
{
"selected": false,
"text": "pipelines/php",
"value": "pipelines/php"
},
{
"selected": true,
"text": "pipelines/puppet",
"value": "pipelines/puppet"
}
],
"query": "label_values(folder)",
"refresh": 0,
"regex": "/pipelines\\/.*/",
"skipUrlSync": false,
"sort": 0,
"tagValuesQuery": "",
"tags": [],
"tagsQuery": "",
"type": "query",
"useTags": false
}
]
},
"time": {
"from": "now-5m",
"to": "now"
},
"timepicker": {
"refresh_intervals": [
"5s",
"10s",
"30s",
"1m",
"5m",
"15m",
"30m",
"1h",
"2h",
"1d"
],
"time_options": [
"5m",
"15m",
"1h",
"6h",
"12h",
"24h",
"2d",
"7d",
"30d"
]
},
"timezone": "",
"title": "Jenkins Pipeline Dashboard",
"uid": "KXLRiUlmz",
"version": 8
}
folder("pipelines")
pipelines = ["puppet", "php"]
pipelines.each { pipeline ->
folder("pipelines/${pipeline}")
deliveryPipelineView("pipelines/${pipeline}/pipeline") {
pipelineInstances(5)
enableManualTriggers()
showAvatars()
showChangeLog()
allowPipelineStart()
pipelines {
component("${pipeline} pipeline", "pipelines/${pipeline}/checkout")
}
}
job("pipelines/${pipeline}/checkout") {
steps {
shell('echo "dummy"')
shell('echo "CHECKOUT_BUILD_NUMBER=$BUILD_NUMBER" > envs')
}
publishers {
downstreamParameterized {
trigger("pipelines/${pipeline}/validate") {
condition("SUCCESS")
parameters {
propertiesFile("envs")
}
}
}
}
}
job("pipelines/${pipeline}/validate") {
parameters {
stringParam("CHECKOUT_BUILD_NUMBER")
}
steps {
shell('echo "dummy"')
shell('echo "CHECKOUT_BUILD_NUMBER=$CHECKOUT_BUILD_NUMBER" > envs')
}
publishers {
downstreamParameterized {
trigger("pipelines/${pipeline}/build") {
condition("SUCCESS")
parameters {
propertiesFile("envs")
}
}
}
}
}
job("pipelines/${pipeline}/build") {
parameters {
stringParam("CHECKOUT_BUILD_NUMBER")
}
steps {
shell('echo "dummy"')
shell('echo "CHECKOUT_BUILD_NUMBER=$CHECKOUT_BUILD_NUMBER" > envs')
}
publishers {
downstreamParameterized {
trigger("pipelines/${pipeline}/deploy-dev") {
condition("SUCCESS")
parameters {
propertiesFile("envs")
}
}
}
}
}
job("pipelines/${pipeline}/deploy-dev") {
parameters {
stringParam("CHECKOUT_BUILD_NUMBER")
}
steps {
shell('echo "dummy"')
shell('echo "CHECKOUT_BUILD_NUMBER=$CHECKOUT_BUILD_NUMBER" > envs')
}
publishers {
buildPipelineTrigger("pipelines/${pipeline}/deploy-uat") {
parameters {
propertiesFile("envs")
}
}
}
}
job("pipelines/${pipeline}/deploy-uat") {
parameters {
stringParam("CHECKOUT_BUILD_NUMBER")
}
steps {
shell('echo "dummy"')
shell('echo "CHECKOUT_BUILD_NUMBER=$CHECKOUT_BUILD_NUMBER" > envs')
}
publishers {
buildPipelineTrigger("pipelines/${pipeline}/deploy-prod") {
parameters {
propertiesFile("envs")
}
}
}
}
job("pipelines/${pipeline}/deploy-prod") {
parameters {
stringParam("CHECKOUT_BUILD_NUMBER")
}
steps {
shell('echo "dummy"')
}
}
}
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
alerting:
alertmanagers:
- static_configs:
- targets:
- localhost:9093
rule_files:
- "/etc/prometheus/rules.yml"
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']
- job_name: 'jenkins'
static_configs:
- targets: ['localhost:9506']
groups:
- name: jenkins
rules:
- record: jenkins:deploydelta:devuat
expr: jenkins_custom_last_checkout_build_number{result="successful",jenkins_job="deploy-dev"} - ignoring(jenkins_job) jenkins_custom_last_checkout_build_number{result="successful",jenkins_job="deploy-uat"}
- record: jenkins:deploydelta:devprod
expr: jenkins_custom_last_checkout_build_number{result="successful",jenkins_job="deploy-dev"} - ignoring(jenkins_job) jenkins_custom_last_checkout_build_number{result="successful",jenkins_job="deploy-prod"}
- record: jenkins:deploytimedelta:devuat
expr: jenkins_last_build_timestamp_seconds{result="successful",jenkins_job="deploy-dev"} - ignoring(jenkins_job) jenkins_last_build_timestamp_seconds{result="successful",jenkins_job="deploy-uat"}
- record: jenkins:deploytimedelta:devprod
expr: jenkins_last_build_timestamp_seconds{result="successful",jenkins_job="deploy-dev"} - ignoring(jenkins_job) jenkins_last_build_timestamp_seconds{result="successful",jenkins_job="deploy-prod"}
- alert: LongTimeSinceDeployToUAT
expr: jenkins:deploytimedelta:devuat > 300
labels:
severity: warning
annotations:
summary: "The build for {{ $labels.folder }} on UAT is at least 5 minutes older than the one on DEV"
- alert: LongTimeSinceDeployToPROD
expr: jenkins:deploytimedelta:devprod > 300
labels:
severity: warning
annotations:
summary: "The build for {{ $labels.folder }} on PROD is at least 5 minutes older than the one on DEV"
- alert: BigVersionDifferenceUAT
expr: jenkins:deploydelta:devuat > 3
labels:
severity: warning
annotations:
summary: "The build for {{ $labels.folder }} on UAT is at least 3 versions older than the one on DEV"
- alert: BigVersionDifferencePROD
expr: jenkins:deploydelta:devprod > 3
labels:
severity: warning
annotations:
summary: "The build for {{ $labels.folder }} on PROD is at least 3 versions older than the one on DEV"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment