|
| 1 | +--- |
| 2 | +title: Plugins |
| 3 | +sidebar_custom_props: |
| 4 | + icon: octicon:gear |
| 5 | +--- |
| 6 | + |
| 7 | +Scrape Plugins are resources that modify the behavior of other scrapers. |
| 8 | +They can transform changes, add properties to configs, and even set up relationships between configs. |
| 9 | +These behaviors can also be defined on a ScrapeConfig, but using a scrape plugin makes them global, eliminating the need to define them in all scrapers. |
| 10 | + |
| 11 | +For example, if you want to exclude all events with severity="info", a scrape plugin can help you achieve that. |
| 12 | + |
| 13 | +```yaml title="plugin-change-exclusion.yaml" file=<rootDir>/modules/config-db/fixtures/plugin-change-exclusion.yaml |
| 14 | +``` |
| 15 | + |
| 16 | +### Spec |
| 17 | + |
| 18 | +<Fields |
| 19 | + rows={[ |
| 20 | + { |
| 21 | + field: 'relationship', |
| 22 | + description: 'Select all the components to link to this check', |
| 23 | + scheme: '[Relationships](./relationships)' |
| 24 | + }, |
| 25 | + { |
| 26 | + field: 'properties', |
| 27 | + description: 'Custom templatable properties for the scraped config items.', |
| 28 | + scheme: '[`[]ConfigProperty`](/reference/config-db/properties)' |
| 29 | + }, |
| 30 | + { |
| 31 | + field: 'changes.exclude', |
| 32 | + description: 'Ignore changes', |
| 33 | + scheme: '[[]CEL](#exclusions) with [Change Context](/reference/config-db/changes)' |
| 34 | + }, |
| 35 | + { |
| 36 | + field: 'changes.mapping', |
| 37 | + description: 'Categorize changes', |
| 38 | + scheme: '[Mapping](#mapping)' |
| 39 | + } |
| 40 | + |
| 41 | + ]} |
| 42 | +/> |
| 43 | + |
| 44 | +### Mapping |
| 45 | + |
| 46 | +When you encounter a diff change, unlike an event-based change, it can sometimes appear unclear. The summary of the change may not immediately indicate its purpose. |
| 47 | +For example, the change 'status.images' might not be self-explanatory. To clarify this, you can assign types to these diff changes using mapping. |
| 48 | + |
| 49 | +```yaml title="plugin-change-mapping.yaml" file=<rootDir>/modules/config-db/fixtures/plugin-change-mapping.yaml |
| 50 | +``` |
| 51 | + |
| 52 | +<Fields |
| 53 | + rows={[ |
| 54 | + { |
| 55 | + field: 'filter', |
| 56 | + description: 'Selects changes to apply the mapping', |
| 57 | + scheme: 'cel' |
| 58 | + }, |
| 59 | + { |
| 60 | + field: 'action', |
| 61 | + description: 'What action to take on the change, if `delete` then the corresponding config item is marked as deleted', |
| 62 | + scheme: '`delete` | `ignore`' |
| 63 | + }, |
| 64 | + { |
| 65 | + field: 'type', |
| 66 | + description: 'New change type', |
| 67 | + scheme: 'string' |
| 68 | + }, |
| 69 | + { |
| 70 | + field: 'summary', |
| 71 | + description: 'New summary of the change', |
| 72 | + scheme: 'gotemplate' |
| 73 | + } |
| 74 | + ]} |
| 75 | +/> |
0 commit comments