Trivy exporter for Prometheus
367
This exporter is built on Python and uses Trivy as an entry point for Prometheus metrics.
It is suitable for scanning local Docker images (used in compose files or a Swarm cluster) as well as the host's local file system.
P.S. Please don't judge harshly — this is my first published image!
The first scan will start only after you access the
entry point.
Overall vulnerabilities summary:
http://<your_ip_or_localhost>:7175/metrics
Detailed vulnerabilities by package:
http://<your_ip_or_localhost>:7175/details
docker run:docker run --rm \
--name trivy-exporter \
-p 7175:7175 \
-v /var/run/docker.sock:/var/run/docker.sock \
crashbar/trivy-exporter:latest
docker-compose.yml:services:
trivy-exporter:
image: crashbar/trivy-exporter:latest
container_name: trivy-exporter
volumes:
- /var/run/docker.sock:/var/run/docker.sock
ports:
- "7175:7175"
metrics (curl 127.0.0.1:7175/metrics)# HELP trivy_vulnerabilities Detailed vulnerabilities by image, package and severity
# TYPE trivy_vulnerabilities gauge
trivy_vulnerabilities{image="trivy-trivy:latest",package="apt",installed="3.0.3",fixed="",severity="LOW"} 1
trivy_vulnerabilities{image="trivy-trivy:latest",package="apt-transport-https",installed="3.0.3",fixed="",severity="LOW"} 1
trivy_vulnerabilities{image="trivy-trivy:latest",package="bash",installed="5.2.37-2+b5",fixed="",severity="LOW"} 1
trivy_vulnerabilities{image="trivy-trivy:latest",package="bash-completion",installed="1:2.16.0-7",fixed="",severity="LOW"} 1
trivy_vulnerabilities{image="trivy-trivy:latest",package="bsdutils",installed="1:2.41-5",fixed="",severity="LOW"} 1
trivy_vulnerabilities{image="trivy-trivy:latest",package="coreutils",installed="9.7-3",fixed="",severity="LOW"} 2
trivy_vulnerabilities{image="trivy-trivy:latest",package="curl",installed="8.14.1-2",fixed="",severity="MEDIUM"} 2
trivy_vulnerabilities{image="trivy-trivy:latest",package="dirmngr",installed="2.4.7-21+b3",fixed="",severity="LOW"} 1
trivy_vulnerabilities{image="trivy-trivy:latest",package="docker-cli",installed="26.1.5+dfsg1-9+b9",fixed="",severity="MEDIUM"} 1
trivy_vulnerabilities{image="trivy-trivy:latest",package="docker.io",installed="26.1.5+dfsg1-9+b9",fixed="",severity="MEDIUM"} 1
trivy_vulnerabilities{image="trivy-trivy:latest",package="git",installed="1:2.47.3-0+deb13u1",fixed="",severity="LOW"} 3
trivy_vulnerabilities{image="trivy-trivy:latest",package="git-man",installed="1:2.47.3-0+deb13u1",fixed="",severity="LOW"} 3
trivy_vulnerabilities{image="trivy-trivy:latest",package="gnupg",installed="2.4.7-21",fixed="",severity="LOW"} 1
trivy_vulnerabilities{image="trivy-trivy:latest",package="gnupg-l10n",installed="2.4.7-21",fixed="",severity="LOW"} 1
trivy_vulnerabilities{image="trivy-trivy:latest",package="gnupg-utils",installed="2.4.7-21+b3",fixed="",severity="LOW"} 1
details (curl -H "Accept: application/json" 127.0.0.1:7175/details | jq .)"trivy-trivy:latest": {
"timestamp": "",
"vulnerabilities": [
{
"fixed": "",
"id": "CVE-2011-3374",
"installed": "3.0.3",
"pkg": "apt",
"severity": "LOW",
"title": "It was found that apt-key in apt, all versions, do not correctly valid ...",
"url": "https://avd.aquasec.com/nvd/cve-2011-3374"
},
{
"fixed": "",
"id": "CVE-2011-3374",
"installed": "3.0.3",
"pkg": "apt-transport-https",
"severity": "LOW",
"title": "It was found that apt-key in apt, all versions, do not correctly valid ...",
"url": "https://avd.aquasec.com/nvd/cve-2011-3374"
},
{
"fixed": "",
"id": "TEMP-0841856-B18BAF",
"installed": "5.2.37-2+b5",
"pkg": "bash",
"severity": "LOW",
"title": "[Privilege escalation possible to other user than root]",
"url": "https://security-tracker.debian.org/tracker/TEMP-0841856-B18BAF"
},
Content type
Image
Digest
sha256:c84373f18…
Size
327.3 MB
Last updated
11 months ago
docker pull crashbar/trivy-exporter