Revision 60c3c88e
Association des PerfDataSource avec un hôte directement plutôt qu'avec un service de bas niveau.
Adaptation des tests du modèle, du code de VigiMap et du code de VigiGraph en conséquence.
git-svn-id: https://vigilo-dev.si.c-s.fr/svn@3229 b22e2e97-25c9-44ff-b637-2e5ceca36478
vigigraph/controllers/rpc.py | ||
---|---|---|
23 | 23 |
from vigilo.turbogears.helpers import get_current_user |
24 | 24 |
|
25 | 25 |
from vigilo.models.session import DBSession |
26 |
from vigilo.models.tables import LowLevelService, Host
|
|
26 |
from vigilo.models.tables import Host |
|
27 | 27 |
from vigilo.models.tables import SupItemGroup |
28 | 28 |
from vigilo.models.tables import PerfDataSource |
29 | 29 |
from vigilo.models.tables import Graph, GraphGroup |
... | ... | |
213 | 213 |
Host.name, |
214 | 214 |
Host.idhost, |
215 | 215 |
).distinct( |
216 |
).outerjoin( |
|
217 |
(LowLevelService, LowLevelService.idhost == Host.idhost), |
|
218 | 216 |
).join( |
219 |
(SUPITEM_GROUP_TABLE, or_( |
|
220 |
SUPITEM_GROUP_TABLE.c.idsupitem == Host.idhost, |
|
221 |
SUPITEM_GROUP_TABLE.c.idsupitem == |
|
222 |
LowLevelService.idservice, |
|
223 |
)), |
|
217 |
(SUPITEM_GROUP_TABLE, SUPITEM_GROUP_TABLE.c.idsupitem == \ |
|
218 |
Host.idhost), |
|
224 | 219 |
).filter(SUPITEM_GROUP_TABLE.c.idgroup == othergroupid |
225 | 220 |
).filter(SUPITEM_GROUP_TABLE.c.idgroup.in_(groups_with_parents) |
226 | 221 |
).order_by( |
... | ... | |
267 | 262 |
GRAPH_PERFDATASOURCE_TABLE.c.idgraph == Graph.idgraph), |
268 | 263 |
(PerfDataSource, PerfDataSource.idperfdatasource == \ |
269 | 264 |
GRAPH_PERFDATASOURCE_TABLE.c.idperfdatasource), |
270 |
(LowLevelService, LowLevelService.idservice == \ |
|
271 |
PerfDataSource.idservice), |
|
272 |
(SUPITEM_GROUP_TABLE, or_( |
|
273 |
SUPITEM_GROUP_TABLE.c.idsupitem == LowLevelService.idhost, |
|
274 |
SUPITEM_GROUP_TABLE.c.idsupitem == |
|
275 |
LowLevelService.idservice, |
|
276 |
)), |
|
277 |
).filter(LowLevelService.idhost == idhost |
|
265 |
(SUPITEM_GROUP_TABLE, SUPITEM_GROUP_TABLE.c.idsupitem == \ |
|
266 |
PerfDataSource.idhost), |
|
267 |
).filter(PerfDataSource.idhost == idhost |
|
278 | 268 |
).order_by(GraphGroup.name.asc()) |
279 | 269 |
|
280 | 270 |
# Les managers ont accès à tout. |
... | ... | |
326 | 316 |
GRAPH_PERFDATASOURCE_TABLE.c.idgraph == Graph.idgraph), |
327 | 317 |
(PerfDataSource, PerfDataSource.idperfdatasource == \ |
328 | 318 |
GRAPH_PERFDATASOURCE_TABLE.c.idperfdatasource), |
329 |
(LowLevelService, LowLevelService.idservice == \ |
|
330 |
PerfDataSource.idservice), |
|
331 |
(SUPITEM_GROUP_TABLE, or_( |
|
332 |
SUPITEM_GROUP_TABLE.c.idsupitem == LowLevelService.idhost, |
|
333 |
SUPITEM_GROUP_TABLE.c.idsupitem == |
|
334 |
LowLevelService.idservice, |
|
335 |
)), |
|
319 |
(SUPITEM_GROUP_TABLE, SUPITEM_GROUP_TABLE.c.idsupitem == \ |
|
320 |
PerfDataSource.idhost), |
|
336 | 321 |
).filter(GraphGroup.idgroup == idgraphgroup |
337 |
).filter(LowLevelService.idhost == idhost
|
|
322 |
).filter(PerfDataSource.idhost == idhost
|
|
338 | 323 |
).order_by(Graph.name.asc()) |
339 | 324 |
|
340 | 325 |
# Les managers ont accès à tout. |
... | ... | |
394 | 379 |
Host.name.label('hostname'), |
395 | 380 |
Graph.name.label('graphname'), |
396 | 381 |
).distinct().join( |
397 |
(LowLevelService, LowLevelService.idhost == Host.idhost), |
|
398 |
(PerfDataSource, PerfDataSource.idservice == \ |
|
399 |
LowLevelService.idservice), |
|
382 |
(PerfDataSource, PerfDataSource.idhost == Host.idhost), |
|
400 | 383 |
(GRAPH_PERFDATASOURCE_TABLE, \ |
401 | 384 |
GRAPH_PERFDATASOURCE_TABLE.c.idperfdatasource == \ |
402 | 385 |
PerfDataSource.idperfdatasource), |
403 | 386 |
(Graph, Graph.idgraph == \ |
404 | 387 |
GRAPH_PERFDATASOURCE_TABLE.c.idgraph), |
405 |
(SUPITEM_GROUP_TABLE, or_( |
|
406 |
SUPITEM_GROUP_TABLE.c.idsupitem == Host.idhost, |
|
407 |
SUPITEM_GROUP_TABLE.c.idsupitem == |
|
408 |
LowLevelService.idservice, |
|
409 |
)), |
|
388 |
(SUPITEM_GROUP_TABLE, SUPITEM_GROUP_TABLE.c.idsupitem == \ |
|
389 |
Host.idhost), |
|
410 | 390 |
).filter(Host.name.ilike('%' + host + '%') |
411 | 391 |
).filter(Graph.name.ilike('%' + graph + '%') |
412 | 392 |
).order_by( |
... | ... | |
669 | 649 |
GRAPH_PERFDATASOURCE_TABLE.c.idgraph == Graph.idgraph), |
670 | 650 |
(PerfDataSource, PerfDataSource.idperfdatasource == |
671 | 651 |
GRAPH_PERFDATASOURCE_TABLE.c.idperfdatasource), |
672 |
(LowLevelService, LowLevelService.idservice == |
|
673 |
PerfDataSource.idservice), |
|
674 |
).outerjoin( |
|
675 |
(Host, Host.idhost == LowLevelService.idhost), |
|
676 |
).join( |
|
677 |
(SUPITEM_GROUP_TABLE, or_( |
|
678 |
SUPITEM_GROUP_TABLE.c.idsupitem == |
|
679 |
LowLevelService.idservice, |
|
680 |
SUPITEM_GROUP_TABLE.c.idsupitem == Host.idhost, |
|
681 |
)) |
|
652 |
(Host, Host.idhost == PerfDataSource.idhost), |
|
653 |
(SUPITEM_GROUP_TABLE, SUPITEM_GROUP_TABLE.c.idsupitem == \ |
|
654 |
Host.idhost), |
|
682 | 655 |
) |
683 | 656 |
|
684 | 657 |
# Les managers ont accès à tout. |
... | ... | |
775 | 748 |
hosts = DBSession.query( |
776 | 749 |
Host.name, |
777 | 750 |
).distinct( |
778 |
).outerjoin( |
|
779 |
(LowLevelService, LowLevelService.idhost == Host.idhost), |
|
780 | 751 |
).join( |
781 |
(SUPITEM_GROUP_TABLE, or_( |
|
782 |
SUPITEM_GROUP_TABLE.c.idsupitem == Host.idhost, |
|
783 |
SUPITEM_GROUP_TABLE.c.idsupitem == |
|
784 |
LowLevelService.idservice, |
|
785 |
)), |
|
752 |
(SUPITEM_GROUP_TABLE, SUPITEM_GROUP_TABLE.c.idsupitem == \ |
|
753 |
Host.idhost), |
|
786 | 754 |
).filter(Host.name.like(query + '%') |
787 | 755 |
).order_by( |
788 | 756 |
Host.name.asc(), |
... | ... | |
822 | 790 |
|
823 | 791 |
indicators = [] |
824 | 792 |
if graph is not None: |
825 |
indicators = DBSession.query \ |
|
826 |
(PerfDataSource.name) \ |
|
827 |
.join((GRAPH_PERFDATASOURCE_TABLE, \ |
|
828 |
GRAPH_PERFDATASOURCE_TABLE.c.idperfdatasource == \ |
|
829 |
PerfDataSource.idperfdatasource)) \ |
|
830 |
.join((Graph, \ |
|
831 |
Graph.idgraph == GRAPH_PERFDATASOURCE_TABLE.c.idgraph)) \ |
|
832 |
.filter(Graph.name == graph) \ |
|
833 |
.all() |
|
793 |
indicators = DBSession.query( |
|
794 |
PerfDataSource.name |
|
795 |
).join( |
|
796 |
(GRAPH_PERFDATASOURCE_TABLE, \ |
|
797 |
GRAPH_PERFDATASOURCE_TABLE.c.idperfdatasource == \ |
|
798 |
PerfDataSource.idperfdatasource), |
|
799 |
(Graph, Graph.idgraph == \ |
|
800 |
GRAPH_PERFDATASOURCE_TABLE.c.idgraph), |
|
801 |
).filter(Graph.name == graph |
|
802 |
).all() |
|
834 | 803 |
return indicators |
835 | 804 |
|
Also available in: Unified diff