Skip to content

Commit

Permalink
Merge pull request #29 from theobori/master
Browse files Browse the repository at this point in the history
Add metric `nv_platform_vulnerability` (high and medium)
  • Loading branch information
becitsthere authored May 23, 2024
2 parents 519b33a + 2bc9a79 commit b6b3d59
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions nv_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,28 @@ def collect(self):
})
yield metric

# Get platform vulnerability
response = self.get('/v1/scan/platform/')
if response:
# Set vulnerability metrics
metric = Metric('nv_platform_vulnerability',
'platform vulnerability of ' + ep, 'gauge')
for platform in json.loads(response.text)['platforms']:
if (platform['high'] != 0 or platform['medium'] != 0):
metric.add_sample('nv_platform_vulnerabilityHigh',
value=platform['high'],
labels={
'name': platform['platform'],
'target': ep
})
metric.add_sample('nv_platform_vulnerabilityMedium',
value=platform['medium'],
labels={
'name': platform['platform'],
'target': ep
})
yield metric

# Get container vulnerability
response = self.get('/v1/workload?brief=true')
if response:
Expand Down

0 comments on commit b6b3d59

Please sign in to comment.