Plugins
Scrape Plugins are resources that modify the behavior of other scrapers. They can transform changes, add properties to configs, and even set up relationships between configs. 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.
For example, if you want to exclude all events with severity="info", a scrape plugin can help you achieve that.
plugin-change-exclusion.yamlapiVersion: configs.flanksource.com/v1
kind: ScrapePlugin
metadata:
name: exclude-info-level-changes
namespace: mc
spec:
changes:
exclude:
- severity == "info"
Spec
Field | Description | Scheme |
---|---|---|
changes.exclude | Ignore changes | []CEL with Change Context |
changes.mapping | Categorize changes | |
properties | Custom templatable properties for the scraped config items. | |
relationship | Select all the components to link to this check |
Mapping
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. For example, the change 'status.images' might not be self-explanatory. To clarify this, you can assign types to these diff changes using mapping.
plugin-change-mapping.yamlapiVersion: configs.flanksource.com/v1
kind: ScrapePlugin
metadata:
name: change-mapping-rules
namespace: mc
spec:
changes:
mapping:
- filter: >
change.change_type == 'diff' && change.summary == "status.containerStatuses" &&
patch != null && has(patch.status) && has(patch.status.containerStatuses) &&
patch.status.containerStatuses.size() > 0 &&
has(patch.status.containerStatuses[0].restartCount)
type: PodCrashLooping
- filter: >
change.change_type == 'diff' && change.summary == "status.images" && config.kind == "Node"
type: ImageUpdated
Field | Description | Scheme |
---|---|---|
action | What action to take on the change, if |
|
filter | Selects changes to apply the mapping | |
summary | New summary of the change | |
type | New change type | string |