Skip to content

Commit 2e68096

Browse files
authored
Merge pull request #40 from statusengine/notifications
Statusengine 3.8.0
2 parents 399918d + 483c748 commit 2e68096

34 files changed

+1391
-141
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
phpunit.phar
22
etc/config.yml
3+
etc/config.yml.oitc
34
tests/StatusengineTest/Results/*.html
45
tests/StatusengineTest/Results/css
56
tests/StatusengineTest/Results/img

bootstrap.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
33
* Statusengine Worker
4-
* Copyright (C) 2016-2018 Daniel Ziegler
4+
* Copyright (C) 2016-2024 Daniel Ziegler
55
*
66
* This program is free software: you can redistribute it and/or modify
77
* it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@
1818
*/
1919

2020

21-
define('STATUSENGINE_WORKER_VERSION', '3.6.0');
21+
define('STATUSENGINE_WORKER_VERSION', '3.8.0');
2222
define('DS', DIRECTORY_SEPARATOR);
2323

2424
require_once __DIR__ . DS . 'vendor' . DS . 'autoload.php';

docs/Env.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ Even if its possible, I don't recommend to use a mix of both.
3030
| SE_MYSQL_ENCODING | string | depends | Required if `SE_USE_MYSQL` is enabled, Example: utf8 or utf8mb4 |
3131
| SE_DUMP_MYSQL_QUERY_PARAMETERS | bool | no | If enabled will print the MySQL Query Parameters to stdout in case of an SQL error |
3232
| SE_CRATE_NODES | array | depends | `export SE_CRATE_NODES="127.0.0.1:4200,192.168.1.1:4200,192.168.10.1:4200"` |
33+
| SE_CRATE_USERNAME | string | depends | Required if `SE_USE_CRATE` is enabled |
34+
| SE_CRATE_PASSWORD | string | depends | Empty string by default `export SE_CRATE_PASSWORD="secure"` |
3335
| SE_GEARMAN_ADDRESS | string | depends | Required if `SE_USE_GEARMAN` is enabled |
3436
| SE_GEARMAN_PORT | string | no | |
3537
| SE_GEARMAN_TIMEOUT | string | no | Gearman connection timeout in milliseconds |
@@ -70,10 +72,12 @@ Even if its possible, I don't recommend to use a mix of both.
7072
| SE_AGE_HOSTCHECKS | int | no | |
7173
| SE_AGE_HOST_ACKNOWLEDGEMENTS | int | no | |
7274
| SE_AGE_HOST_NOTIFICATIONS | int | no | |
75+
| SE_AGE_HOST_NOTIFICATIONS_LOG | int | no | |
7376
| SE_AGE_HOST_STATEHISTORY | int | no | |
7477
| SE_AGE_SERVICECHECKS | int | no | |
7578
| SE_AGE_SERVICE_ACKNOWLEDGEMENTS | int | no | |
7679
| SE_AGE_SERVICE_NOTIFICATIONS | int | no | |
80+
| SE_AGE_SERVICE_NOTIFICATIONS_LOG | int | no | |
7781
| SE_AGE_SERVICE_STATEHISTORY | int | no | |
7882
| SE_AGE_LOGENTRIES | int | no | |
7983
| SE_AGE_TASKS | int | no | |

etc/config.yml.example

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,10 @@ use_crate: 1
101101
# It is recommended to you a load balancer in front of your CrateDB cluster!
102102
# So you will have a single ip address where Statusengine is going to connect to
103103
crate:
104+
username: crate
105+
password:
104106
nodes:
105-
- 127.0.0.1:4200
107+
- 127.0.0.1:4200
106108
# - 192.168.56.101:4200
107109
# - 192.168.56.102:4200
108110

@@ -301,6 +303,9 @@ age_host_acknowledgements: 60
301303
# How long should host notifications be stored
302304
age_host_notifications: 60
303305

306+
# How long should host notifications log records be stored
307+
age_host_notifications_log: 60
308+
304309
# How long should host state change records be stored
305310
age_host_statehistory: 365
306311

@@ -317,6 +322,9 @@ age_service_acknowledgements: 60
317322
# How long should service notifications be stored
318323
age_service_notifications: 60
319324

325+
# How long should service notifications log records be stored
326+
age_service_notifications_log: 60
327+
320328
# How long should service state change records be stored
321329
age_service_statehistory: 365
322330

lib/crateDB.sql

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,20 @@ create table statusengine_host_notifications (
216216
day as date_trunc('day', start_time * 1000)
217217
) CLUSTERED INTO 4 shards partitioned by (day) with (number_of_replicas = '0');
218218

