Commit 37928e06 authored by David Morley's avatar David Morley

Let podmin pick score to send alert

parent b58b667f
......@@ -5,7 +5,7 @@ ALTER TABLE pods RENAME COLUMN pingdomurl TO stats_apikey;
ALTER TABLE pods RENAME COLUMN xmpp TO service_xmpp;
ALTER TABLE pods RENAME COLUMN uptimelast7 TO uptime_alltime;
ALTER TABLE pods RENAME COLUMN responsetimelast7 TO latency;
=
ALTER TABLE pods RENAME COLUMN dateUpdated TO date_updated;
ALTER TABLE pods RENAME COLUMN dateLaststats TO date_laststats;
ALTER TABLE pods RENAME COLUMN dateCreated TO date_created;
......
ALTER TABLE pods ADD podmin_notify_level int;
ALTER TABLE pods ADD podmin_notify_level int DEFAULT 50;
......@@ -40,7 +40,7 @@ try {
$reader = new Reader(c('geoip2db'));
$sql = '
SELECT domain, score, date_created, weight, podmin_notify, email, masterversion, shortversion, status, detectedlanguage
SELECT domain, score, date_created, weight, podmin_notify, podmin_notify_level, email, masterversion, shortversion, status, detectedlanguage
FROM pods
';
......@@ -63,17 +63,18 @@ try {
}
foreach ($pods as $pod) {
$domain = $pod['domain'];
$score = (int) $pod['score'];
$dbscore = $score;
$dateadded = $pod['date_created'];
$weight = $pod['weight'];
$email = $pod['email'];
$notify = $pod['podmin_notify'];
$masterv = $pod['masterversion'];
$shortv = $pod['shortversion'];
$dbstatus = $pod['status'];
$language = $pod['detectedlanguage'];
$domain = $pod['domain'];
$score = (int) $pod['score'];
$dbscore = $score;
$dateadded = $pod['date_created'];
$weight = $pod['weight'];
$email = $pod['email'];
$notify = $pod['podmin_notify'];
$notify_level = $pod['podmin_notify_level'];
$masterv = $pod['masterversion'];
$shortv = $pod['shortversion'];
$dbstatus = $pod['status'];
$language = $pod['detectedlanguage'];
try {
$ratings = R::getAll('
......@@ -340,7 +341,7 @@ foreach ($pods as $pod) {
_debug('Uptime', $uptime);
if ($score == 49 && $notify && !$develop && $dbscore == 50) {
if ($score == ($notify_level - 1) && $notify && !$develop && $dbscore == $notify_level) {
$to = $email;
$headers = ['From: ' . c('adminemail'), 'Bcc: ' . c('adminemail')];
$subject = 'Monitoring notice from poduptime';
......
......@@ -40,7 +40,7 @@ CREATE TABLE pods (
tokenexpire timestamp,
podmin_statement text,
podmin_notify boolean,
podmin_notify_level int,
podmin_notify_level int DEFAULT 50,
sslexpire timestamp,
dnssec boolean,
comment_counts int,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment