diff --git a/README.md b/README.md index 87b3f42..142ee0b 100644 --- a/README.md +++ b/README.md @@ -659,7 +659,8 @@ When an alert fires (and when it clears), you can configure a "web hook" to be s "action": "alert_new", "hostname": "dev001.local", "group": "main", - "url": "http://localhost:5511/#Server?hostname=dev001.local", + "live_url": "http://localhost:5511/#Server?hostname=dev001.local", + "snapshot_url": "http://localhost:5511/#Snapshot?id=dev001.local/832434", "alert": { "date": 1555377004, "exp": "11.34 >= 9", @@ -691,7 +692,8 @@ Here are descriptions of all the properties in the JSON web hook data: | `action` | This denotes the event, will be `alert_new` when an alert triggers, and `alert_cleared` when an alert clears. | | `hostname` | The server hostname where the alert event took place. | | `group` | The Group ID which the server is assigned to (see [Groups](#groups)). | -| `url` | A fully-qualified URL to the server detail page, showing the latest real-time metrics. | +| `live_url` | A fully-qualified URL to the live server view page, showing the latest real-time metrics. | +| `snapshot_url` | A fully-qualified URL to the snapshot page, showing detailed server information recorded at the time of the alert. | | `alert` | An object containing internal metadata about the alert event. | | `alert/date` | The exact date/time when the alert triggered, expressed in Epoch seconds. | | `alert/exp` | The alert expression, with all macros substituted with actual values. | diff --git a/htdocs/css/style.css b/htdocs/css/style.css index 0eb7455..5179845 100644 --- a/htdocs/css/style.css +++ b/htdocs/css/style.css @@ -651,6 +651,17 @@ fieldset.overview_group > legend { /* Snapshot Tab */ +.snap_info_column { + max-width: 180px; +} + +.snap_info_column > .info_value { + height: 14px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + .inline_table_scrollarea { position: relative; max-height: 75vh; diff --git a/htdocs/js/pages/Snapshot.class.js b/htdocs/js/pages/Snapshot.class.js index ba906b6..a0e149c 100644 --- a/htdocs/js/pages/Snapshot.class.js +++ b/htdocs/js/pages/Snapshot.class.js @@ -233,19 +233,6 @@ Class.subclass( Page.Base, "Page.Snapshot", { // column 2 html += '
'; - var nice_cores = 'n/a'; - if (metadata.data.cpu && metadata.data.cpu.cores) { - if (metadata.data.cpu.physicalCores && (metadata.data.cpu.physicalCores != metadata.data.cpu.cores)) { - nice_cores = metadata.data.cpu.physicalCores + " physical, " + - metadata.data.cpu.cores + " virtual"; - } - else { - nice_cores = metadata.data.cpu.cores; - } - } - html += '
CPU Cores
'; - html += '
' + nice_cores + '
'; - var nice_cpu_model = 'n/a'; if (metadata.data.cpu && metadata.data.cpu.manufacturer) { nice_cpu_model = metadata.data.cpu.manufacturer; @@ -262,6 +249,19 @@ Class.subclass( Page.Base, "Page.Snapshot", { html += '
CPU Clock
'; html += '
' + nice_clock_speed + '
'; + var nice_cores = 'n/a'; + if (metadata.data.cpu && metadata.data.cpu.cores) { + if (metadata.data.cpu.physicalCores && (metadata.data.cpu.physicalCores != metadata.data.cpu.cores)) { + nice_cores = metadata.data.cpu.physicalCores + " physical, " + + metadata.data.cpu.cores + " virtual"; + } + else { + nice_cores = metadata.data.cpu.cores; + } + } + html += '
CPU Cores
'; + html += '
' + nice_cores + '
'; + var nice_load = metadata.data.load.map( function(num) { return short_float_str(num); } ).join(', '); html += '
CPU Load Averages
'; html += '
' + nice_load + '
'; @@ -364,8 +364,8 @@ Class.subclass( Page.Base, "Page.Snapshot", { item.parentPid, item.user, short_float(item.pcpu) + '%', - get_text_from_bytes( (item.mem_rss || 0) * 1024 ), - get_text_from_seconds( item.age || 0, false, true ), + '
' + get_text_from_bytes( (item.mem_rss || 0) * 1024 ) + '
', + '
' + get_text_from_seconds( item.age || 0, false, true ) + '
', '' + item.command + '' ]; }); diff --git a/lib/api/submit.js b/lib/api/submit.js index f2dbff4..4e599b1 100644 --- a/lib/api/submit.js +++ b/lib/api/submit.js @@ -706,7 +706,7 @@ module.exports = Class.create({ } // construct URLs to views of server - args.self_url = this.server.config.get('base_app_url') + '/#Server?hostname=' + args.params.hostname; + args.live_url = args.self_url = this.server.config.get('base_app_url') + '/#Server?hostname=' + args.params.hostname; args.snapshot_url = this.server.config.get('base_app_url') + '/#Snapshot?id=' + args.params.hostname + '/' + time_code; // alert or group may override e-mail address @@ -744,10 +744,11 @@ module.exports = Class.create({ alert: args.alert, hostname: args.params.hostname, group: args.params.group, - url: args.self_url + live_url: args.live_url, + snapshot_url: args.snapshot_url }; if (args.template == 'alert_new') { - hook_args.text = args.config.client.name + " Alert: " + args.nice_hostname + ": " + args.def.title + ": " + args.alert.message + " - ([View Details](" + args.self_url + "))"; + hook_args.text = args.config.client.name + " Alert: " + args.nice_hostname + ": " + args.def.title + ": " + args.alert.message + " - ([View Details](" + args.live_url + "))"; } else if (args.template == 'alert_cleared') { hook_args.text = args.config.client.name + " Alert Cleared: " + args.nice_hostname + ": " + args.def.title; diff --git a/package.json b/package.json index 409b20f..2e95541 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "performa", - "version": "1.0.2", + "version": "1.0.3", "description": "A multi-server monitoring system with a web based UI.", "author": "Joseph Huckaby ", "homepage": "https://github.com/jhuckaby/performa", diff --git a/sample_conf/emails/alert_cleared.txt b/sample_conf/emails/alert_cleared.txt index d32cb35..021dc9d 100644 --- a/sample_conf/emails/alert_cleared.txt +++ b/sample_conf/emails/alert_cleared.txt @@ -15,7 +15,7 @@ Snapshot Detail View: [/snapshot_url] Live Server View: -[/self_url] +[/live_url] Regards, The Performa Team diff --git a/sample_conf/emails/alert_new.txt b/sample_conf/emails/alert_new.txt index 8492be3..659e908 100644 --- a/sample_conf/emails/alert_new.txt +++ b/sample_conf/emails/alert_new.txt @@ -16,7 +16,7 @@ Snapshot Detail View: [/snapshot_url] Live Server View: -[/self_url] +[/live_url] Alert Notes: [/nice_notes]