219+
create table statusengine_host_notifications_log (
220+
hostname string,
221+
start_time timestamp,
222+
end_time timestamp,
223+
state int,
224+
reason_type int,
225+
is_escalated boolean,
226+
contacts_notified_count int,
227+
output string,
228+
ack_author string,
229+
ack_data string,
230+
day as date_trunc('day', start_time * 1000)
231+
) CLUSTERED INTO 4 shards partitioned by (day) with (number_of_replicas = '0');
232+
219233
create table statusengine_service_notifications (
220234
hostname string,
221235
service_description string,
@@ -232,6 +246,20 @@ create table statusengine_service_notifications (
232246
day as date_trunc('day', start_time * 1000)
233247
) CLUSTERED INTO 4 shards partitioned by (day) with (number_of_replicas = '0');
234248

249+
create table statusengine_service_notifications_log (
250+
hostname string,
251+
service_description string,
252+
start_time timestamp,
253+
end_time timestamp,
254+
state int,
255+
reason_type int,
256+
is_escalated boolean,
257+
contacts_notified_count int,
258+
output string,
259+
ack_author string,
260+
ack_data string,
261+
day as date_trunc('day', start_time * 1000)
262+
) CLUSTERED INTO 4 shards partitioned by (day) with (number_of_replicas = '0');
235263

236264
create table statusengine_host_acknowledgements (
237265
hostname string,
@@ -344,4 +372,4 @@ create table statusengine_dbversion (
344372
) CLUSTERED INTO 1 shards with (number_of_replicas = '1-all');
345373

346374

347-
INSERT INTO statusengine_dbversion (id, dbversion)VALUES(1, '3.1.0');
375+
INSERT INTO statusengine_dbversion (id, dbversion)VALUES(1, '3.8.0');

lib/cratedb.php

Lines changed: 111 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,64 @@
366366
));
367367

368368

369+
/****************************************
370+
* Define: statusengine_service_notifications_log
371+
***************************************/
372+
$table = $schema->createTable("statusengine_service_notifications_log");
373+
$table->addOption("table_options", ["number_of_replicas" => "0"]);
374+
$table->addOption("sharding_num_shards" , 4);
375+
$table->addOption("partition_columns" , "array (
376+
0 => 'day',
377+
)");
378+
$table->addColumn("hostname", "string", array (
379+
'notnull' => false,
380+
'default' => NULL,
381+
));
382+
$table->addColumn("service_description", "string", array (
383+
'notnull' => false,
384+
'default' => NULL,
385+
));
386+
$table->addColumn("start_time", "timestamp", array (
387+
'notnull' => false,
388+
'default' => NULL,
389+
));
390+
$table->addColumn("end_time", "timestamp", array (
391+
'notnull' => false,
392+
'default' => NULL,
393+
));
394+
$table->addColumn("state", "integer", array (
395+
'notnull' => false,
396+
'default' => NULL,
397+
));
398+
$table->addColumn("reason_type", "integer", array (
399+
'notnull' => false,
400+
'default' => NULL,
401+
));
402+
$table->addColumn("is_escalated", "boolean", array (
403+
'notnull' => false,
404+
'default' => NULL,
405+
));
406+
$table->addColumn("contacts_notified_count", "integer", array (
407+
'notnull' => false,
408+
'default' => NULL,
409+
));
410+
$table->addColumn("output", "string", array (
411+
'notnull' => false,
412+
'default' => NULL,
413+
));
414+
$table->addColumn("ack_author", "string", array (
415+
'notnull' => false,
416+
'default' => NULL,
417+
));
418+
$table->addColumn("ack_data", "string", array (
419+
'notnull' => false,
420+
'default' => NULL,
421+
));
422+
$table->addColumn("day", "timestamp", array (
423+
'notnull' => false,
424+
'default' => NULL,
425+
));
426+
369427

370428
/****************************************
371429
* Define: statusengine_hoststatus
@@ -741,7 +799,59 @@
741799
'default' => NULL,
742800
));
743801

744-
802+
/****************************************
803+
* Define: statusengine_host_notifications_log
804+
***************************************/
805+
$table = $schema->createTable("statusengine_host_notifications_log");
806+
$table->addOption("table_options", ["number_of_replicas" => "0"]);
807+
$table->addOption("sharding_num_shards" , 4);
808+
$table->addOption("partition_columns" , "array (
809+
0 => 'day',
810+
)");
811+
$table->addColumn("hostname", "string", array (
812+
'notnull' => false,
813+
'default' => NULL,
814+
));
815+
$table->addColumn("start_time", "timestamp", array (
816+
'notnull' => false,
817+
'default' => NULL,
818+
));
819+
$table->addColumn("end_time", "timestamp", array (
820+
'notnull' => false,
821+
'default' => NULL,
822+
));
823+
$table->addColumn("state", "integer", array (
824+
'notnull' => false,
825+
'default' => NULL,
826+
));
827+
$table->addColumn("reason_type", "integer", array (
828+
'notnull' => false,
829+
'default' => NULL,
830+
));
831+
$table->addColumn("is_escalated", "boolean", array (
832+
'notnull' => false,
833+
'default' => NULL,
834+
));
835+
$table->addColumn("contacts_notified_count", "integer", array (
836+
'notnull' => false,
837+
'default' => NULL,
838+
));
839+
$table->addColumn("output", "string", array (
840+
'notnull' => false,
841+
'default' => NULL,
842+
));
843+
$table->addColumn("ack_author", "string", array (
844+
'notnull' => false,
845+
'default' => NULL,
846+
));
847+
$table->addColumn("ack_data", "string", array (
848+
'notnull' => false,
849+
'default' => NULL,
850+
));
851+
$table->addColumn("day", "timestamp", array (
852+
'notnull' => false,
853+
'default' => NULL,
854+
));
745855

746856
/****************************************
747857
* Define: statusengine_service_acknowledgements

0 commit comments

Comments
 (0)