vigiboard / app_cfg.py @ 6134024a
History | View | Annotate | Download (3.93 KB)
1 | d3c47597 | Francois POIROTTE | # -*- coding: utf-8 -*-
|
---|---|---|---|
2 | 2e5394d8 | Gabriel DE PERTHUIS | # vim: set fileencoding=utf-8 sw=4 ts=4 et :
|
3 | 2bcebf54 | Francois POIROTTE | # Copyright (C) 2007-2016 CS-SI
|
4 | 379ffecb | Francois POIROTTE | # License: GNU GPL v2 <http://www.gnu.org/licenses/gpl-2.0.html>
|
5 | a77de887 | Francois POIROTTE | |
6 | 57f7cb3f | Gabriel DE PERTHUIS | """
|
7 | Global configuration file for TG2-specific settings in vigiboard.
|
||
8 |
|
||
9 | This file complements development/deployment.ini.
|
||
10 |
|
||
11 | Please note that **all the argument values are strings**. If you want to
|
||
12 | convert them into boolean, for example, you should use the
|
||
13 | :func:`paste.deploy.converters.asbool` function, as in::
|
||
14 | 2e753457 | Francois POIROTTE |
|
15 | 57f7cb3f | Gabriel DE PERTHUIS | from paste.deploy.converters import asbool
|
16 | setting = asbool(global_conf.get('the_setting'))
|
||
17 | 2e753457 | Francois POIROTTE |
|
18 | 57f7cb3f | Gabriel DE PERTHUIS | """
|
19 | |||
20 | 10848680 | Francois POIROTTE | from vigilo.turbogears import VigiloAppConfig |
21 | d3c47597 | Francois POIROTTE | |
22 | 57f7cb3f | Gabriel DE PERTHUIS | import vigiboard |
23 | 02c4a1e7 | Francois POIROTTE | from vigiboard.lib import app_globals # pylint: disable-msg=W0611 |
24 | 8b2edebe | Aurelien BOMPARD | # W0611: Unused import: imports nécessaires pour le fonctionnement
|
25 | |||
26 | 57f7cb3f | Gabriel DE PERTHUIS | |
27 | cf3c2494 | Vincent QUEMENER | import logging |
28 | LOGGER = logging.getLogger(__name__) |
||
29 | |||
30 | 65383903 | Francois POIROTTE | class VigiboardConfig(VigiloAppConfig): |
31 | def setup_sqlalchemy(self): |
||
32 | super(VigiboardConfig, self).setup_sqlalchemy() |
||
33 | |||
34 | # On est obligés d'attendre que la base de données
|
||
35 | # soit configurée pour charger les plugins.
|
||
36 | from pkg_resources import working_set |
||
37 | from vigiboard.controllers.plugins import VigiboardRequestPlugin |
||
38 | from tg import config |
||
39 | |||
40 | plugins = [] |
||
41 | for plugin_name in config['vigiboard_plugins']: |
||
42 | try:
|
||
43 | ep = working_set.iter_entry_points( |
||
44 | "vigiboard.columns", plugin_name).next()
|
||
45 | except StopIteration: |
||
46 | pass
|
||
47 | |||
48 | if ep.name in dict(plugins): |
||
49 | continue
|
||
50 | |||
51 | try:
|
||
52 | plugin_class = ep.load(require=True)
|
||
53 | if issubclass(plugin_class, VigiboardRequestPlugin): |
||
54 | plugins.append((unicode(ep.name), plugin_class()))
|
||
55 | 8b2edebe | Aurelien BOMPARD | except Exception: # pylint: disable-msg=W0703 |
56 | # W0703: Catch "Exception"
|
||
57 | 27140946 | Francois POIROTTE | LOGGER.exception(u'Unable to import plugin %s', plugin_name)
|
58 | cf3c2494 | Vincent QUEMENER | |
59 | 65383903 | Francois POIROTTE | config['columns_plugins'] = plugins
|
60 | |||
61 | 2bb1dbfc | Francois POIROTTE | base_config = VigiboardConfig('VigiBoard')
|
62 | 57f7cb3f | Gabriel DE PERTHUIS | base_config.package = vigiboard |
63 | a2fa6a5b | Francois POIROTTE | base_config.mimetype_lookup = { |
64 | '.csv': 'text/csv', |
||
65 | } |
||
66 | 57f7cb3f | Gabriel DE PERTHUIS | |
67 | 0f56fff9 | Francois POIROTTE | ##################################
|
68 | # Settings specific to Vigiboard #
|
||
69 | ##################################
|
||
70 | |||
71 | 228aad1c | Francois POIROTTE | # Configuration des liens
|
72 | a2a22ade | Francois POIROTTE | # Les elements suivants peuvent etre utilises dans la chaine de formatage :
|
73 | 94f31908 | Francois POIROTTE | # - %(idcorrevent)d : identifiant de l'aggregat (alerte correlee)
|
74 | # - %(host)s : le nom de l'hote concerne par l'alerte
|
||
75 | # - %(service)s : le nom du service concerne par l'alerte
|
||
76 | # - %(message) : le message transmis par Nagios dans l'alerte
|
||
77 | e48c54c4 | Francois POIROTTE | #
|
78 | # Permet de satisfaire l'exigence VIGILO_EXIG_VIGILO_BAC_0130.
|
||
79 | 65383903 | Francois POIROTTE | base_config['vigiboard_links.eventdetails'] = (
|
80 | 147b6daa | Francois POIROTTE | { |
81 | 'label': u'Détail de l\'hôte dans Nagios', |
||
82 | 'uri': '/nagios/%(host)s/cgi-bin/status.cgi?host=%(host)s', |
||
83 | }, |
||
84 | { |
||
85 | 'label': u'Détail de la métrologie', |
||
86 | 'uri': 'http://vigilo.example.com/vigilo/vigigraph/rpc/fullHostPage?host=%(host)s', |
||
87 | }, |
||
88 | { |
||
89 | 'label': u'Détail de la sécurité', |
||
90 | 'uri': 'http://security.example.com/?host=%(host)s', |
||
91 | }, |
||
92 | { |
||
93 | 'label': 'Inventaire', |
||
94 | 'uri': 'http://cmdb.example.com/?host=%(host)s', |
||
95 | }, |
||
96 | { |
||
97 | 'label': 'Documentation', |
||
98 | 'uri': 'http://doc.example.com/?q=%(message)s', |
||
99 | }, |
||
100 | 65383903 | Francois POIROTTE | ) |
101 | 0f56fff9 | Francois POIROTTE | |
102 | 228aad1c | Francois POIROTTE | # URL des tickets, possibilités:
|
103 | 94f31908 | Francois POIROTTE | # - %(idcorrevent)d
|
104 | 228aad1c | Francois POIROTTE | # - %(host)s
|
105 | # - %(service)s
|
||
106 | # - %(tt)s
|
||
107 | 4c949ec9 | Francois POIROTTE | base_config['vigiboard_links.tt'] = 'http://bugs.example.com/?ticket=%(tt)s' |
108 | 228aad1c | Francois POIROTTE | |
109 | 0f56fff9 | Francois POIROTTE | # Plugins to use
|
110 | 65383903 | Francois POIROTTE | base_config['vigiboard_plugins'] = (
|
111 | f37d1e09 | Francois POIROTTE | # 'id',
|
112 | 65383903 | Francois POIROTTE | 'details',
|
113 | ce8fee78 | Francois POIROTTE | # 'state',
|
114 | 27140946 | Francois POIROTTE | 'groups',
|
115 | 65383903 | Francois POIROTTE | 'date',
|
116 | 'priority',
|
||
117 | 'occurrences',
|
||
118 | 'hostname',
|
||
119 | 'servicename',
|
||
120 | 'output',
|
||
121 | 3e5985c8 | Francois POIROTTE | # 'masked_events',
|
122 | 65383903 | Francois POIROTTE | 'hls',
|
123 | 'status',
|
||
124 | f37d1e09 | Francois POIROTTE | # 'test',
|
125 | ecf084d9 | Francois POIROTTE | 'map',
|
126 | 65383903 | Francois POIROTTE | ) |
127 | a2fa6a5b | Francois POIROTTE | |
128 | base_config['csv_columns'] = (
|
||
129 | 'id',
|
||
130 | 'state',
|
||
131 | 'initial_state',
|
||
132 | 'peak_state',
|
||
133 | 'date',
|
||
134 | 'duration',
|
||
135 | 'priority',
|
||
136 | 'occurrences',
|
||
137 | 'hostname',
|
||
138 | 'servicename',
|
||
139 | 'output',
|
||
140 | 'ack',
|
||
141 | 'trouble_ticket_id',
|
||
142 | 'trouble_ticket_link',
|
||
143 | ) |