Skip to content

Instantly share code, notes, and snippets.

@schnatterer
Last active January 16, 2023 14:28
Show Gist options
  • Save schnatterer/a88a2d35436662cfb7d29dec6058c4d2 to your computer and use it in GitHub Desktop.
Save schnatterer/a88a2d35436662cfb7d29dec6058c4d2 to your computer and use it in GitHub Desktop.
Grafana Dashboard for Trivy Operator
{
"annotations": {
"list": [
{
"$$hashKey": "object:7",
"builtIn": 1,
"datasource": {
"type": "datasource",
"uid": "grafana"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"target": {
"limit": 100,
"matchAny": false,
"tags": [],
"type": "dashboard"
},
"type": "dashboard"
}
]
},
"description": "Dashboard for Trivy Operator",
"editable": true,
"fiscalYearStartMonth": 0,
"gnetId": 12331,
"graphTooltip": 0,
"id": 75,
"links": [],
"liveNow": false,
"panels": [
{
"datasource": {
"type": "prometheus",
"uid": "000000001"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [
{
"$$hashKey": "object:178",
"id": 0,
"op": "=",
"text": "N/A",
"type": 1,
"value": "null"
}
],
"max": 2,
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "dark-red",
"value": null
}
]
},
"unit": "none"
},
"overrides": []
},
"gridPos": {
"h": 5,
"w": 2,
"x": 0,
"y": 0
},
"id": 18,
"links": [],
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "horizontal",
"reduceOptions": {
"calcs": [
"first"
],
"fields": "",
"values": false
},
"textMode": "auto"
},
"pluginVersion": "9.2.5",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"dateTimeType": "DATETIME",
"editorMode": "code",
"expr": "sum(max(trivy_image_vulnerabilities{severity=\"Critical\"}) by (image_registry, image_repository, image_tag, image_digest, namespace ) ) ",
"format": "table",
"group": [
{
"params": [
"$__interval",
"none"
],
"type": "time"
}
],
"interval": "",
"intervalFactor": 1,
"legendFormat": "",
"metricColumn": "none",
"range": true,
"refId": "A",
"round": "0s",
"select": [
[
{
"params": [
"id"
],
"type": "column"
},
{
"params": [
"count"
],
"type": "aggregate"
},
{
"params": [
"id"
],
"type": "alias"
}
]
],
"table": "vulnerability",
"timeColumn": "create_date",
"timeColumnType": "timestamp",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
},
{
"datatype": "int4",
"name": "",
"params": [
"host_id",
"!=",
"None"
],
"type": "expression"
}
]
}
],
"title": "Critical",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
"uid": "000000001"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [
{
"$$hashKey": "object:135",
"id": 0,
"op": "=",
"text": "N/A",
"type": 1,
"value": "null"
}
],
"max": 100,
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "semi-dark-red",
"value": null
}
]
},
"unit": "none"
},
"overrides": []
},
"gridPos": {
"h": 5,
"w": 2,
"x": 2,
"y": 0
},
"id": 48,
"links": [],
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "horizontal",
"reduceOptions": {
"calcs": [
"mean"
],
"fields": "",
"values": false
},
"textMode": "auto"
},
"pluginVersion": "9.2.5",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "000000001"
},
"dateTimeType": "DATETIME",
"editorMode": "code",
"expr": "sum(max(trivy_image_vulnerabilities{severity=\"High\"}) by (image_registry, image_repository, image_tag, image_digest, namespace ))",
"format": "table",
"group": [
{
"params": [
"$__interval",
"none"
],
"type": "time"
}
],
"interval": "",
"intervalFactor": 1,
"legendFormat": "",
"metricColumn": "none",
"range": true,
"refId": "A",
"round": "0s",
"select": [
[
{
"params": [
"id"
],
"type": "column"
},
{
"params": [
"count"
],
"type": "aggregate"
},
{
"params": [
"id"
],
"type": "alias"
}
]
],
"table": "vulnerability",
"timeColumn": "create_date",
"timeColumnType": "timestamp",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
},
{
"datatype": "int4",
"name": "",
"params": [
"host_id",
"!=",
"None"
],
"type": "expression"
}
]
}
],
"title": "High",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
"uid": "000000001"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [
{
"$$hashKey": "object:221",
"id": 0,
"op": "=",
"text": "N/A",
"type": 1,
"value": "null"
}
],
"max": 100,
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "dark-orange",
"value": null
}
]
},
"unit": "none"
},
"overrides": []
},
"gridPos": {
"h": 5,
"w": 2,
"x": 4,
"y": 0
},
"id": 26,
"links": [],
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "horizontal",
"reduceOptions": {
"calcs": [
"mean"
],
"fields": "",
"values": false
},
"textMode": "auto"
},
"pluginVersion": "9.0.2",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "000000001"
},
"dateTimeType": "DATETIME",
"editorMode": "code",
"expr": "sum(max(trivy_image_vulnerabilities{severity=\"Medium\"}) by (image_registry, image_repository, image_tag, image_digest, namespace ))",
"format": "table",
"group": [
{
"params": [
"$__interval",
"none"
],
"type": "time"
}
],
"interval": "",
"intervalFactor": 1,
"legendFormat": "",
"metricColumn": "none",
"range": true,
"refId": "A",
"round": "0s",
"select": [
[
{
"params": [
"id"
],
"type": "column"
},
{
"params": [
"count"
],
"type": "aggregate"
},
{
"params": [
"id"
],
"type": "alias"
}
]
],
"table": "vulnerability",
"timeColumn": "create_date",
"timeColumnType": "timestamp",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
},
{
"datatype": "int4",
"name": "",
"params": [
"host_id",
"!=",
"None"
],
"type": "expression"
}
]
}
],
"title": "Medium",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
"uid": "000000001"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [
{
"$$hashKey": "object:264",
"id": 0,
"op": "=",
"text": "N/A",
"type": 1,
"value": "null"
}
],
"max": 100,
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "light-blue",
"value": null
}
]
},
"unit": "none"
},
"overrides": []
},
"gridPos": {
"h": 5,
"w": 2,
"x": 6,
"y": 0
},
"id": 20,
"links": [],
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "horizontal",
"reduceOptions": {
"calcs": [
"mean"
],
"fields": "",
"values": false
},
"textMode": "auto"
},
"pluginVersion": "9.0.2",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "000000001"
},
"dateTimeType": "DATETIME",
"editorMode": "code",
"expr": "sum(max(trivy_image_vulnerabilities{severity=\"Low\"}) by (image_registry, image_repository, image_tag, image_digest, namespace ))",
"format": "table",
"group": [
{
"params": [
"$__interval",
"none"
],
"type": "time"
}
],
"interval": "",
"intervalFactor": 1,
"legendFormat": "",
"metricColumn": "none",
"range": true,
"refId": "A",
"round": "0s",
"select": [
[
{
"params": [
"id"
],
"type": "column"
},
{
"params": [
"count"
],
"type": "aggregate"
},
{
"params": [
"id"
],
"type": "alias"
}
]
],
"table": "vulnerability",
"timeColumn": "create_date",
"timeColumnType": "timestamp",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
},
{
"datatype": "int4",
"name": "",
"params": [
"host_id",
"!=",
"None"
],
"type": "expression"
}
]
}
],
"title": "Low",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
"uid": "000000001"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [
{
"$$hashKey": "object:315",
"id": 0,
"op": "=",
"text": "N/A",
"type": 1,
"value": "null"
}
],
"max": 100,
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "light-purple",
"value": null
}
]
},
"unit": "none"
},
"overrides": []
},
"gridPos": {
"h": 5,
"w": 2,
"x": 8,
"y": 0
},
"id": 52,
"links": [],
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "horizontal",
"reduceOptions": {
"calcs": [
"mean"
],
"fields": "",
"values": false
},
"textMode": "auto"
},
"pluginVersion": "9.2.5",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "000000001"
},
"dateTimeType": "DATETIME",
"editorMode": "code",
"expr": "sum(max(trivy_image_vulnerabilities{severity=\"Unknown\"}) by (image_registry, image_repository, image_tag, image_digest, namespace ))",
"format": "table",
"group": [
{
"params": [
"$__interval",
"none"
],
"type": "time"
}
],
"interval": "",
"intervalFactor": 1,
"legendFormat": "",
"metricColumn": "none",
"range": true,
"refId": "A",
"round": "0s",
"select": [
[
{
"params": [
"id"
],
"type": "column"
},
{
"params": [
"count"
],
"type": "aggregate"
},
{
"params": [
"id"
],
"type": "alias"
}
]
],
"table": "vulnerability",
"timeColumn": "create_date",
"timeColumnType": "timestamp",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
},
{
"datatype": "int4",
"name": "",
"params": [
"host_id",
"!=",
"None"
],
"type": "expression"
}
]
}
],
"title": "Unkown",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
"uid": "000000001"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [
{
"$$hashKey": "object:315",
"id": 0,
"op": "=",
"text": "N/A",
"type": 1,
"value": "null"
}
],
"max": 100,
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "#ffffff",
"value": null
}
]
},
"unit": "none"
},
"overrides": []
},
"gridPos": {
"h": 5,
"w": 2,
"x": 10,
"y": 0
},
"id": 55,
"links": [],
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "/^Value$/",
"values": false
},
"textMode": "auto"
},
"pluginVersion": "9.2.5",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "000000001"
},
"dateTimeType": "DATETIME",
"editorMode": "code",
"expr": "sum(max(trivy_image_vulnerabilities{severity=\"Critical\"}) by (image_registry, image_repository, image_tag, image_digest, namespace ) + max(trivy_image_vulnerabilities{severity=\"High\"}) by (image_registry, image_repository, image_tag, image_digest, namespace ) + max(trivy_image_vulnerabilities{severity=\"Medium\"}) by (image_registry, image_repository, image_tag, image_digest, namespace ) + max(trivy_image_vulnerabilities{severity=\"Low\"}) by (image_registry, image_repository, image_tag, image_digest, namespace ) + max(trivy_image_vulnerabilities{severity=\"Unknown\"}) by (image_registry, image_repository, image_tag, image_digest, namespace ))",
"format": "table",
"group": [
{
"params": [
"$__interval",
"none"
],
"type": "time"
}
],
"interval": "",
"intervalFactor": 1,
"legendFormat": "",
"metricColumn": "none",
"range": true,
"refId": "A",
"round": "0s",
"select": [
[
{
"params": [
"id"
],
"type": "column"
},
{
"params": [
"count"
],
"type": "aggregate"
},
{
"params": [
"id"
],
"type": "alias"
}
]
],
"table": "vulnerability",
"timeColumn": "create_date",
"timeColumnType": "timestamp",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
},
{
"datatype": "int4",
"name": "",
"params": [
"host_id",
"!=",
"None"
],
"type": "expression"
}
]
}
],
"title": "Total",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
"uid": "000000001"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [
{
"$$hashKey": "object:315",
"id": 0,
"op": "=",
"text": "N/A",
"type": 1,
"value": "null"
}
],
"max": 100,
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "#ffffff",
"value": null
}
]
},
"unit": "none"
},
"overrides": []
},
"gridPos": {
"h": 5,
"w": 2,
"x": 13,
"y": 0
},
"id": 59,
"links": [],
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "/^Value$/",
"values": false
},
"textMode": "auto"
},
"pluginVersion": "9.2.5",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "000000001"
},
"dateTimeType": "DATETIME",
"editorMode": "code",
"expr": "count( sum( trivy_image_vulnerabilities) by (name) ) ",
"format": "table",
"formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
"group": [
{
"params": [
"$__interval",
"none"
],
"type": "time"
}
],
"interval": "",
"intervalFactor": 1,
"legendFormat": "",
"metricColumn": "none",
"query": "SELECT\n $timeSeries as t,\n count()\nFROM $table\nWHERE $timeFilter\nGROUP BY t\nORDER BY t",
"range": true,
"rawQuery": true,
"rawSql": "SELECT\n count(id) AS \"id\"\nFROM host",
"refId": "A",
"round": "0s",
"select": [
[
{
"params": [
"id"
],
"type": "column"
},
{
"params": [
"count"
],
"type": "aggregate"
},
{
"params": [
"id"
],
"type": "alias"
}
]
],
"table": "vulnerability",
"timeColumn": "create_date",
"timeColumnType": "timestamp",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
},
{
"datatype": "int4",
"name": "",
"params": [
"host_id",
"!=",
"None"
],
"type": "expression"
}
]
}
],
"title": "Vuln Reports",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
"uid": "000000001"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [
{
"$$hashKey": "object:315",
"id": 0,
"op": "=",
"text": "N/A",
"type": 1,
"value": "null"
}
],
"max": 100,
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "#ffffff",
"value": null
}
]
},
"unit": "none"
},
"overrides": []
},
"gridPos": {
"h": 5,
"w": 2,
"x": 15,
"y": 0
},
"id": 60,
"links": [],
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "/^Value$/",
"values": false
},
"textMode": "auto"
},
"pluginVersion": "9.2.5",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "000000001"
},
"dateTimeType": "DATETIME",
"editorMode": "code",
"expr": "sum(max(trivy_image_vulnerabilities{severity=\"Critical\"}) by (image_registry, image_repository, image_tag, image_digest, namespace ) + max(trivy_image_vulnerabilities{severity=\"High\"}) by (image_registry, image_repository, image_tag, image_digest, namespace ) + max(trivy_image_vulnerabilities{severity=\"Medium\"}) by (image_registry, image_repository, image_tag, image_digest, namespace ) + max(trivy_image_vulnerabilities{severity=\"Low\"}) by (image_registry, image_repository, image_tag, image_digest, namespace ) + max(trivy_image_vulnerabilities{severity=\"Unknown\"}) by (image_registry, image_repository, image_tag, image_digest, namespace )) \n/\ncount( sum( trivy_image_vulnerabilities) by (name) ) ",
"format": "table",
"formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
"group": [
{
"params": [
"$__interval",
"none"
],
"type": "time"
}
],
"interval": "",
"intervalFactor": 1,
"legendFormat": "",
"metricColumn": "none",
"query": "SELECT\n $timeSeries as t,\n count()\nFROM $table\nWHERE $timeFilter\nGROUP BY t\nORDER BY t",
"range": true,
"rawQuery": true,
"rawSql": "SELECT\n count(id) AS \"id\"\nFROM host",
"refId": "A",
"round": "0s",
"select": [
[
{
"params": [
"id"
],
"type": "column"
},
{
"params": [
"count"
],
"type": "aggregate"
},
{
"params": [
"id"
],
"type": "alias"
}
]
],
"table": "vulnerability",
"timeColumn": "create_date",
"timeColumnType": "timestamp",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
},
{
"datatype": "int4",
"name": "",
"params": [
"host_id",
"!=",
"None"
],
"type": "expression"
}
]
}
],
"title": "Avg CVEs/App",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
"uid": "000000001"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"align": "left",
"displayMode": "auto",
"filterable": true,
"inspect": false
},
"decimals": 0,
"displayName": "",
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "rgba(50, 172, 45, 0.97)",
"value": null
},
{
"color": "rgba(237, 129, 40, 0.89)"
}
]
},
"unit": "short"
},
"overrides": [
{
"matcher": {
"id": "byRegexp",
"options": "/severity/"
},
"properties": [
{
"id": "unit",
"value": "short"
},
{
"id": "custom.displayMode",
"value": "color-background"
},
{
"id": "custom.align"
}
]
},
{
"matcher": {
"id": "byName",
"options": "Value #A"
},
"properties": [
{
"id": "displayName",
"value": "Total vulns"
},
{
"id": "unit",
"value": "short"
},
{
"id": "custom.displayMode",
"value": "color-background"
},
{
"id": "custom.align"
},
{
"id": "thresholds",
"value": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "yellow",
"value": 1
}
]
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "Value #B"
},
"properties": [
{
"id": "displayName",
"value": "Critial Vulns"
},
{
"id": "unit",
"value": "short"
},
{
"id": "custom.displayMode",
"value": "color-background"
},
{
"id": "custom.align"
},
{
"id": "thresholds",
"value": {
"mode": "absolute",
"steps": [
{
"color": "#73BF69",
"value": null
},
{
"color": "red",
"value": 1
}
]
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "Value #C"
},
"properties": [
{
"id": "displayName",
"value": "High Vulns"
},
{
"id": "unit",
"value": "short"
},
{
"id": "custom.displayMode",
"value": "color-background"
},
{
"id": "custom.align"
},
{
"id": "thresholds",
"value": {
"mode": "absolute",
"steps": [
{
"color": "#73BF69",
"value": null
},
{
"color": "orange",
"value": 1
}
]
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "image"
},
"properties": [
{
"id": "unit",
"value": "short"
},
{
"id": "decimals",
"value": 2
},
{
"id": "links",
"value": [
{
"targetBlank": false,
"title": "Drill down",
"url": "/d/VTc2usgGz/trivy-vulneribilities-image-overview?orgId=1&var-image=$__cell"
}
]
},
{
"id": "custom.align"
}
]
},
{
"matcher": {
"id": "byName",
"options": "image_repository"
},
"properties": [
{
"id": "custom.width",
"value": 240
}
]
},
{
"matcher": {
"id": "byName",
"options": "Repository"
},
"properties": [
{
"id": "custom.width",
"value": 284
}
]
},
{
"matcher": {
"id": "byName",
"options": "Digest"
},
"properties": [
{
"id": "custom.width",
"value": 101
}
]
},
{
"matcher": {
"id": "byName",
"options": "Critial Vulns"
},
"properties": [
{
"id": "custom.width",
"value": 110
}
]
},
{
"matcher": {
"id": "byName",
"options": "High Vulns"
},
"properties": [
{
"id": "custom.width",
"value": 105
}
]
},
{
"matcher": {
"id": "byName",
"options": "Total vulns"
},
"properties": [
{
"id": "custom.width",
"value": 113
}
]
},
{
"matcher": {
"id": "byName",
"options": "Namespace"
},
"properties": [
{
"id": "custom.width",
"value": 119
}
]
},
{
"matcher": {
"id": "byName",
"options": "Registry"
},
"properties": [
{
"id": "custom.width",
"value": 142
}
]
},
{
"matcher": {
"id": "byName",
"options": "Tag"
},
"properties": [
{
"id": "custom.width",
"value": 231
}
]
}
]
},
"gridPos": {
"h": 40,
"w": 17,
"x": 0,
"y": 5
},
"id": 54,
"options": {
"footer": {
"enablePagination": false,
"fields": "",
"reducer": [
"sum"
],
"show": true
},
"frameIndex": 0,
"showHeader": true,
"sortBy": [
{
"desc": true,
"displayName": "Critial Vulns"
}
]
},
"pluginVersion": "9.2.5",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "000000001"
},
"editorMode": "code",
"expr": "max(trivy_image_vulnerabilities{severity=\"Critical\"}) by (image_registry, image_repository, image_tag, image_digest, namespace ) ",
"format": "table",
"instant": true,
"interval": "",
"legendFormat": "Critical",
"refId": "B"
},
{
"datasource": {
"type": "prometheus",
"uid": "000000001"
},
"editorMode": "code",
"exemplar": false,
"expr": "max(trivy_image_vulnerabilities{severity=\"High\"}) by (image_registry, image_repository, image_tag, image_digest, namespace ) ",
"format": "table",
"instant": true,
"interval": "",
"legendFormat": "High",
"range": false,
"refId": "C"
},
{
"datasource": {
"type": "prometheus",
"uid": "000000001"
},
"editorMode": "code",
"expr": "max(trivy_image_vulnerabilities{severity=\"Critical\"}) by (image_registry, image_repository, image_tag, image_digest, namespace ) + max(trivy_image_vulnerabilities{severity=\"High\"}) by (image_registry, image_repository, image_tag, image_digest, namespace ) + max(trivy_image_vulnerabilities{severity=\"Medium\"}) by (image_registry, image_repository, image_tag, image_digest, namespace ) + max(trivy_image_vulnerabilities{severity=\"Low\"}) by (image_registry, image_repository, image_tag, image_digest, namespace ) + max(trivy_image_vulnerabilities{severity=\"Unknown\"}) by (image_registry, image_repository, image_tag,image_digest, namespace ) ",
"format": "table",
"instant": true,
"interval": "",
"legendFormat": "Total",
"refId": "A"
}
],
"title": "Image Vulnerabilities",
"transformations": [
{
"id": "merge",
"options": {}
},
{
"id": "organize",
"options": {
"excludeByName": {
"Time": true,
"Value #B": false
},
"indexByName": {
"Time": 0,
"Value #A": 8,
"Value #B": 6,
"Value #C": 7,
"image_digest": 5,
"image_registry": 1,
"image_repository": 2,
"image_tag": 4,
"namespace": 3
},
"renameByName": {
"Value #A": "",
"Value #B": "a",
"Value #C": "b",
"image_digest": "Digest",
"image_registry": "Registry",
"image_repository": "Repository",
"image_tag": "Tag",
"namespace": "Namespace"
}
}
}
],
"type": "table"
},
{
"datasource": {
"type": "prometheus",
"uid": "000000001"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic",
"seriesBy": "last"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Critical"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "dark-red",
"mode": "fixed"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "High"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "red",
"mode": "fixed"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "Low"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "super-light-blue",
"mode": "fixed"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "Unknown"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "super-light-purple",
"mode": "fixed"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "Total"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "#ffffff",
"mode": "fixed"
}
}
]
}
]
},
"gridPos": {
"h": 7,
"w": 9,
"x": 0,
"y": 45
},
"id": 57,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "000000001"
},
"editorMode": "code",
"exemplar": false,
"expr": "avg_over_time(sum(max(trivy_image_vulnerabilities{severity=\"Critical\"}) by (image_registry, image_repository, image_tag, image_digest, namespace ) + max(trivy_image_vulnerabilities{severity=\"High\"}) by (image_registry, image_repository, image_tag, image_digest, namespace ) + max(trivy_image_vulnerabilities{severity=\"Medium\"}) by (image_registry, image_repository, image_tag, image_digest, namespace ) + max(trivy_image_vulnerabilities{severity=\"Low\"}) by (image_registry, image_repository, image_tag, image_digest, namespace ) + max(trivy_image_vulnerabilities{severity=\"Unknown\"}) by (image_registry, image_repository, image_tag, image_digest, namespace ))[1d:1d])",
"format": "time_series",
"instant": false,
"legendFormat": "Total",
"range": true,
"refId": "A"
},
{
"datasource": {
"type": "prometheus",
"uid": "000000001"
},
"editorMode": "code",
"expr": "avg_over_time(sum(max(trivy_image_vulnerabilities{severity=\"Critical\"}) by (image_registry, image_repository, image_tag, image_digest, namespace ) )[1d:1d])",
"hide": false,
"legendFormat": "Critical",
"range": true,
"refId": "B"
},
{
"datasource": {
"type": "prometheus",
"uid": "000000001"
},
"editorMode": "code",
"expr": "avg_over_time(sum(max(trivy_image_vulnerabilities{severity=\"High\"}) by (image_registry, image_repository, image_tag, image_digest, namespace ))[1d:1d])",
"hide": false,
"legendFormat": "High",
"range": true,
"refId": "C"
},
{
"datasource": {
"type": "prometheus",
"uid": "000000001"
},
"editorMode": "code",
"expr": "avg_over_time(sum(max(trivy_image_vulnerabilities{severity=\"Medium\"}) by (image_registry, image_repository, image_tag, image_digest, namespace ))[1d:1d])",
"hide": false,
"legendFormat": "Medium",
"range": true,
"refId": "D"
},
{
"datasource": {
"type": "prometheus",
"uid": "000000001"
},
"editorMode": "code",
"expr": "avg_over_time(sum(max(trivy_image_vulnerabilities{severity=\"Low\"}) by (image_registry, image_repository, image_tag, image_digest, namespace ))[1d:1d])",
"hide": false,
"legendFormat": "Low",
"range": true,
"refId": "E"
},
{
"datasource": {
"type": "prometheus",
"uid": "000000001"
},
"editorMode": "code",
"expr": "max_over_time(sum(max(trivy_image_vulnerabilities{severity=\"Unknown\"}) by (image_registry, image_repository, image_tag, image_digest, namespace ))[1d:1d])",
"hide": false,
"legendFormat": "Unknown",
"range": true,
"refId": "F"
}
],
"title": "Avg CVEs over time",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "000000001"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic",
"seriesBy": "last"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Critical"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "dark-red",
"mode": "fixed"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "High"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "red",
"mode": "fixed"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "Low"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "super-light-blue",
"mode": "fixed"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "Unknown"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "super-light-purple",
"mode": "fixed"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "Total"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "#ffffff",
"mode": "fixed"
}
}
]
}
]
},
"gridPos": {
"h": 7,
"w": 4,
"x": 9,
"y": 45
},
"id": 58,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "000000001"
},
"editorMode": "code",
"exemplar": false,
"expr": "avg_over_time(count( sum( trivy_image_vulnerabilities) by (name) )[1d:1d])",
"format": "time_series",
"instant": false,
"legendFormat": "Reports",
"range": true,
"refId": "A"
}
],
"title": "Avg Vuln reports over time",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "000000001"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic",
"seriesBy": "last"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Critical"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "dark-red",
"mode": "fixed"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "High"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "red",
"mode": "fixed"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "Low"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "super-light-blue",
"mode": "fixed"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "Unknown"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "super-light-purple",
"mode": "fixed"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "Total"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "#ffffff",
"mode": "fixed"
}
}
]
}
]
},
"gridPos": {
"h": 7,
"w": 4,
"x": 13,
"y": 45
},
"id": 61,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "000000001"
},
"editorMode": "code",
"exemplar": false,
"expr": "avg_over_time(sum(max(trivy_image_vulnerabilities{severity=\"Critical\"}) by (image_registry, image_repository, image_tag, image_digest, namespace ) + max(trivy_image_vulnerabilities{severity=\"High\"}) by (image_registry, image_repository, image_tag, image_digest, namespace ) + max(trivy_image_vulnerabilities{severity=\"Medium\"}) by (image_registry, image_repository, image_tag, image_digest, namespace ) + max(trivy_image_vulnerabilities{severity=\"Low\"}) by (image_registry, image_repository, image_tag, image_digest, namespace ) + max(trivy_image_vulnerabilities{severity=\"Unknown\"}) by (image_registry, image_repository, image_tag, image_digest, namespace ))[1d:1d])\n/\navg_over_time(count( sum( trivy_image_vulnerabilities) by (name) )[1d:1d])",
"format": "time_series",
"instant": false,
"legendFormat": "CVEs",
"range": true,
"refId": "A"
}
],
"title": "Avg CVEs/App over time",
"type": "timeseries"
}
],
"refresh": "15m",
"schemaVersion": 37,
"style": "dark",
"tags": [],
"templating": {
"list": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"filters": [],
"hide": 0,
"name": "Filters",
"skipUrlSync": false,
"type": "adhoc"
}
]
},
"time": {
"from": "now-7d",
"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": "Trivy Vulnerabilities",
"uid": "BQnjzl-jz",
"version": 12,
"weekStart": ""
}
@schnatterer
Copy link
Author

See Cloudogu Community for details.

Contributions welcome!

Known issues:

  • After using the dashboard for some months we recognize that the values fluctuate a lot with the number of vuln reports. How to smooth them out?
  • Implement as mixin see also aquasecurity/trivy-operator#193

Maybe this more official dashboard might be a valid alternative: https://grafana.com/grafana/dashboards/17813-trivy-operator-dashboard/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment