โญ Repository โ ๐ Compliance Engine โ ๐ CloudAware โ ๐ Google โ ๐ GCE โ ๐ก๏ธ Instance is idle๐ข
๐ง Google GCE Instance is idle - prod.logic.yaml๐ข
- Contextual name: ๐ง prod.logic.yaml๐ข
- ID:
/ce/ca/google/compute-engine/instance-idle/prod.logic.yaml
- Tags:
- ๐ข Logic test success
- ๐ข Logic with extracts
- ๐ข Logic with test data
Usesโ
Test Results ๐ขโ
Generated at: 2025-10-01T12:50:05.549342603Z Open
Result | Id | Condition Index | Condition Text | Runtime Error |
---|---|---|---|---|
๐ข | test1 | โ๏ธ 99 | โ๏ธ isDisappeared(CA10__disappearanceTime__c) | โ๏ธ null |
๐ข | test2 | โ๏ธ 199 | โ๏ธ extract('CA10__status__c') != 'RUNNING' | โ๏ธ null |
๐ข | test3 | โ๏ธ 299 | โ๏ธ extract('CA10__creationDate__c').withinLastDays(14) | โ๏ธ null |
๐ข | test4 | โ๏ธ 399 | โ๏ธ extract('CA10__averageCpuTwoWeeks__c').isEmpty() || extract('CA10__maxCpuTwoWeeks__c').isEmpty() || extract('CA10__sumTwoWeekNetworkInMb__c').isEmpty() || extract('CA10__sumTwoWeekNetworkOutMb__c').isEmpty() | โ๏ธ null |
๐ข | test5 | โ๏ธ 499 | โ๏ธ extract('CA10__averageCpuTwoWeeks__c') < number(5.0) && extract('CA10__maxCpuTwoWeeks__c') < number(15.0) && extract('CA10__sumTwoWeekNetworkInMb__c') < number(100.0) && extract('CA10__sumTwoWeekNetworkOutMb__c') < number(100.0) | โ๏ธ null |
๐ข | test6 | โ๏ธ 500 | โ๏ธ otherwise | โ๏ธ null |
Generation Bundleโ
File | MD5 | |
---|---|---|
Open | /ce/ca/google/compute-engine/instance-idle/policy.yaml | FA622D74A738DF6026B880186FE2B772 |
Open | /ce/ca/google/compute-engine/instance-idle/prod.logic.yaml | B0C08311A48208852E0CB98436831A0E |
Open | /ce/ca/google/compute-engine/instance-idle/test-data.json | B893B4E5E475E444F1E02BE2FE3F8585 |
Open | /types/CA10__CaGoogleGceInstance__c/object.extracts.yaml | 75A538D7EA49443F6DA07C5D35BF9021 |
Available Commandsโ
repo-manager policies generate FULL /ce/ca/google/compute-engine/instance-idle/prod.logic.yaml
repo-manager policies generate DEBUG /ce/ca/google/compute-engine/instance-idle/prod.logic.yaml
repo-manager policies generate CAPTURE_TEST_DATA /ce/ca/google/compute-engine/instance-idle/prod.logic.yaml
repo-manager policies generate TESTS /ce/ca/google/compute-engine/instance-idle/prod.logic.yaml
# Execute tests
repo-manager policies test /ce/ca/google/compute-engine/instance-idle/prod.logic.yaml
Contentโ
---
inputType: "CA10__CaGoogleGceInstance__c"
importExtracts:
- file: "/types/CA10__CaGoogleGceInstance__c/object.extracts.yaml"
testData:
- file: 'test-data.json'
conditions:
- status: "INAPPLICABLE"
currentStateMessage: "The Instance is not running."
check:
NOT_EQUAL:
left:
EXTRACT: "CA10__status__c"
right:
TEXT: "RUNNING"
- status: "INAPPLICABLE"
currentStateMessage: "The instance has been running for less than 14 days."
check:
IS_WITHIN_LAST_DAYS:
offsetDays: 14
arg:
EXTRACT: "CA10__creationDate__c"
- status: "UNDETERMINED"
currentStateMessage: "There is not enough data in the CMDB to identify if the instance is idle."
check:
OR:
args:
- IS_EMPTY:
arg:
EXTRACT: "CA10__averageCpuTwoWeeks__c"
- IS_EMPTY:
arg:
EXTRACT: "CA10__maxCpuTwoWeeks__c"
- IS_EMPTY:
arg:
EXTRACT: "CA10__sumTwoWeekNetworkInMb__c"
- IS_EMPTY:
arg:
EXTRACT: "CA10__sumTwoWeekNetworkOutMb__c"
- status: INCOMPLIANT
currentStateMessage: "The instance is idle with Average CPU Utilization < 5%,\
\ Max CPU Utilization < 15%, and Average Network I/O < 100 MB."
remediationMessage: "Consider stopping, terminating, or rightsizing the instance."
check:
AND:
args:
- LESS_THAN:
left:
EXTRACT: CA10__averageCpuTwoWeeks__c
right:
NUMBER: 5.0
- LESS_THAN:
left:
EXTRACT: CA10__maxCpuTwoWeeks__c
right:
NUMBER: 15.0
- LESS_THAN:
left:
EXTRACT: CA10__sumTwoWeekNetworkInMb__c
right:
NUMBER: 100.0
- LESS_THAN:
left:
EXTRACT: CA10__sumTwoWeekNetworkOutMb__c
right:
NUMBER: 100.0
otherwise:
status: "COMPLIANT"
currentStateMessage: "The instance is not idle."