Skip to content

Commit

Permalink
doc: added bp definition chapter
Browse files Browse the repository at this point in the history
  • Loading branch information
sontags committed Oct 31, 2018
1 parent 881086f commit ef5a3c9
Show file tree
Hide file tree
Showing 14 changed files with 597 additions and 52 deletions.
66 changes: 65 additions & 1 deletion docs/_source/content/docs/2_mainconfiguration.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,15 @@ Now let's move forward; here comes the fun part.

<!--more-->

### Generate the Main Configuration
<div class="info">
<div class="headline">Keeping your system tidy</div>
<p>
Please make sure you place all your config files in a dedicated directory. We will refer to this configuration
folder as <code>$BPMON_HOME</code>.
</p>
</div>

## Generate the Main Configuration

BPMON provides a couple of subcommands that allow you to manage your main configuration file.
When starting a new setup from scratch `bpmon config init` comes handy. This will print an annotated
Expand Down Expand Up @@ -85,3 +93,59 @@ default:
runner: runners/
bp: bp.d/
```

Pipe this output in a file called `config.yaml`.

```
bpmon config init > $BPMON_HOME/config.yaml
```

## Connect to Icinga and Influx database

To get some insights on what can be configured please read the comment in
this generated file. For now we only need to setup the `checker` and `store` parts of the configuration to get things started.

In `default.checker.connection` add the connection string to access your icinga API...

In `default.store` we have two options:

1. If you have an Influx database ready paste the connection string at `default.store.connection`.
2. If you don't want to persist historical data right now set `default.store.get_last_status` to false

## Define an availability

Often we have some time slots in which the availability of a system is guaranteed. Add those time slots to your main config in `default.availabilities`:

```
---
default:
...
availabilities:
high:
monday: [ "allday" ]
tuesday: [ "allday" ]
wednesday: [ "allday" ]
thursday: [ "allday" ]
friday: [ "allday" ]
saturday: [ "allday" ]
sunday: [ "allday" ]
medium:
monday: [ "06:00:00-20:00:00" ]
tuesday: [ "06:00:00-20:00:00" ]
wednesday: [ "06:00:00-20:00:00" ]
thursday: [ "06:00:00-20:00:00" ]
friday: [ "06:00:00-20:00:00" ]
saturday: [ "06:00:00-20:00:00" ]
sunday: [ "06:00:00-20:00:00" ]
low:
monday: [ "08:00:00-12:00:00", "13:30:00-17:00:00" ]
tuesday: [ "08:00:00-12:00:00", "13:30:00-17:00:00" ]
wednesday: [ "08:00:00-12:00:00", "13:30:00-17:00:00" ]
thursday: [ "08:00:00-12:00:00", "13:30:00-17:00:00" ]
friday: [ "08:00:00-12:00:00", "13:30:00-17:00:00" ]
...
```

In this case we have three availabilities defined: 'high', 'medium', 'low'. Name yours however your want, just make sure the names make sense to you.

Thats it for the main configuraiton! Let's move on...
48 changes: 31 additions & 17 deletions docs/_source/content/docs/3_businessprocesses.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,36 @@ Learn how do create a Business Process composed from existing Icinga2 Checks.

<!--more-->

## Adding our first Business Process
## Adding our first Business Process Definition

Now that BPMON is set up, lets define a *business process*. Again, we do that
via YAML, a file per *business process*:
via YAML, a file per *business process*. Put the following content into `$BPMON_HOME/bp.d/web_service_x.yaml`

```yaml
---
# Give it a name. Names can be changed anytime...
name: Application X
name: Web Service X
# Also give it an ID. This is used to store results in the database and
# therefore should not be changed.
id: app_x
id: ws_x
# Tell BPMON during what time the process needs to be avalable. Remember
# the availabilities section from the global configuration...? This links
# there.
availability: 9to5
availability: medium
# You can also specify a 'responsible' string. This string can then be used in
# the trigger template. This could be for example trigger a specific http
# end point, pass some uri parameters, send an email to a specific address etc.
# The 'responsible' string is inherited by its KPIs if not overwritten...
responsible: [email protected]
# By providing a list of 'recipients' subcommands such as 'beta dashboard' can
# By providing a list of 'recipients' subcommands such as 'dashboard' can
# use that information in order do provide some sort of authorization.
recipients: [ UsersAppX ]
# Now the KPIs...
kpis:
-
# We already know the name and ID part...
name: Load Balancer Availability
id: lb_availability
name: Database Availability
id: db_availability
# The 'operatinon' defines how the services must be evaluated. Possible
# options are:
# * AND: All services need to be 'OK' for the KPI to be 'OK'.
Expand All @@ -55,14 +55,28 @@ kpis:
# And now the processes. Host and service relate to how you named those
# things in your Icinga2 setup.
services:
- { host: haproxy1.example.com, service: ping }
- { host: haproxy2.example.com, service: ping }
- name: App Nodes Availability
id: app_availability
operation: MINPERCENT 50
- { host: database1.example.com, service: ping }
- { host: database2.example.com, service: ping }
- name: Frontend Nodes Availability
id: frontend_availability
operation: MINPERCENT 60
services:
- { host: app1.example.com, service: api_health, responsible: [email protected] }
- { host: app2.example.com, service: api_health }
- { host: app3.example.com, service: api_health }
- { host: app4.example.com, service: api_health }
- host: frontend1.example.com
service: api_health
responsible: [email protected]
- { host: frontend2.example.com, service: api_health }
- { host: frontend3.example.com, service: api_health }
- { host: frontend4.example.com, service: api_health }
- { host: frontend5.example.com, service: api_health }
- { host: frontend6.example.com, service: api_health }
```
Certainly you have to adopt the configuration to match systems monitored via your icinga instance or use
[icingamock](//github.com/unprofession-al/bpmon/blob/master/cmd/icingamock/README.md) to use our Business Process
Definition:
```
icingamock -bp $BPMON_HOME/bp.d
```

Configuration done, lets check...!
14 changes: 14 additions & 0 deletions docs/_source/content/docs/4_run.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: "Run BPMON"
date: 2018-10-29T11:07:36+01:00
optional: false
duration: "2 min"
menu: "doc"
weight: 30
---

All set and configured... Let's see the results!

<!--more-->

### Basic Configuration
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ date: 2018-10-29T11:07:36+01:00
optional: true
duration: "10 min"
menu: "doc"
weight: 20
weight: 40
---

See how you can track the history of your incidents.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ date: 2018-10-29T11:07:36+01:00
optional: true
duration: "15 min"
menu: "doc"
weight: 30
weight: 50
---

Not quite what you need yet? Let's customize the output!
Expand Down
68 changes: 66 additions & 2 deletions docs/docs/2_mainconfiguration/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,15 @@ <h1>The Main Configuration</h1>

<p></p>

<h3 id="generate-the-main-configuration">Generate the Main Configuration</h3>
<div class="info">
<div class="headline">Keeping your system tidy</div>
<p>
Please make sure you place all your config files in a dedicated directory. We will refer to this configuration
folder as <code>$BPMON_HOME</code>.
</p>
</div>

<h2 id="generate-the-main-configuration">Generate the Main Configuration</h2>

<p>BPMON provides a couple of subcommands that allow you to manage your main configuration file.
When starting a new setup from scratch <code>bpmon config init</code> comes handy. This will print an annotated
Expand Down Expand Up @@ -141,7 +149,63 @@ <h3 id="generate-the-main-configuration">Generate the Main Configuration</h3>
env:
runner: runners/
bp: bp.d/
</code></pre></div>
</code></pre>

<p>Pipe this output in a file called <code>config.yaml</code>.</p>

<pre><code>bpmon config init &gt; $BPMON_HOME/config.yaml
</code></pre>

<h2 id="connect-to-icinga-and-influx-database">Connect to Icinga and Influx database</h2>

<p>To get some insights on what can be configured please read the comment in
this generated file. For now we only need to setup the <code>checker</code> and <code>store</code> parts of the configuration to get things started.</p>

<p>In <code>default.checker.connection</code> add the connection string to access your icinga API&hellip;</p>

<p>In <code>default.store</code> we have two options:</p>

<ol>
<li>If you have an Influx database ready paste the connection string at <code>default.store.connection</code>.</li>
<li>If you don&rsquo;t want to persist historical data right now set <code>default.store.get_last_status</code> to false</li>
</ol>

<h2 id="define-an-availability">Define an availability</h2>

<p>Often we have some time slots in which the availability of a system is guaranteed. Add those time slots to your main config in <code>default.availabilities</code>:</p>

<pre><code>---
default:
...
availabilities:
high:
monday: [ &quot;allday&quot; ]
tuesday: [ &quot;allday&quot; ]
wednesday: [ &quot;allday&quot; ]
thursday: [ &quot;allday&quot; ]
friday: [ &quot;allday&quot; ]
saturday: [ &quot;allday&quot; ]
sunday: [ &quot;allday&quot; ]
medium:
monday: [ &quot;06:00:00-20:00:00&quot; ]
tuesday: [ &quot;06:00:00-20:00:00&quot; ]
wednesday: [ &quot;06:00:00-20:00:00&quot; ]
thursday: [ &quot;06:00:00-20:00:00&quot; ]
friday: [ &quot;06:00:00-20:00:00&quot; ]
saturday: [ &quot;06:00:00-20:00:00&quot; ]
sunday: [ &quot;06:00:00-20:00:00&quot; ]
low:
monday: [ &quot;08:00:00-12:00:00&quot;, &quot;13:30:00-17:00:00&quot; ]
tuesday: [ &quot;08:00:00-12:00:00&quot;, &quot;13:30:00-17:00:00&quot; ]
wednesday: [ &quot;08:00:00-12:00:00&quot;, &quot;13:30:00-17:00:00&quot; ]
thursday: [ &quot;08:00:00-12:00:00&quot;, &quot;13:30:00-17:00:00&quot; ]
friday: [ &quot;08:00:00-12:00:00&quot;, &quot;13:30:00-17:00:00&quot; ]
...
</code></pre>

<p>In this case we have three availabilities defined: &lsquo;high&rsquo;, &lsquo;medium&rsquo;, &lsquo;low&rsquo;. Name yours however your want, just make sure the names make sense to you.</p>

<p>Thats it for the main configuraiton! Let&rsquo;s move on&hellip;</p></div>
</div>

</div>
Expand Down
49 changes: 31 additions & 18 deletions docs/docs/3_businessprocesses/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,35 +69,35 @@ <h1>Create Business Processes</h1>

<p></p>

<h2 id="adding-our-first-business-process">Adding our first Business Process</h2>
<h2 id="adding-our-first-business-process-definition">Adding our first Business Process Definition</h2>

<p>Now that BPMON is set up, lets define a <em>business process</em>. Again, we do that
via YAML, a file per <em>business process</em>:</p>
via YAML, a file per <em>business process</em>. Put the following content into <code>$BPMON_HOME/bp.d/web_service_x.yaml</code></p>

<pre><code class="language-yaml">---
# Give it a name. Names can be changed anytime...
name: Application X
name: Web Service X
# Also give it an ID. This is used to store results in the database and
# therefore should not be changed.
id: app_x
id: ws_x
# Tell BPMON during what time the process needs to be avalable. Remember
# the availabilities section from the global configuration...? This links
# there.
availability: 9to5
availability: medium
# You can also specify a 'responsible' string. This string can then be used in
# the trigger template. This could be for example trigger a specific http
# end point, pass some uri parameters, send an email to a specific address etc.
# The 'responsible' string is inherited by its KPIs if not overwritten...
responsible: [email protected]
# By providing a list of 'recipients' subcommands such as 'beta dashboard' can
# By providing a list of 'recipients' subcommands such as 'dashboard' can
# use that information in order do provide some sort of authorization.
recipients: [ UsersAppX ]
# Now the KPIs...
kpis:
-
# We already know the name and ID part...
name: Load Balancer Availability
id: lb_availability
name: Database Availability
id: db_availability
# The 'operatinon' defines how the services must be evaluated. Possible
# options are:
# * AND: All services need to be 'OK' for the KPI to be 'OK'.
Expand All @@ -112,17 +112,30 @@ <h2 id="adding-our-first-business-process">Adding our first Business Process</h2
# And now the processes. Host and service relate to how you named those
# things in your Icinga2 setup.
services:
- { host: haproxy1.example.com, service: ping }
- { host: haproxy2.example.com, service: ping }
- name: App Nodes Availability
id: app_availability
operation: MINPERCENT 50
- { host: database1.example.com, service: ping }
- { host: database2.example.com, service: ping }
- name: Frontend Nodes Availability
id: frontend_availability
operation: MINPERCENT 60
services:
- { host: app1.example.com, service: api_health, responsible: [email protected] }
- { host: app2.example.com, service: api_health }
- { host: app3.example.com, service: api_health }
- { host: app4.example.com, service: api_health }
</code></pre></div>
- host: frontend1.example.com
service: api_health
responsible: [email protected]
- { host: frontend2.example.com, service: api_health }
- { host: frontend3.example.com, service: api_health }
- { host: frontend4.example.com, service: api_health }
- { host: frontend5.example.com, service: api_health }
- { host: frontend6.example.com, service: api_health }
</code></pre>

<p>Certainly you have to adopt the configuration to match systems monitored via your icinga instance or use
<a href="//github.com/unprofession-al/bpmon/blob/master/cmd/icingamock/README.md">icingamock</a> to use our Business Process
Definition:</p>

<pre><code>icingamock -bp $BPMON_HOME/bp.d
</code></pre>

<p>Configuration done, lets check&hellip;!</p></div>
</div>

</div>
Expand Down
Loading

0 comments on commit ef5a3c9

Please sign in to comment.