Esempio n. 1
0
import logging

from flask import request, Response, url_for, jsonify, render_template
from flask.ext.cors import cross_origin

from alerta.app import app, db
from alerta.app.auth import auth_required
from alerta.app.switch import Switch, SwitchState
from alerta.app.metrics import Gauge, Counter, Timer
from alerta import build
from alerta.version import __version__

LOG = logging.getLogger(__name__)

switches = [
    Switch('auto-refresh-allow', 'Allow consoles to auto-refresh alerts',
           SwitchState.ON),
    # Switch('console-api-allow', 'Allow consoles to use the alert API', SwitchState.ON),    # TODO(nsatterl)
    # Switch('sender-api-allow', 'Allow alerts to be submitted via the API', SwitchState.ON),  # TODO(nsatterl)
]
total_alert_gauge = Gauge('alerts', 'total', 'Total alerts',
                          'Total number of alerts in the database')
started = time.time() * 1000


@app.route('/management', methods=['OPTIONS', 'GET'])
@cross_origin()
def management():

    endpoints = [
        url_for('manifest'),
        url_for('properties'),
Esempio n. 2
0
import logging

from flask import request, Response, url_for, jsonify, render_template
from flask_cors import cross_origin

from alerta.app import app, db
from alerta.app.auth import permission
from alerta.app.switch import Switch, SwitchState
from alerta.app.metrics import Gauge, Counter, Timer
from alerta import build
from alerta.version import __version__

LOG = app.logger

switches = [
    Switch('auto-refresh-allow', 'Allow consoles to auto-refresh alerts',
           SwitchState.to_state(app.config['AUTO_REFRESH_ALLOW'])),
    Switch('sender-api-allow', 'Allow alerts to be submitted via the API',
           SwitchState.to_state(app.config['SENDER_API_ALLOW']))
]
total_alert_gauge = Gauge('alerts', 'total', 'Total alerts',
                          'Total number of alerts in the database')
started = time.time() * 1000


@app.route('/management', methods=['OPTIONS', 'GET'])
@cross_origin()
def management():

    endpoints = [
        url_for('manifest'),
        url_for('properties'),
Esempio n. 3
0
import logging

from flask import request, Response, url_for, jsonify, render_template
from flask_cors import cross_origin

from alerta.app import app, db
from alerta.app.auth import auth_required, admin_required
from alerta.app.switch import Switch, SwitchState
from alerta.app.metrics import Gauge, Counter, Timer
from alerta import build
from alerta.version import __version__

LOG = logging.getLogger(__name__)

switches = [
    Switch('auto-refresh-allow', 'Allow consoles to auto-refresh alerts',
           SwitchState.ON),
    Switch('sender-api-allow', 'Allow alerts to be submitted via the API',
           SwitchState.ON)
]
total_alert_gauge = Gauge('alerts', 'total', 'Total alerts',
                          'Total number of alerts in the database')
started = time.time() * 1000


@app.route('/management', methods=['OPTIONS', 'GET'])
@cross_origin()
def management():

    endpoints = [
        url_for('manifest'),
        url_for('properties'),