-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
feat: Add a "manual" (static/fixed) monitor #5897
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
dbc79f8
DEVOPS-000 add manual job
85df67e
DEVOPS-000 feractoring feature
9d00424
DEVOPS-000 Fix review comments
a71eac0
DEVOPS-000 Fix review comments
a775c10
DEVOPS-000 Fix review comments
3a3d66e
DEVOPS-000 Fix review comments
57e08d2
Merge branch 'master' into master
warpreality 8e2de94
Merge branch 'master' into master
CommanderStorm aaa8a25
Apply suggestions from code review
warpreality 02f702f
DEVOPS-000 Fix review comments
fd22ff2
DEVOPS-000 Fix review comments
2b2e843
Merge branch 'master' into master
CommanderStorm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
exports.up = function (knex) { | ||
return knex.schema | ||
.alterTable("monitor", function (table) { | ||
table.string("manual_status").defaultTo(null); | ||
}); | ||
}; | ||
|
||
exports.down = function (knex) { | ||
return knex.schema.alterTable("monitor", function (table) { | ||
table.dropColumn("manual_status"); | ||
}); | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
const { MonitorType } = require("./monitor-type"); | ||
const { UP, DOWN, PENDING, MAINTENANCE } = require("../../src/util"); | ||
|
||
class ManualMonitorType extends MonitorType { | ||
name = "Manual"; | ||
type = "manual"; | ||
description = "A monitor that allows manual control of the status"; | ||
supportsConditions = false; | ||
conditionVariables = []; | ||
|
||
/** | ||
* Checks the status of the monitor based on the manually set status | ||
* This monitor type is specifically designed for status pages where manual control is needed | ||
* @param {object} monitor - Monitor object containing the current status and message | ||
* @param {object} heartbeat - Object to write the status of the check | ||
* @returns {Promise<void>} | ||
*/ | ||
async check(monitor, heartbeat) { | ||
if (monitor.manual_status !== null) { | ||
heartbeat.status = monitor.manual_status; | ||
heartbeat.msg = monitor.manual_status === UP ? "Up" : | ||
monitor.manual_status === DOWN ? "Down" : | ||
monitor.manual_status === MAINTENANCE ? "Maintenance" : | ||
"Pending"; | ||
warpreality marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
heartbeat.ping = null; | ||
} else { | ||
heartbeat.status = PENDING; | ||
heartbeat.msg = "Manual monitoring - No status set"; | ||
heartbeat.ping = null; | ||
warpreality marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
} | ||
} | ||
} | ||
|
||
module.exports = { | ||
ManualMonitorType | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.