diff --git a/security/etpro-telemetry/Makefile b/security/etpro-telemetry/Makefile index b7a7a3c43..e135a3f1d 100644 --- a/security/etpro-telemetry/Makefile +++ b/security/etpro-telemetry/Makefile @@ -1,6 +1,6 @@ PLUGIN_NAME= etpro-telemetry -PLUGIN_VERSION= 1.6 -PLUGIN_REVISION= 4 +PLUGIN_VERSION= 1.7 +#PLUGIN_REVISION= 1 PLUGIN_COMMENT= ET Pro Telemetry Edition PLUGIN_MAINTAINER= ad@opnsense.org PLUGIN_WWW= https://docs.opnsense.org/manual/etpro_telemetry.html diff --git a/security/etpro-telemetry/src/opnsense/www/js/widgets/ETProTelemetry.js b/security/etpro-telemetry/src/opnsense/www/js/widgets/ETProTelemetry.js new file mode 100644 index 000000000..a9b8a49f6 --- /dev/null +++ b/security/etpro-telemetry/src/opnsense/www/js/widgets/ETProTelemetry.js @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2024 Deciso B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +import BaseTableWidget from "./BaseTableWidget.js"; + +export default class ETProTelemetry extends BaseTableWidget { + constructor() { + super(); + this.tickTimeout = 3600000; + } + + getMarkup() { + let $container = $('
'); + let $ETProTelemetrytable = this.createTable('ETProTelemetry-table', { + headerPosition: 'left', + }); + $container.append($ETProTelemetrytable); + return $container; + } + + async onWidgetTick() { + await ajaxGet('/api/diagnostics/proofpoint_et/status', {}, (data, status) => { + if (data['sensor_status'] == 'active') { + $('#etpro_sensor_status').text(data['sensor_status']); + $('#etpro_event_received').text(data['event_received']); + $('#etpro_last_rule_download').text(data['last_rule_download']); + $('#etpro_last_heartbeat').text(data['last_heartbeat']); + } else { + $('#etpro_sensor_status').text('-'); + $('#etpro_event_received').text('-'); + $('#etpro_last_rule_download').text('-'); + $('#etpro_last_heartbeat').text('-'); + } + }); + } + + async onMarkupRendered() { + await ajaxGet('/api/core/system/systemInformation', {}, (data, status) => { + let rows = []; + rows.push([[''], '']); + rows.push([[this.translations['sensor_status']], $('').prop('outerHTML')]); + rows.push([[this.translations['event_received']], $('').prop('outerHTML')]); + rows.push([[this.translations['last_rule_download']], $('').prop('outerHTML')]); + rows.push([[this.translations['last_heartbeat']], $('').prop('outerHTML')]); + + super.updateTable('ETProTelemetry-table', rows); + }); + } +} \ No newline at end of file diff --git a/security/etpro-telemetry/src/opnsense/www/js/widgets/Metadata/etpro-telemetry.xml b/security/etpro-telemetry/src/opnsense/www/js/widgets/Metadata/etpro-telemetry.xml new file mode 100644 index 000000000..7dabaa037 --- /dev/null +++ b/security/etpro-telemetry/src/opnsense/www/js/widgets/Metadata/etpro-telemetry.xml @@ -0,0 +1,15 @@ + + + ETProTelemetry.js + + /api/diagnostics/proofpoint_et/status + + + Telemetry status + Status + Last event + Last rule download + Last heartbeat + + + \ No newline at end of file diff --git a/security/etpro-telemetry/src/www/widgets/include/proofpoint_et.inc b/security/etpro-telemetry/src/www/widgets/include/proofpoint_et.inc deleted file mode 100644 index abf77c3bc..000000000 --- a/security/etpro-telemetry/src/www/widgets/include/proofpoint_et.inc +++ /dev/null @@ -1,2 +0,0 @@ - - - - - - - - - - - - - - - - - - - -
- -
- -
-
- - docs.opnsense.org -