| /** |
| * Licensed to the Apache Software Foundation (ASF) under one |
| * or more contributor license agreements. See the NOTICE file |
| * distributed with this work for additional information |
| * regarding copyright ownership. The ASF licenses this file |
| * to you under the Apache License, Version 2.0 (the |
| * "License"); you may not use this file except in compliance |
| * with the License. You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| |
| doctype html |
| html |
| head |
| meta(charset='utf-8') |
| meta(http-equiv='X-UA-Compatible', content='IE=edge,chrome=1') |
| meta(name='viewport', content='width=device-width') |
| title Kibana 3 - Alerts |
| link(rel='stylesheet', href='css/bootstrap.dark.min.css', title='Dark') |
| link(rel='stylesheet', href='css/timepicker.css') |
| link(rel='stylesheet', href='css/animate.min.css') |
| link(rel='stylesheet', href='css/normalize.min.css') |
| link(rel='stylesheet', href='css/metron.css') |
| script(src='vendor/require/require.js') |
| script(src='app/components/require.config.js') |
| script. |
| require(['app'], function () { |
| function updateAlerts(alert) { |
| if (alerts[alert.title]) { |
| alerts[alert.title].count++; |
| jQuery('#' + alerts[alert.title].id).html(alerts[alert.title].count); |
| } else { |
| var id = 'alert-' + Math.floor((Math.random() * 1000000) + 1); |
| alerts[alert.title] = { count: 1, id: id, title: alert.title }; |
| console.log(alerts[alert.title]); |
| jQuery('#realtime-alerts tbody').append( |
| '<tr><td class="count" id="' + id + '">' + alerts[alert.title].count + '</td><td>' + alerts[alert.title].title + '</td><td>' + (new Date()) + '</td></tr>' |
| ); |
| } |
| } |
| |
| var host = window.document.location.host.replace(/:.*/, ''); |
| var port = window.document.location.port; |
| var ws = new WebSocket('ws://' + host + ':' + port + '/alert'); |
| var alerts = {}; |
| ws.onmessage = function (event) { |
| console.log(event); |
| updateAlerts(JSON.parse(event.data)); |
| }; |
| }) |
| style |
| body |
| noscript |
| .container |
| center |
| h3 You must enable javascript to use Kibana |
| link(rel='stylesheet', href='css/bootstrap.dark.min.css') |
| link(rel='stylesheet', href='css/bootstrap-responsive.min.css') |
| link(rel='stylesheet', href='css/font-awesome.min.css') |
| .container-fluid |
| .row-fluid |
| .span6.offset3 |
| table#realtime-alerts.table |
| caption Dashboard Alerts |
| thead |
| tr |
| th Count |
| th Dashboard Name |
| th Last Alert |
| tbody |
| // |
| <div ng-cloak ng-view></div> |