Simplified and secured Local Service monitor

This commit is contained in:
iotux
2025-12-13 15:25:14 +01:00
parent 2ffc06d950
commit d76ce4e28d
6 changed files with 41 additions and 120 deletions
+2 -2
View File
@@ -1025,10 +1025,10 @@
"deleteRemoteBrowserMessage": "Are you sure want to delete this Remote Browser for all monitors?",
"GrafanaOncallUrl": "Grafana Oncall URL",
"Local Service": "Local Service",
"Service Name": "Service Name",
"localServiceDescription": "The name of the systemd service to check. Example: `nginx.service`",
"Browser Screenshot": "Browser Screenshot",
"Command": "Command",
"localServiceCommandDescription": "The command to execute. For example: `systemctl is-active mosquitto`",
"localServiceExpectedOutputDescription": "The expected output of the command. If the output contains this string, the monitor will be considered UP. Leave empty to only check the exit code.",
"Expected Output": "Expected Output",
"mongodbCommandDescription": "Run a MongoDB command against the database. For information about the available commands check out the {documentation}",
"wayToGetSevenIOApiKey": "Visit the dashboard under app.seven.io > developer > api key > the green add button",
+4 -53
View File
@@ -667,57 +667,10 @@
<template v-if="monitor.type === 'local-service'">
<div class="my-3">
<label for="local-service-command" class="form-label">{{ $t("Command") }}</label>
<input id="local-service-command" v-model="monitor.local_service_command" type="text" class="form-control" required>
<label for="local-service-name" class="form-label">{{ $t("Service Name") }}</label>
<input id="local-service-name" v-model="monitor.local_service_name" type="text" class="form-control" required placeholder="nginx.service">
<div class="form-text">
{{ $t("localServiceCommandDescription") }}
</div>
</div>
<div class="my-3">
<label for="local-service-check-type" class="form-label">{{ $t("Check Type") }}</label>
<select id="local-service-check-type" v-model="monitor.local_service_check_type" class="form-select" required>
<option value="keyword">{{ $t("Keyword") }}</option>
<option value="json-query">{{ $t("Json Query") }}</option>
</select>
</div>
<div v-if="monitor.local_service_check_type === 'keyword'" class="my-3">
<label for="local-service-expected-output" class="form-label">{{ $t("Expected Value") }}</label>
<input id="local-service-expected-output" v-model="monitor.local_service_expected_output" type="text" class="form-control">
<div class="form-text">
{{ $t("localServiceExpectedOutputDescription") }}
</div>
</div>
<div v-if="monitor.local_service_check_type === 'json-query'" class="my-3">
<div class="my-2">
<label for="jsonPath" class="form-label mb-0">{{ $t("Json Query Expression") }}</label>
<i18n-t tag="div" class="form-text mb-2" keypath="jsonQueryDescription">
<a href="https://jsonata.org/" target="_blank" rel="noopener noreferrer">jsonata.org</a>
<a href="https://try.jsonata.org/" target="_blank" rel="noopener noreferrer">{{ $t('playground') }}</a>
</i18n-t>
<input id="jsonPath" v-model="monitor.jsonPath" type="text" class="form-control" placeholder="$" required>
</div>
<div class="d-flex align-items-start">
<div class="me-2">
<label for="json_path_operator" class="form-label">{{ $t("Condition") }}</label>
<select id="json_path_operator" v-model="monitor.jsonPathOperator" class="form-select me-3" required>
<option value=">">&gt;</option>
<option value=">=">&gt;=</option>
<option value="<">&lt;</option>
<option value="<=">&lt;=</option>
<option value="!=">&#33;=</option>
<option value="==">==</option>
<option value="contains">contains</option>
</select>
</div>
<div class="flex-grow-1">
<label for="expectedValue" class="form-label">{{ $t("Expected Value") }}</label>
<input v-if="monitor.jsonPathOperator !== 'contains' && monitor.jsonPathOperator !== '==' && monitor.jsonPathOperator !== '!='" id="expectedValue" v-model="monitor.expectedValue" type="number" class="form-control" required step=".01">
<input v-else id="expectedValue" v-model="monitor.expectedValue" type="text" class="form-control" required>
</div>
{{ $t("localServiceDescription") }}
</div>
</div>
</template>
@@ -1418,9 +1371,7 @@ const monitorDefaults = {
rabbitmqUsername: "",
rabbitmqPassword: "",
conditions: [],
local_service_command: "",
local_service_expected_output: "",
local_service_check_type: "",
local_service_name: "",
};
export default {