Skip to content

Commit 03faf43

Browse files
committed
add README section about actions
refs: #13
1 parent d209278 commit 03faf43

2 files changed

Lines changed: 76 additions & 5 deletions

File tree

README.md

Lines changed: 74 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,15 @@ the settings.
6868

6969
Now you should be able to run the image with following command
7070
```
71-
docker run -d -v /PATH/TO/ìcinga-bot.ini:/app/icinga-bot.ini --name bot icinga-bot
71+
docker run -d -v /PATH/TO/icinga-bot.ini:/app/icinga-bot.ini --name bot icinga-bot
7272
```
7373

7474
### Icinga API permissions
7575
* necessary API permissions
7676
* objects/query/Host
7777
* objects/query/Service
7878
* status/query
79+
* actions/*
7980

8081
This would be an Icinga Slack bot API user
8182
```
@@ -137,7 +138,7 @@ Following commands are currently implemented:
137138
>acknowledge problematic hosts or services
138139
* downtime (dt)
139140
>set a downtime for hosts/services
140-
* reset
141+
* reset (abort)
141142
>abort current action (ack/dt)
142143
* icinga status (is)
143144
>print current Icinga status details
@@ -149,14 +150,17 @@ Following command filters are implemented
149150
* down
150151
* unreachable (unreach)
151152
* all
153+
* problems
152154
* service status
153155
* ok
154156
* warning (warn)
155157
* critical (crit)
156158
* unknown
157159
* all
160+
* problems
158161

159-
command filter can be combined like "warn crit" which would return all services in WARNING and CRITICAL state
162+
Command filter can be combined like "warn crit" which would return all services in WARNING and CRITICAL state.
163+
Also "problems" could be used to query all service with a certain name match in **NOT** OK sate.
160164

161165
***Important:***
162166
* The default host status filter will only display hosts which are **NOT** UP
@@ -174,6 +178,68 @@ Also just parts of host and service names can be used to search for objects
174178
(service.state == 2) && ( match("*test*", host.name) && match("*web*", service.name) ) || ( match("*web*", host.name) && match("*test*", service.name) )
175179
`
176180

181+
### Actions
182+
Actions have been added to perform certain actions on hosts or services.
183+
Current actions are `Acknowledgements` and `Downtimes`.
184+
185+
#### Acknowledgements
186+
This command will start a dialog to set an acknowledgement for an unhandled service or host.
187+
This can be started with this command and the bot will ask questions about the details on following order:
188+
1. host/service filter
189+
2. time when acknowledgement should expire (or never)
190+
3. a comment which should be added to the acknowledgement
191+
192+
##### INFO: time can be submitted in a relative format like:
193+
_tomorrow 3pm_, _friday noon_ or _monday morning_<br>
194+
Or more specific like _january 2nd_ or even more specific like _29.02.2020 13:00_.
195+
Just try and see what works best for you.<br>
196+
At the end the bot will ask you for a confirmation which can be answered with `yes` or just `y` or `no`.
197+
After that the bot will report if the action was successful or not.
198+
199+
##### SORT CUT:
200+
It's also possible to short cut the whole Q/A and just issue the action in one command:
201+
```
202+
ack my-server ntp until tomorrow evening Wrong ntp config, needs update
203+
```
204+
This will acknowledge a problematic service ntp on my-server until 6pm the following day.
205+
206+
##### STRUCTURE:
207+
```
208+
ack <host> <service> until <time> <comment>
209+
```
210+
or
211+
```
212+
ack <host> until <time> <comment>
213+
```
214+
or
215+
```
216+
ack <service> until <time> <comment>
217+
```
218+
219+
#### Downtimes
220+
This command works pretty similar to the acknowledgement command except that the bot
221+
will ask for a downtime start. Here it's also possible to use a relative time format.
222+
223+
##### SORT CUT:
224+
It's also possible to short cut the whole Q/A and just issue the action in one command:
225+
```
226+
dt my-server ntp from now until tomorrow evening NTP update
227+
```
228+
This will set a downtime for the service ntp on my-server until 6pm the following day.
229+
230+
##### STRUCTURE:
231+
```
232+
dt <host> <service> from <time> until <time> <comment>
233+
```
234+
or
235+
```
236+
dt <host> from <time> until <time> <comment>
237+
```
238+
or
239+
```
240+
dt <service> from <time> until <time> <comment>
241+
```
242+
177243
### Command examples
178244
* ```hs down test``` will display all hosts in DOWN state which match "test" as host name like "testserver" or "devtest"
179245
* ```hs all``` will return all hosts and their status
@@ -226,7 +292,12 @@ To get Slack notifications if something goes wrong you can check out the notific
226292
![alert host up](docs/notification_host_up.png)
227293
![alert service problem](docs/notification_service_problem.png)
228294

295+
229296
## License
230297
>You can check out the full license [here](LICENSE.txt)
231298
232299
This project is licensed under the terms of the **MIT** license.
300+
301+
### Saying Thank You
302+
quite some inspiration came from [mlabouardy](https://github.com/mlabouardy) and his Go implementation
303+
of a [slack bot](https://github.com/mlabouardy/icinga2-slack-bot)

i2_slack_modules/command_definition.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
"*STRUCTURE:*\n"
122122
"`ack <host> <service> until <time> <comment>` or\n"
123123
"`ack <host> until <time> <comment>` or\n"
124-
"`ack <service> until <time> <comment>` or\n",
124+
"`ack <service> until <time> <comment>`\n",
125125
"command_handler": "chat_with_user"
126126
},
127127
{
@@ -151,7 +151,7 @@
151151
"*STRUCTURE:*\n"
152152
"`dt <host> <service> from <time> until <time> <comment>` or\n"
153153
"`dt <host> from <time> until <time> <comment>` or\n"
154-
"`dt <service> from <time> until <time> <comment>` or\n",
154+
"`dt <service> from <time> until <time> <comment>`\n",
155155
"command_handler": "chat_with_user"
156156
},
157157
{

0 commit comments

Comments
 (0)