From d6c58219d16d5c2f2874805e9dae911f7cdc3cc7 Mon Sep 17 00:00:00 2001 From: jcj Date: Fri, 6 Sep 2024 16:46:32 +0900 Subject: [PATCH] fix: modify yaml file for metric Signed-off-by: jcj --- src/plugin/metadata/prowler.yaml | 17 ++++++------ .../Prowler/Compliance/compliance_count.yaml | 9 +++++-- .../Prowler/Compliance/fail_check_count.yaml | 20 -------------- .../Prowler/Compliance/findings_count.yaml | 26 +++++++++++++++++++ .../metrics/Prowler/Compliance/namespace.yaml | 4 +-- 5 files changed, 43 insertions(+), 33 deletions(-) delete mode 100644 src/plugin/metrics/Prowler/Compliance/fail_check_count.yaml create mode 100644 src/plugin/metrics/Prowler/Compliance/findings_count.yaml diff --git a/src/plugin/metadata/prowler.yaml b/src/plugin/metadata/prowler.yaml index f6a1c0d..9c242a0 100644 --- a/src/plugin/metadata/prowler.yaml +++ b/src/plugin/metadata/prowler.yaml @@ -125,10 +125,11 @@ tabs.1: key: data.findings.status desc: false type: query-search-table + root_path: data.findings + unwind: data.findings fields: - - Requirement ID: data.requirement_id - - Check Title: data.findings.check_title - - Status: data.findings.status + - Check Title: check_title + - Status: status type: enum enums: - FAIL: coral.500 @@ -143,19 +144,17 @@ tabs.1: - MANUAL: peacock.500 label: MANUAL type: badge - - Resource Type: data.findings.resource_type - - Resource: data.findings.resource + - Resource Type: resource_type + - Resource: resource reference: reference_key: reference.resource_id resource_type: inventory.CloudService - - Region: data.findings.region_code + - Region: region_code reference: reference_key: region_code resource_type: inventory.Region - - Status Extended: data.findings.status_extended + - Status Extended: status_extended search: - - key: data.requirement_id - name: Requirement ID - key: data.findings.check_title name: Check Title - key: data.findings.status diff --git a/src/plugin/metrics/Prowler/Compliance/compliance_count.yaml b/src/plugin/metrics/Prowler/Compliance/compliance_count.yaml index 2895b8c..9c0e5c4 100644 --- a/src/plugin/metrics/Prowler/Compliance/compliance_count.yaml +++ b/src/plugin/metrics/Prowler/Compliance/compliance_count.yaml @@ -1,19 +1,24 @@ --- -metric_id: metric-prowler-compliance +metric_id: metric-prowler-compliance-count name: Compliance Count metric_type: GAUGE -resource_type: inventory.CloudService:aws.Prowler.CIS-2.0 +resource_type: inventory.CloudService query_options: fields: value: operator: count group_by: + - key: cloud_service_type + name: Compliance Framework - key: data.status name: Status - key: data.severity name: Severity - key: data.service name: Service + filter: + - key: cloud_service_group + value: Prowler unit: Count namespace_id: ns-prowler-compliance version: '1.0' \ No newline at end of file diff --git a/src/plugin/metrics/Prowler/Compliance/fail_check_count.yaml b/src/plugin/metrics/Prowler/Compliance/fail_check_count.yaml deleted file mode 100644 index 94b3b13..0000000 --- a/src/plugin/metrics/Prowler/Compliance/fail_check_count.yaml +++ /dev/null @@ -1,20 +0,0 @@ ---- -metric_id: metric-prowler-fail-check -name: Fail check Count -metric_type: GAUGE -resource_type: inventory.CloudService:aws.Prowler.CIS-2.0 -query_options: - fields: - value: - key: data.stats.checks.fail - operator: sum - group_by: - - key: data.status - name: Status - - key: data.severity - name: Severity - - key: data.service - name: Service -unit: Count -namespace_id: ns-prowler-compliance -version: '1.0' \ No newline at end of file diff --git a/src/plugin/metrics/Prowler/Compliance/findings_count.yaml b/src/plugin/metrics/Prowler/Compliance/findings_count.yaml new file mode 100644 index 0000000..ea45c3f --- /dev/null +++ b/src/plugin/metrics/Prowler/Compliance/findings_count.yaml @@ -0,0 +1,26 @@ +--- +metric_id: metric-prowler-findings-count +name: Findings Count +metric_type: GAUGE +resource_type: inventory.CloudService +query_options: + unwind: + path: data.findings + fields: + value: + operator: count + group_by: + - key: cloud_service_type + name: Compliance Framework + - key: data.findings.status + name: Status + - key: data.findings.region_code + name: Region + - key: data.findings.resource_type + name: Resource Type + filter: + - key: cloud_service_group + value: Prowler +unit: Count +namespace_id: ns-prowler-compliance +version: '1.0' \ No newline at end of file diff --git a/src/plugin/metrics/Prowler/Compliance/namespace.yaml b/src/plugin/metrics/Prowler/Compliance/namespace.yaml index bde8be4..685b2f5 100644 --- a/src/plugin/metrics/Prowler/Compliance/namespace.yaml +++ b/src/plugin/metrics/Prowler/Compliance/namespace.yaml @@ -2,7 +2,7 @@ namespace_id: ns-prowler-compliance name: Prowler/Compliance category: ASSET -resource_type: inventory.CloudService:aws.Prowler.CIS-2.0 -group: Prowler +resource_type: inventory.CloudService +group: prowler icon: 'https://spaceone-custom-assets.s3.ap-northeast-2.amazonaws.com/console-assets/icons/prowler.svg' version: '1.0' \ No newline at end of file