forked from StackStorm-Exchange/stackstorm-icinga2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME.jinja
More file actions
148 lines (121 loc) · 4.43 KB
/
README.jinja
File metadata and controls
148 lines (121 loc) · 4.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# {{ pack["pack.yaml"].name }} integration pack v{{ pack["pack.yaml"].version }}
> {{ pack["pack.yaml"].description }}
{{ pack["pack.yaml"].author }} <{{ pack["pack.yaml"].email }}>
### Contributors
{% for contributor in pack["pack.yaml"].contributors -%}
- {{ contributor }}
{% endfor %}
## Description
Icinga2 version 2.4.0 introduced an API, making it possible to subscribe to Icinga2. So far only `StateChange` event type is supported. Read http://docs.icinga.org/icinga2/latest/doc/module/icinga2/toc#!/icinga2/latest/doc/module/icinga2/chapter/icinga2-api#icinga2-api for more information on Icinga2 API.
**NOTE**: This pack has had a major overhaul as of version 0.4.0. Some options have changed, and the sensor has been rewritten. This may break existing workflows. Note the sensor now uses the same username/password as actions. You can also use certificates for authentication.
## Configuration
The following options are required to be configured for the pack to work correctly.
| Option | Type | Required | Secret | Description |
|---|---|---|---|---|
{% for key, value in pack["config.schema.yaml"].items() -%}
| `{{ key }}` | {{ value.type }} | {{ value.required }} | {{ value.secret }} | {{ value.description }} |
{% endfor %}
You can also use dynamic values from the datastore. See the [docs](https://docs.stackstorm.com/reference/pack_configs.html) for more info.
## Actions
{% if actions | length > 0 %}
The pack provides the following actions:
{% for key, value in actions.items() -%}
### {{ value.name }}
_{{ value.description }}_
| Parameter | Type | Required | Secret | Description |
|---|---|---|---|---|
{% for p_key, p_value in value.parameters.items() -%}
| `{{ p_key }}` | {{ p_value.type | default("n/a") }} | {{ p_value.required | default("default") }} | {{ p_value.secret | default("default") }} | _{{ p_value.description | default("Unavailable") }}_ |
{% endfor -%}
{% endfor %}
{% else %}
There are no actions available for this pack.
{% endif %}
## Sensors
{% if sensors | length > 0 %}
The following sensors and triggers are provided:
{% for key, value in sensors.items() %}
### Class {{ value.class_name }}
_{{ value.description }}_
{% for trigger in value.trigger_types -%}
| Trigger Name | Description |
|---|---|
| `{{ trigger.name }}` | _{{ trigger.description | default("Unavailable") }}_ |
{% endfor %}
{% endfor %}
## Sensor payload
As of now, sensor is configured to catch only `StateChange` events from Icinga2 host. Typical event of such would consist of:
```
{
"check_result": {
"active": true,
"check_source": "hostname01",
"command": [
"/usr/lib64/nagios/plugins/check_disk",
"-c",
"10%",
"-w",
"20%",
"-K",
"10%",
"-W",
"20%",
"-X",
"none",
"-X",
"tmpfs",
"-X",
"sysfs",
"-X",
"proc",
"-X",
"devtmpfs",
"-X",
"devfs",
"-X",
"mtmfs",
"-m"
],
"execution_end": 1458668863.9526860714,
"execution_start": 1458668863.9508030415,
"exit_status": 0.0,
"output": "DISK OK - free space: / 3064 MB (54% inode=84%); /boot 78 MB (42% inode=99%); /home 1845 MB (99% inode=99%); /opt 18002 MB (99% inode=99%); /tmp 1846 MB (99% inode=99%); /var 3417 MB (89% inode=98%); /var/log 2089 MB (56% inode=99%);",
"performance_data": [
"/=2547MB;4735;5327;0;5919",
"/boot=105MB;154;173;0;193",
"/home=3MB;1560;1755;0;1951",
"/opt=111MB;15268;17177;0;19086",
"/tmp=3MB;1560;1755;0;1951",
"/var=409MB;3224;3627;0;4031",
"/var/log=1609MB;3122;3512;0;3903"
],
"schedule_end": 1458668863.9528689384,
"schedule_start": 1458668863.9528689384,
"state": 0.0,
"type": "CheckResult",
"vars_after": {
"attempt": 1.0,
"reachable": true,
"state": 0.0,
"state_type": 0.0
},
"vars_before": {
"attempt": 2.0,
"reachable": true,
"state": 1.0,
"state_type": 0.0
}
},
"host": "hostname01",
"service": "disk",
"state": 0.0,
"state_type": 0.0,
"timestamp": 1458668870.328537941,
"type": "StateChange"
}
```
Currently, sensor takes the `host`, `service`, `state`, `state_type`, `type` and `check_result` variables and passes it as a payload to the trigger. All that data can be used in the rule and passed to actions as well.
{% else %}
There are no sensors available for this pack.
{% endif %}
<sub>Documentation generated using [pack2md](https://github.com/nzlosh/pack2md)</sub>