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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
phpunit.phar
etc/config.yml
etc/config.yml.oitc
tests/StatusengineTest/Results/*.html
tests/StatusengineTest/Results/css
tests/StatusengineTest/Results/img
Expand Down
4 changes: 2 additions & 2 deletions bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Statusengine Worker
* Copyright (C) 2016-2018 Daniel Ziegler
* Copyright (C) 2016-2024 Daniel Ziegler
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -18,7 +18,7 @@
*/


define('STATUSENGINE_WORKER_VERSION', '3.6.0');
define('STATUSENGINE_WORKER_VERSION', '3.8.0');
define('DS', DIRECTORY_SEPARATOR);

require_once __DIR__ . DS . 'vendor' . DS . 'autoload.php';
Expand Down
4 changes: 4 additions & 0 deletions docs/Env.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ Even if its possible, I don't recommend to use a mix of both.
| SE_MYSQL_ENCODING | string | depends | Required if `SE_USE_MYSQL` is enabled, Example: utf8 or utf8mb4 |
| SE_DUMP_MYSQL_QUERY_PARAMETERS | bool | no | If enabled will print the MySQL Query Parameters to stdout in case of an SQL error |
| SE_CRATE_NODES | array | depends | `export SE_CRATE_NODES="127.0.0.1:4200,192.168.1.1:4200,192.168.10.1:4200"` |
| SE_CRATE_USERNAME | string | depends | Required if `SE_USE_CRATE` is enabled |
| SE_CRATE_PASSWORD | string | depends | Empty string by default `export SE_CRATE_PASSWORD="secure"` |
| SE_GEARMAN_ADDRESS | string | depends | Required if `SE_USE_GEARMAN` is enabled |
| SE_GEARMAN_PORT | string | no | |
| SE_GEARMAN_TIMEOUT | string | no | Gearman connection timeout in milliseconds |
Expand Down Expand Up @@ -70,10 +72,12 @@ Even if its possible, I don't recommend to use a mix of both.
| SE_AGE_HOSTCHECKS | int | no | |
| SE_AGE_HOST_ACKNOWLEDGEMENTS | int | no | |
| SE_AGE_HOST_NOTIFICATIONS | int | no | |
| SE_AGE_HOST_NOTIFICATIONS_LOG | int | no | |
| SE_AGE_HOST_STATEHISTORY | int | no | |
| SE_AGE_SERVICECHECKS | int | no | |
| SE_AGE_SERVICE_ACKNOWLEDGEMENTS | int | no | |
| SE_AGE_SERVICE_NOTIFICATIONS | int | no | |
| SE_AGE_SERVICE_NOTIFICATIONS_LOG | int | no | |
| SE_AGE_SERVICE_STATEHISTORY | int | no | |
| SE_AGE_LOGENTRIES | int | no | |
| SE_AGE_TASKS | int | no | |
Expand Down
10 changes: 9 additions & 1 deletion etc/config.yml.example
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,10 @@ use_crate: 1
# It is recommended to you a load balancer in front of your CrateDB cluster!
# So you will have a single ip address where Statusengine is going to connect to
crate:
username: crate
password:
nodes:
- 127.0.0.1:4200
- 127.0.0.1:4200
# - 192.168.56.101:4200
# - 192.168.56.102:4200

Expand Down Expand Up @@ -301,6 +303,9 @@ age_host_acknowledgements: 60
# How long should host notifications be stored
age_host_notifications: 60

# How long should host notifications log records be stored
age_host_notifications_log: 60

# How long should host state change records be stored
age_host_statehistory: 365

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

# How long should service notifications log records be stored
age_service_notifications_log: 60

# How long should service state change records be stored
age_service_statehistory: 365

Expand Down
30 changes: 29 additions & 1 deletion lib/crateDB.sql
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,20 @@ create table statusengine_host_notifications (
day as date_trunc('day', start_time * 1000)
) CLUSTERED INTO 4 shards partitioned by (day) with (number_of_replicas = '0');

create table statusengine_host_notifications_log (
hostname string,
start_time timestamp,
end_time timestamp,
state int,
reason_type int,
is_escalated boolean,
contacts_notified_count int,
output string,
ack_author string,
ack_data string,
day as date_trunc('day', start_time * 1000)
) CLUSTERED INTO 4 shards partitioned by (day) with (number_of_replicas = '0');

