vigiboard / vigiboard / config / app_cfg.py @ cf3c2494
History | View | Annotate | Download (3.98 KB)
1 | d3c47597 | Francois POIROTTE | # -*- coding: utf-8 -*-
|
---|---|---|---|
2 | 2e5394d8 | Gabriel DE PERTHUIS | # vim: set fileencoding=utf-8 sw=4 ts=4 et :
|
3 | a77de887 | Francois POIROTTE | ################################################################################
|
4 | #
|
||
5 | 3b537383 | Francois POIROTTE | # Copyright (C) 2007-2011 CS-SI
|
6 | a77de887 | Francois POIROTTE | #
|
7 | # This program is free software; you can redistribute it and/or modify
|
||
8 | # it under the terms of the GNU General Public License version 2 as
|
||
9 | # published by the Free Software Foundation.
|
||
10 | #
|
||
11 | # This program is distributed in the hope that it will be useful,
|
||
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
14 | # GNU General Public License for more details.
|
||
15 | #
|
||
16 | # You should have received a copy of the GNU General Public License
|
||
17 | # along with this program; if not, write to the Free Software
|
||
18 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||
19 | ################################################################################
|
||
20 | |||
21 | 57f7cb3f | Gabriel DE PERTHUIS | """
|
22 | Global configuration file for TG2-specific settings in vigiboard.
|
||
23 |
|
||
24 | This file complements development/deployment.ini.
|
||
25 |
|
||
26 | Please note that **all the argument values are strings**. If you want to
|
||
27 | convert them into boolean, for example, you should use the
|
||
28 | :func:`paste.deploy.converters.asbool` function, as in::
|
||
29 | 2e753457 | Francois POIROTTE |
|
30 | 57f7cb3f | Gabriel DE PERTHUIS | from paste.deploy.converters import asbool
|
31 | setting = asbool(global_conf.get('the_setting'))
|
||
32 | 2e753457 | Francois POIROTTE |
|
33 | 57f7cb3f | Gabriel DE PERTHUIS | """
|
34 | |||
35 | 10848680 | Francois POIROTTE | from vigilo.turbogears import VigiloAppConfig |
36 | d3c47597 | Francois POIROTTE | |
37 | 57f7cb3f | Gabriel DE PERTHUIS | import vigiboard |
38 | d3c47597 | Francois POIROTTE | from vigiboard.lib import app_globals, helpers |
39 | 57f7cb3f | Gabriel DE PERTHUIS | |
40 | cf3c2494 | Vincent QUEMENER | import logging |
41 | LOGGER = logging.getLogger(__name__) |
||
42 | |||
43 | 65383903 | Francois POIROTTE | class VigiboardConfig(VigiloAppConfig): |
44 | def setup_sqlalchemy(self): |
||
45 | super(VigiboardConfig, self).setup_sqlalchemy() |
||
46 | |||
47 | # On est obligés d'attendre que la base de données
|
||
48 | # soit configurée pour charger les plugins.
|
||
49 | from pkg_resources import working_set |
||
50 | from vigiboard.controllers.plugins import VigiboardRequestPlugin |
||
51 | from tg import config |
||
52 | |||
53 | plugins = [] |
||
54 | for plugin_name in config['vigiboard_plugins']: |
||
55 | try:
|
||
56 | ep = working_set.iter_entry_points( |
||
57 | "vigiboard.columns", plugin_name).next()
|
||
58 | except StopIteration: |
||
59 | pass
|
||
60 | |||
61 | if ep.name in dict(plugins): |
||
62 | continue
|
||
63 | |||
64 | try:
|
||
65 | plugin_class = ep.load(require=True)
|
||
66 | if issubclass(plugin_class, VigiboardRequestPlugin): |
||
67 | plugins.append((unicode(ep.name), plugin_class()))
|
||
68 | cf3c2494 | Vincent QUEMENER | except Exception, e: |
69 | LOGGER.error('Unable to import plugin %s : %s' % (plugin_name, e))
|
||
70 | |||
71 | 65383903 | Francois POIROTTE | config['columns_plugins'] = plugins
|
72 | |||
73 | base_config = VigiboardConfig('vigiboard')
|
||
74 | 57f7cb3f | Gabriel DE PERTHUIS | base_config.package = vigiboard |
75 | |||
76 | 0f56fff9 | Francois POIROTTE | ##################################
|
77 | # Settings specific to Vigiboard #
|
||
78 | ##################################
|
||
79 | |||
80 | 228aad1c | Francois POIROTTE | # Configuration des liens
|
81 | a2a22ade | Francois POIROTTE | # Les elements suivants peuvent etre utilises dans la chaine de formatage :
|
82 | 94f31908 | Francois POIROTTE | # - %(idcorrevent)d : identifiant de l'aggregat (alerte correlee)
|
83 | # - %(host)s : le nom de l'hote concerne par l'alerte
|
||
84 | # - %(service)s : le nom du service concerne par l'alerte
|
||
85 | # - %(message) : le message transmis par Nagios dans l'alerte
|
||
86 | e48c54c4 | Francois POIROTTE | #
|
87 | # Permet de satisfaire l'exigence VIGILO_EXIG_VIGILO_BAC_0130.
|
||
88 | 65383903 | Francois POIROTTE | base_config['vigiboard_links.eventdetails'] = (
|
89 | ( |
||
90 | 8511a939 | Francois POIROTTE | u'Détail de l\'hôte dans Nagios',
|
91 | 6e76504a | Francois POIROTTE | '/nagios/%(host)s/cgi-bin/status.cgi?host=%(host)s'
|
92 | 65383903 | Francois POIROTTE | ), ( |
93 | 8511a939 | Francois POIROTTE | u'Détail de la métrologie',
|
94 | 80e68d9c | Francois POIROTTE | 'http://vigilo.example.com/vigigraph/rpc/fullHostPage?host=%(host)s'
|
95 | 65383903 | Francois POIROTTE | ), ( |
96 | 8511a939 | Francois POIROTTE | u'Détail de la sécurité',
|
97 | 6e76504a | Francois POIROTTE | 'http://security.example.com/?host=%(host)s'
|
98 | 65383903 | Francois POIROTTE | ), ( |
99 | 8511a939 | Francois POIROTTE | 'Inventaire',
|
100 | 6e76504a | Francois POIROTTE | 'http://cmdb.example.com/?host=%(host)s'
|
101 | 65383903 | Francois POIROTTE | ), ( |
102 | 6e76504a | Francois POIROTTE | 'Documentation',
|
103 | 'http://doc.example.com/?q=%(message)s'
|
||
104 | 65383903 | Francois POIROTTE | ), |
105 | ) |
||
106 | 0f56fff9 | Francois POIROTTE | |
107 | 228aad1c | Francois POIROTTE | # URL des tickets, possibilités:
|
108 | 94f31908 | Francois POIROTTE | # - %(idcorrevent)d
|
109 | 228aad1c | Francois POIROTTE | # - %(host)s
|
110 | # - %(service)s
|
||
111 | # - %(tt)s
|
||
112 | 4c949ec9 | Francois POIROTTE | base_config['vigiboard_links.tt'] = 'http://bugs.example.com/?ticket=%(tt)s' |
113 | 228aad1c | Francois POIROTTE | |
114 | 0f56fff9 | Francois POIROTTE | # Plugins to use
|
115 | 65383903 | Francois POIROTTE | base_config['vigiboard_plugins'] = (
|
116 | 'details',
|
||
117 | 'date',
|
||
118 | 'priority',
|
||
119 | 'occurrences',
|
||
120 | 'hostname',
|
||
121 | 'servicename',
|
||
122 | 'output',
|
||
123 | 'hls',
|
||
124 | 'status',
|
||
125 | ) |