Revision a45763b4
Suite du renommage de EventsAggregate en CorrEvent dans VigiBoard.
git-svn-id: https://vigilo-dev.si.c-s.fr/svn@1349 b22e2e97-25c9-44ff-b637-2e5ceca36478
development.ini | ||
---|---|---|
47 | 47 |
; - %(host)s |
48 | 48 |
; - %(service)s |
49 | 49 |
; - %(tt)s |
50 |
vigiboard_links.tt = http://example4.com/%%(idaggregate)s/%%(tt)s
|
|
50 |
vigiboard_links.tt = http://example4.com/%%(idcorrevent)d/%%(tt)s
|
|
51 | 51 |
|
52 | 52 |
; Default font size, must be a valid size as per the CSS 2.1 specification. |
53 | 53 |
; See http://www.w3.org/TR/CSS21/fonts.html#font-size-props |
vigiboard/config/app_cfg.py | ||
---|---|---|
74 | 74 |
# Links configuration |
75 | 75 |
# XXX Should be part of ini settings. |
76 | 76 |
# Les elements suivants peuvent etre utilises dans la chaine de formatage : |
77 |
# - idaggregate : identifiant de l'aggregat (alerte correlee)
|
|
77 |
# - idcorrevent : identifiant de l'aggregat (alerte correlee)
|
|
78 | 78 |
# - host : le nom de l'hote concerne par l'alerte |
79 | 79 |
# - service : le nom du service concerne par l'alerte |
80 | 80 |
base_config['vigiboard_links.eventdetails'] = { |
81 |
'nagios': ['Nagios host details', 'http://example1.com/%(idaggregate)s'],
|
|
82 |
'metrology': ['Metrology details', 'http://example2.com/%(idaggregate)s'],
|
|
83 |
'security': ['Security details', 'http://example3.com/%(idaggregate)s'],
|
|
84 |
'servicetype': ['Service Type', 'http://example4.com/%(idaggregate)s'],
|
|
81 |
'nagios': ['Nagios host details', 'http://example1.com/%(idcorrevent)d'],
|
|
82 |
'metrology': ['Metrology details', 'http://example2.com/%(idcorrevent)d'],
|
|
83 |
'security': ['Security details', 'http://example3.com/%(idcorrevent)d'],
|
|
84 |
'servicetype': ['Service Type', 'http://example4.com/%(idcorrevent)d'],
|
|
85 | 85 |
} |
86 | 86 |
|
87 | 87 |
# Plugins to use |
vigiboard/controllers/root.py | ||
---|---|---|
146 | 146 |
refresh_times=self.refresh_times, |
147 | 147 |
) |
148 | 148 |
|
149 |
@validate(validators={'idaggregate':validators.String(not_empty=True)},
|
|
149 |
@validate(validators={'idcorrevent':validators.String(not_empty=True)},
|
|
150 | 150 |
error_handler=process_form_errors) |
151 | 151 |
@expose('json') |
152 | 152 |
@require(Any(not_anonymous(), msg=_("You need to be authenticated"))) |
153 |
def history_dialog(self, idaggregate):
|
|
153 |
def history_dialog(self, idcorrevent):
|
|
154 | 154 |
|
155 | 155 |
""" |
156 | 156 |
JSon renvoyant les éléments pour l'affichage de la fenêtre de dialogue |
... | ... | |
172 | 172 |
(Event, CorrEvent.idcause == Event.idevent), |
173 | 173 |
(HostGroup, Event.hostname == HostGroup.hostname), |
174 | 174 |
).filter(HostGroup.idgroup.in_(user.groups) |
175 |
).filter(CorrEvent.idcorrevent == idaggregate
|
|
175 |
).filter(CorrEvent.idcorrevent == idcorrevent
|
|
176 | 176 |
).one() |
177 | 177 |
|
178 | 178 |
history = DBSession.query( |
... | ... | |
186 | 186 |
config['vigiboard_links.eventdetails'].iteritems(): |
187 | 187 |
|
188 | 188 |
eventdetails[edname] = edlink[1] % { |
189 |
'idaggregate': idaggregate,
|
|
189 |
'idcorrevent': idcorrevent,
|
|
190 | 190 |
'host': event[1].hostname, |
191 | 191 |
'service': event[1].servicename |
192 | 192 |
} |
... | ... | |
198 | 198 |
event[1].initial_state), |
199 | 199 |
peak_state = StateName.value_to_statename( |
200 | 200 |
event[1].peak_state), |
201 |
idaggregate = idaggregate,
|
|
201 |
idcorrevent = idcorrevent,
|
|
202 | 202 |
host = event[1].hostname, |
203 | 203 |
service = event[1].servicename, |
204 | 204 |
eventdetails = eventdetails, |
205 | 205 |
) |
206 | 206 |
|
207 |
@validate(validators={'idaggregate':validators.String(not_empty=True)},
|
|
207 |
@validate(validators={'idcorrevent':validators.String(not_empty=True)},
|
|
208 | 208 |
error_handler=process_form_errors) |
209 | 209 |
@expose('vigiboard.html') |
210 | 210 |
@require(Any(not_anonymous(), msg=_("You need to be authenticated"))) |
211 |
def event(self, idaggregate):
|
|
211 |
def event(self, idcorrevent):
|
|
212 | 212 |
""" |
213 | 213 |
Affichage de l'historique d'un événement. |
214 | 214 |
Pour accéder à cette page, l'utilisateur doit être authentifié. |
... | ... | |
218 | 218 |
|
219 | 219 |
username = request.environ['repoze.who.identity']['repoze.who.userid'] |
220 | 220 |
events = VigiboardRequest(User.by_user_name(username)) |
221 |
events.add_filter(CorrEvent.idcorrevent == idaggregate)
|
|
221 |
events.add_filter(CorrEvent.idcorrevent == idcorrevent)
|
|
222 | 222 |
|
223 | 223 |
# Vérification que l'événement existe |
224 | 224 |
if events.num_rows() != 1 : |
vigiboard/controllers/vigiboard_plugin/shn.py | ||
---|---|---|
30 | 30 |
"""Fonction d'affichage""" |
31 | 31 |
dico = { |
32 | 32 |
'baseurl': url('/'), |
33 |
'idaggregate': aggregate.idcorrevent,
|
|
33 |
'idcorrevent': aggregate.idcorrevent,
|
|
34 | 34 |
'impacted_hls': aggregate.high_level_services.count(), |
35 | 35 |
} |
36 | 36 |
# XXX Il faudrait échapper l'URL contenue dans baseurl |
37 | 37 |
# pour éviter des attaques de type XSS. |
38 | 38 |
res = ('<a href="javascript:vigiboard_shndialog(' + \ |
39 |
'\'%(baseurl)s\',\'%(idaggregate)s\')" ' + \
|
|
39 |
'\'%(baseurl)s\',\'%(idcorrevent)d\')" ' + \
|
|
40 | 40 |
'class="SHNLien">%(impacted_hls)d</a>') % dico |
41 | 41 |
return res |
42 | 42 |
|
... | ... | |
54 | 54 |
|
55 | 55 |
def controller(self, *argv, **krgv): |
56 | 56 |
"""Ajout de fonctionnalités au contrôleur""" |
57 |
idaggregate = krgv['idaggregate']
|
|
57 |
idcorrevent = krgv['idcorrevent']
|
|
58 | 58 |
correvent = DBSession.query(CorrEvent) \ |
59 |
.filter(CorrEvent.idcorrevent == idaggregate).one()
|
|
59 |
.filter(CorrEvent.idcorrevent == idcorrevent).one()
|
|
60 | 60 |
shns = correvent.high_level_services |
61 | 61 |
|
62 | 62 |
return dict(shns=[shn.name for shn in shns]) |
Also available in: Unified diff