create table statusengine_service_notifications (
hostname string,
service_description string,
Expand All @@ -232,6 +246,20 @@ create table statusengine_service_notifications (
day as date_trunc('day', start_time * 1000)
) CLUSTERED INTO 4 shards partitioned by (day) with (number_of_replicas = '0');

create table statusengine_service_notifications_log (
hostname string,
service_description string,
start_time timestamp,
end_time timestamp,
state int,
reason_type int,
is_escalated boolean,
contacts_notified_count int,
output string,
ack_author string,
ack_data string,
day as date_trunc('day', start_time * 1000)
) CLUSTERED INTO 4 shards partitioned by (day) with (number_of_replicas = '0');

create table statusengine_host_acknowledgements (
hostname string,
Expand Down Expand Up @@ -344,4 +372,4 @@ create table statusengine_dbversion (
) CLUSTERED INTO 1 shards with (number_of_replicas = '1-all');


INSERT INTO statusengine_dbversion (id, dbversion)VALUES(1, '3.1.0');
INSERT INTO statusengine_dbversion (id, dbversion)VALUES(1, '3.8.0');
112 changes: 111 additions & 1 deletion lib/cratedb.php
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,64 @@
));


/****************************************
* Define: statusengine_service_notifications_log
***************************************/
$table = $schema->createTable("statusengine_service_notifications_log");
$table->addOption("table_options", ["number_of_replicas" => "0"]);
$table->addOption("sharding_num_shards" , 4);
$table->addOption("partition_columns" , "array (
0 => 'day',
)");
$table->addColumn("hostname", "string", array (
'notnull' => false,
'default' => NULL,
));
$table->addColumn("service_description", "string", array (
'notnull' => false,
'default' => NULL,
));
$table->addColumn("start_time", "timestamp", array (
'notnull' => false,
'default' => NULL,
));
$table->addColumn("end_time", "timestamp", array (
'notnull' => false,
'default' => NULL,
));
$table->addColumn("state", "integer", array (
'notnull' => false,
'default' => NULL,
));
$table->addColumn("reason_type", "integer", array (
'notnull' => false,
'default' => NULL,
));
$table->addColumn("is_escalated", "boolean", array (
'notnull' => false,
'default' => NULL,
));
$table->addColumn("contacts_notified_count", "integer", array (
'notnull' => false,
'default' => NULL,
));
$table->addColumn("output", "string", array (
'notnull' => false,
'default' => NULL,
));
$table->addColumn("ack_author", "string", array (
'notnull' => false,
'default' => NULL,
));
$table->addColumn("ack_data", "string", array (
'notnull' => false,
'default' => NULL,
));
$table->addColumn("day", "timestamp", array (
'notnull' => false,
'default' => NULL,
));


/****************************************
* Define: statusengine_hoststatus
Expand Down Expand Up @@ -741,7 +799,59 @@
'default' => NULL,
));


/****************************************
* Define: statusengine_host_notifications_log
***************************************/
$table = $schema->createTable("statusengine_host_notifications_log");
$table->addOption("table_options", ["number_of_replicas" => "0"]);
$table->addOption("sharding_num_shards" , 4);
$table->addOption("partition_columns" , "array (
0 => 'day',
)");
$table->addColumn("hostname", "string", array (
'notnull' => false,
'default' => NULL,
));
$table->addColumn("start_time", "timestamp", array (
'notnull' => false,
'default' => NULL,
));
$table->addColumn("end_time", "timestamp", array (
'notnull' => false,
'default' => NULL,
));
$table->addColumn("state", "integer", array (
'notnull' => false,
'default' => NULL,
));
$table->addColumn("reason_type", "integer", array (
'notnull' => false,
'default' => NULL,
));
$table->addColumn("is_escalated", "boolean", array (
'notnull' => false,
'default' => NULL,
));
$table->addColumn("contacts_notified_count", "integer", array (
'notnull' => false,
'default' => NULL,
));
$table->addColumn("output", "string", array (
'notnull' => false,
'default' => NULL,
));
$table->addColumn("ack_author", "string", array (
'notnull' => false,
'default' => NULL,
));
$table->addColumn("ack_data", "string", array (
'notnull' => false,
'default' => NULL,
));
$table->addColumn("day", "timestamp", array (
'notnull' => false,
'default' => NULL,
));

/****************************************
* Define: statusengine_service_acknowledgements
Expand Down
Loading