Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apis/monitoring/v1alpha1/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1783,14 +1783,14 @@ spec:
type: object
vars:
properties:
items:
fields:
type: object
required:
items:
type: string
type: array
required:
- items
- fields
command:
description: Check Command
type: string
Expand Down
10 changes: 5 additions & 5 deletions apis/monitoring/v1alpha1/openapi_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions apis/monitoring/v1alpha1/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ const (
VarTypeDuration VarType = "duration"
)

type PluginVarItem struct {
type PluginVarField struct {
Description string `json:"description,omitempty"`
Type VarType `json:"type"`
}

type PluginVars struct {
Items map[string]PluginVarItem `json:"items"`
Required []string `json:"required,omitempty"`
Fields map[string]PluginVarField `json:"fields"`
Required []string `json:"required,omitempty"`
}

type PluginArguments struct {
Expand Down Expand Up @@ -114,7 +114,7 @@ func validateVariables(pluginVars *PluginVars, vars map[string]string) error {
// Check if any invalid variable is provided
var err error
for k := range vars {
p, found := pluginVars.Items[k]
p, found := pluginVars.Fields[k]
if !found {
return fmt.Errorf("var '%s' is unsupported", k)
}
Expand Down
14 changes: 7 additions & 7 deletions apis/monitoring/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/examples/cluster-alerts/count-all-pods/demo-0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ metadata:
spec:
check: check-pod-count
vars:
warning: 10
critical: 15
warning: "10"
critical: "15"
checkInterval: 30s
alertInterval: 2m
notifierSecretName: notifier-config
Expand Down
6 changes: 3 additions & 3 deletions docs/examples/plugins/webhook/demo-0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ spec:
- ClusterAlert
arguments:
vars:
items:
fields:
warning:
type: interger
type: integer
critical:
type: interger
type: integer
states:
- OK
- Critical
Expand Down
21 changes: 11 additions & 10 deletions docs/guides/plugin/webhook-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ spec:
- ClusterAlert
arguments:
vars:
items:
fields:
warning:
type: interger
type: integer
critical:
type: interger
type: integer
states:
- OK
- Critical
Expand Down Expand Up @@ -69,20 +69,21 @@ Possible values are: ClusterAlert, NodeAlert and PodAlert.

- `spec.arguments.vars` defines user-defined arguments. These arguments can be provided to create alerts.

- `spec.arguments.vars.items` is the required field which provides the list of arguments with their `description` and `type`. Here,
- `spec.arguments.vars.fields` is the required field which provides the list of arguments with their `description` and `type`. Here,

arguments:
vars:
items:
fields:
warning:
type: interger
type: integer
critical:
type: interger
type: integer

`warning` and `critical` are registered as user-defined variables. User can provide values for these variables while creating alerts.

- `spec.arguments.vars.items[].type` is required field used to define variable's data type. Possible values are `integer`, `number`, `boolean`, `string`, `duration`.
- `spec.arguments.vars.items[].description` describes the variable.
- `spec.arguments.vars.fields[].type` is required field used to define variable's data type. Possible values are `integer`, `number`, `boolean`, `string`, `duration`.
> Note: duration will be converted to millisecond and will be passed to webhook as Int64. Example: 5m -> 300000.
- `spec.arguments.vars.fields[].description` describes the variable.

- `spec.arguments.vars.required` represents the list of user-defined arguments required to create Alert. If any of these required arguments is not provided, Searchlight will give validation error.

Expand Down Expand Up @@ -125,7 +126,7 @@ searchlightplugin "check-pod-count" created
<img alt="lifecycle" src="/docs/images/plugin/add-plugin.svg" width="581" height="362">
</p>

CheckCommand `check-pod-count` is added in Icinga2 configuration. Here, `vars.Item` from `spec.arguments` are added as arguments in CheckCommand.
CheckCommand `check-pod-count` is added in Icinga2 configuration. Here, `vars.fields` from `spec.arguments` are added as arguments in CheckCommand.


> Note: Webhook will be called with URL formatted as bellow:
Expand Down
84 changes: 43 additions & 41 deletions docs/reference/hyperalert/hyperalert_check_webhook.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,47 +24,49 @@ hyperalert check_webhook [flags]
### Options

```
-h, --help help for check_webhook
--key.0 string
--key.1 string
--key.10 string
--key.11 string
--key.12 string
--key.13 string
--key.14 string
--key.15 string
--key.16 string
--key.17 string
--key.18 string
--key.19 string
--key.2 string
--key.3 string
--key.4 string
--key.5 string
--key.6 string
--key.7 string
--key.8 string
--key.9 string
--val.0 string
--val.1 string
--val.10 string
--val.11 string
--val.12 string
--val.13 string
--val.14 string
--val.15 string
--val.16 string
--val.17 string
--val.18 string
--val.19 string
--val.2 string
--val.3 string
--val.4 string
--val.5 string
--val.6 string
--val.7 string
--val.8 string
--val.9 string
--check_command string SearchlightPlugin name for this webhook check
-h, --help help for check_webhook
--key.0 string
--key.1 string
--key.10 string
--key.11 string
--key.12 string
--key.13 string
--key.14 string
--key.15 string
--key.16 string
--key.17 string
--key.18 string
--key.19 string
--key.2 string
--key.3 string
--key.4 string
--key.5 string
--key.6 string
--key.7 string
--key.8 string
--key.9 string
--val.0 string
--val.1 string
--val.10 string
--val.11 string
--val.12 string
--val.13 string
--val.14 string
--val.15 string
--val.16 string
--val.17 string
--val.18 string
--val.19 string
--val.2 string
--val.3 string
--val.4 string
--val.5 string
--val.6 string
--val.7 string
--val.8 string
--val.9 string
--webhook_url string Call the webhook server using this URL
```

### Options inherited from parent commands
Expand Down
10 changes: 5 additions & 5 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading