Revision 09301287
Actualisation commentaires
git-svn-id: https://vigilo-dev.si.c-s.fr/svn@2455 b22e2e97-25c9-44ff-b637-2e5ceca36478
vigigraph/controllers/rpc.py | ||
---|---|---|
56 | 56 |
@expose('json') |
57 | 57 |
def maingroups(self, nocache=None): |
58 | 58 |
""" |
59 |
Render the JSON document for the combobox Main Group
|
|
59 |
Determination des groupes principaux (sans parent)
|
|
60 | 60 |
|
61 | 61 |
@return : groupes principaux |
62 |
@rtype: dict (sous forme json)
|
|
62 |
@rtype : document json (sous forme de dict)
|
|
63 | 63 |
""" |
64 | 64 |
topgroups = DBSession.query(HostGroup.name, HostGroup.idgroup) \ |
65 | 65 |
.filter(HostGroup.parent == None) \ |
... | ... | |
73 | 73 |
@expose('json') |
74 | 74 |
def hostgroups(self, maingroupid, nocache=None): |
75 | 75 |
""" |
76 |
Render the JSON document for the combobox Other Group |
|
76 |
Determination des groupes associes au groupe parent |
|
77 |
dont identificateur = argument |
|
77 | 78 |
|
78 | 79 |
@param maingroupid : identificateur d un groupe principal |
79 | 80 |
@type maingroupid : int |
80 | 81 |
|
81 | 82 |
@return : groupes |
82 |
@rtype: dict (sous forme json)
|
|
83 |
@rtype : document json (sous forme de dict)
|
|
83 | 84 |
""" |
84 | 85 |
hostgroups = DBSession.query(HostGroup.name, HostGroup.idgroup)\ |
85 | 86 |
.filter(HostGroup.idparent == maingroupid) \ |
... | ... | |
92 | 93 |
@expose('json') |
93 | 94 |
def hosts(self, othergroupid, nocache=None): |
94 | 95 |
""" |
95 |
Render the JSON document for the combobox Host Name |
|
96 |
Determination des hotes associes au groupe |
|
97 |
dont identificateur = argument |
|
96 | 98 |
|
97 | 99 |
@param othergroupid : identificateur d un groupe |
98 | 100 |
@type othergroupid : int |
99 | 101 |
|
100 | 102 |
@return : hotes |
101 |
@rtype: dict (sous forme json)
|
|
103 |
@rtype : document json (sous forme de dict)
|
|
102 | 104 |
""" |
103 | 105 |
hostgroup = DBSession.query(HostGroup) \ |
104 | 106 |
.filter(HostGroup.idgroup == othergroupid) \ |
... | ... | |
113 | 115 |
@expose('json') |
114 | 116 |
def servicegroups(self, idhost, nocache=None): |
115 | 117 |
""" |
116 |
Render the JSON document for the combobox Graph Group |
|
118 |
Determination des groupes de services associes a l hote |
|
119 |
dont identificateur = argument |
|
117 | 120 |
|
118 | 121 |
@param idhost : identificateur d un hote |
119 | 122 |
@type idhost : int |
120 | 123 |
|
121 | 124 |
@return : groupes de service |
122 |
@rtype: dict (sous forme json)
|
|
125 |
@rtype : document json (sous forme de dict)
|
|
123 | 126 |
""" |
124 | 127 |
# passage par une table intermédiaire à cause de l'héritage |
125 | 128 |
servicegroups = DBSession.query \ |
... | ... | |
139 | 142 |
@expose('json') |
140 | 143 |
def graphs(self, idservice, nocache=None): |
141 | 144 |
""" |
142 |
Render the JSON document for the combobox Graph Name |
|
145 |
Determination des graphes |
|
146 |
avec un service dont identificateur = argument |
|
143 | 147 |
|
144 | 148 |
@param idservice : identificateur d un service |
145 | 149 |
@type idservice : int |
146 | 150 |
|
147 | 151 |
@return : graphes |
148 |
@rtype: dict (sous forme json)
|
|
152 |
@rtype : document json (sous forme de dict)
|
|
149 | 153 |
""" |
150 | 154 |
graphs_l = DBSession.query(Graph.name, Graph.idgraph) \ |
151 | 155 |
.join((GRAPH_PERFDATASOURCE_TABLE, \ |
... | ... | |
164 | 168 |
@expose('json') |
165 | 169 |
def searchHostAndService(self, **kwargs): |
166 | 170 |
""" |
167 |
Render the JSON document for the Host and Service |
|
171 |
Determination des couples (hote-service) repondant aux criteres de |
|
172 |
recherche sur hote et/ou service |
|
173 |
|
|
174 |
Un critere peut correspondre a un intitule complet hote ou service |
|
175 |
ou a un extrait |
|
168 | 176 |
|
169 | 177 |
@param **kwargs : arguments nommes |
170 | 178 |
@type **kwargs : dict |
179 |
( arguments nommes -> host et service ) |
|
171 | 180 |
|
172 | 181 |
@return : couples hote-service |
173 |
@rtype: dict (sous forme json)
|
|
182 |
@rtype : document json (sous forme de dict)
|
|
174 | 183 |
""" |
175 | 184 |
host = kwargs.get('host') |
176 | 185 |
service = kwargs.get('service') |
... | ... | |
209 | 218 |
@expose('json') |
210 | 219 |
def selectHostAndService(self, **kwargs): |
211 | 220 |
""" |
212 |
Render the JSON document for the Host and Service
|
|
221 |
Determination (groupe principal-groupe-service) associe au couple (hote-service)
|
|
213 | 222 |
|
214 | 223 |
@param **kwargs : arguments nommes |
215 | 224 |
@type **kwargs : dict |
225 |
( arguments nommes -> host et service ) |
|
216 | 226 |
|
217 |
@return : groupes
|
|
218 |
@rtype: dict (sous forme json)
|
|
227 |
@return : (groupe principal-groupe-service)
|
|
228 |
@rtype : document json (sous forme de dict)
|
|
219 | 229 |
""" |
220 | 230 |
host = kwargs.get('host') |
221 | 231 |
#service = kwargs.get('service') |
... | ... | |
271 | 281 |
details=1, nocache=0): |
272 | 282 |
""" |
273 | 283 |
Determination de l url d un graphe |
274 |
(via proxy) |
|
284 |
(via proxy RRD)
|
|
275 | 285 |
|
276 | 286 |
@param host : hôte |
277 | 287 |
@type host : C{str} |
... | ... | |
279 | 289 |
@type start : C{str} |
280 | 290 |
@param duration : plage de temps des données |
281 | 291 |
@type duration : C{str} |
282 |
(parametre optionnel, initialise à 86400 = plage de 1 jour)
|
|
283 |
@param details : |
|
284 |
@type details : |
|
285 |
@param nocache :
|
|
286 |
@type nocache :
|
|
292 |
(parametre optionnel, initialise a 86400 = plage de 1 jour)
|
|
293 |
@param details : indicateur affichage details dans graphe (legende)
|
|
294 |
@type details : int
|
|
295 |
@param graph : graphe
|
|
296 |
@type graph : C{str}
|
|
287 | 297 |
|
288 | 298 |
@return : url du graphe |
289 | 299 |
@rtype: C{str} |
... | ... | |
323 | 333 |
details=1): |
324 | 334 |
""" |
325 | 335 |
Affichage de l image d un graphe |
326 |
(via proxy) |
|
336 |
(via proxy RRD)
|
|
327 | 337 |
|
328 | 338 |
@param host : hôte |
329 | 339 |
@type host : C{str} |
... | ... | |
331 | 341 |
@type start : C{str} |
332 | 342 |
@param duration : plage de temps des données |
333 | 343 |
@type duration : C{str} |
334 |
(parametre optionnel, initialise à 86400 = plage de 1 jour)
|
|
335 |
@param graph : |
|
344 |
(parametre optionnel, initialise a 86400 = plage de 1 jour)
|
|
345 |
@param graph : graphe
|
|
336 | 346 |
@type graph : C{str} |
337 |
@param details : |
|
338 |
@type details : |
|
347 |
@param details : indicateur affichage details dans graphe (legende)
|
|
348 |
@type details : int
|
|
339 | 349 |
|
340 |
@return : page avec l image du graphe
|
|
341 |
@rtype: page
|
|
350 |
@return : image du graphe |
|
351 |
@rtype: image png
|
|
342 | 352 |
""" |
343 | 353 |
result = None |
344 | 354 |
|
... | ... | |
388 | 398 |
def getStartTime(self, host, nocache=None): |
389 | 399 |
""" |
390 | 400 |
Determination de la date-heure de debut des donnees RRD d un hote |
391 |
(via proxy) |
|
401 |
(via proxy RRD)
|
|
392 | 402 |
|
393 | 403 |
@param host : hôte |
394 | 404 |
@type host : C{str} |
395 | 405 |
|
396 | 406 |
@return : date-heure de debut des donnees RRD |
397 |
@rtype: |
|
407 |
@rtype: C{str}
|
|
398 | 408 |
""" |
399 | 409 |
|
400 | 410 |
result = None |
... | ... | |
424 | 434 |
def supPage(self, host): |
425 | 435 |
""" |
426 | 436 |
Affichage page supervision Nagios pour un hote |
427 |
(via proxy)
|
|
428 |
|
|
437 |
(appel fonction status via proxy Nagios)
|
|
438 |
|
|
429 | 439 |
@param host : hôte |
430 | 440 |
@type host : C{str} |
431 | 441 |
|
... | ... | |
457 | 467 |
def servicePage(self, host, service=None): |
458 | 468 |
""" |
459 | 469 |
Affichage page supervision Nagios pour un hote |
460 |
(via proxy)
|
|
470 |
(appel fonction get_extinfo via proxy Nagios)
|
|
461 | 471 |
|
462 | 472 |
@param host : hôte |
463 | 473 |
@type host : C{str} |
... | ... | |
494 | 504 |
def metroPage(self, host): |
495 | 505 |
""" |
496 | 506 |
Affichage page metrologie pour un hote |
497 |
(via proxy) |
|
507 |
(via proxy RRD)
|
|
498 | 508 |
|
499 | 509 |
@param host : hôte |
500 | 510 |
@type host : C{str} |
... | ... | |
526 | 536 |
@expose('graphslist.html', content_type='text/html') |
527 | 537 |
def graphsList(self, nocache=None, **kwargs): |
528 | 538 |
""" |
529 |
Liste de graphes |
|
530 |
|
|
539 |
Generation document avec url des graphes affiches |
|
540 |
(pour l impression ) |
|
541 |
|
|
531 | 542 |
@param **kwargs : arguments nommes |
532 | 543 |
@type **kwargs : dict |
533 | 544 |
|
534 |
@return : dictionnaire applique sur un template -> graphslist.html
|
|
535 |
@rtype: dict
|
|
545 |
@return : url de graphes
|
|
546 |
@rtype: document html
|
|
536 | 547 |
""" |
537 | 548 |
graphslist = graphs.graphsList(**kwargs) |
538 | 549 |
return dict(graphslist=graphslist) |
... | ... | |
540 | 551 |
@expose(content_type='text/plain') |
541 | 552 |
def tempoDelayRefresh(self, nocache=None): |
542 | 553 |
""" |
543 |
Lecture de la temporisation pour le rafraichissement automatique |
|
554 |
Determination valeur temporisation pour le rafraichissement automatique |
|
555 |
d un graphe |
|
544 | 556 |
|
545 | 557 |
@return : valeur de temporisation |
546 |
@return : C{str}
|
|
558 |
@rtype : C{str}
|
|
547 | 559 |
""" |
548 | 560 |
|
549 | 561 |
delay = graphs.tempoDelayRefresh() |
... | ... | |
556 | 568 |
|
557 | 569 |
@param graph : graphe |
558 | 570 |
@type graph : C{str} |
559 |
(parametre optionnel, initialise à None) |
|
560 | 571 |
|
561 |
@return : dictionnaire applique sur un template json
|
|
562 |
@return : dict
|
|
572 |
@return : dictionnaire des indicateurs d un graphe
|
|
573 |
@rtype : document json (sous forme de dict)
|
|
563 | 574 |
""" |
564 | 575 |
|
565 | 576 |
indicators = self.getListIndicators(graph) |
... | ... | |
574 | 585 |
|
575 | 586 |
@param graph : graphe |
576 | 587 |
@type graph : C{str} |
577 |
(parametre optionnel, initialise à None) |
|
578 | 588 |
|
579 | 589 |
@return : liste d indicateurs |
580 | 590 |
@rtype : list |
... | ... | |
599 | 609 |
start=None, end=None): |
600 | 610 |
""" |
601 | 611 |
Export CSV sous forme de fichier |
602 |
- pour un hote |
|
603 |
- pour un graphe
|
|
604 |
- pour un indicateur parmi ceux associes au graphe
|
|
605 |
ou l ensemble des indicateurs
|
|
612 |
- pour un hote et un graphe
|
|
613 |
- pour l'indicateur suivant
|
|
614 |
- soit un des indicateurs associes au graphe
|
|
615 |
- soit l ensemble des indicateurs -> valeur argument = All
|
|
606 | 616 |
|
607 | 617 |
@param host : hôte |
608 | 618 |
@type host : C{str} |
... | ... | |
613 | 623 |
@param start : date-heure de debut des donnees |
614 | 624 |
@type start : C{str} |
615 | 625 |
|
616 |
@return : donnees RRD dans fichier
|
|
626 |
@return : fichier genere avec les donnees RRD repondant aux criteres
|
|
617 | 627 |
@rtype : fichier CSV |
618 | 628 |
""" |
619 | 629 |
|
... | ... | |
742 | 752 |
@type host : C{str} |
743 | 753 |
@param start : date-heure de debut des donnees |
744 | 754 |
@type start : C{str} |
745 |
(parametre optionnel, initialise à None) |
|
746 | 755 |
@param duration : plage de temps des données |
747 | 756 |
@type duration : C{str} |
748 |
(parametre optionnel, initialise à 86400 = plage de 1 jour)
|
|
757 |
(parametre optionnel, initialise a 86400 = plage de 1 jour)
|
|
749 | 758 |
|
750 |
@return : dictionnaire applique sur un template -> fullhostpage.html
|
|
751 |
@rtype: dict
|
|
759 |
@return : page avec les images des graphes et boutons de deplacement dans le temps
|
|
760 |
@rtype: page html
|
|
752 | 761 |
""" |
753 | 762 |
|
754 | 763 |
presets = [ |
755 |
{"caption" : "Last 12h", "duration" : 43200},
|
|
756 |
{"caption" : "Last 24h", "duration" : 86400},
|
|
757 |
{"caption" : "Last 2d", "duration" : 192800},
|
|
758 |
{"caption" : "Last 7d", "duration" : 604800},
|
|
759 |
{"caption" : "Last 14d", "duration" : 1209600},
|
|
760 |
{"caption" : "Last 3m", "duration" : 86400*31*3},
|
|
761 |
{"caption" : "Last 6m", "duration" : 86400*183},
|
|
762 |
{"caption" : "Last year", "duration" : 86400*365},
|
|
764 |
{"caption" : _("Last %sh") % '12', "duration" : 43200},
|
|
765 |
{"caption" : _("Last %sh") % '24', "duration" : 86400},
|
|
766 |
{"caption" : _("Last %sd") % '2', "duration" : 192800},
|
|
767 |
{"caption" : _("Last %sd") % '7', "duration" : 604800},
|
|
768 |
{"caption" : _("Last %sd") % '14', "duration" : 1209600},
|
|
769 |
{"caption" : _("Last %sm") % '3', "duration" : 86400*31*3},
|
|
770 |
{"caption" : _("Last %sm") % '6', "duration" : 86400*183},
|
|
771 |
{"caption" : _("Last year"), "duration" : 86400*365},
|
|
763 | 772 |
] |
764 | 773 |
|
765 | 774 |
if start is None: |
... | ... | |
804 | 813 |
@type graph : C{str} |
805 | 814 |
@param start : date-heure de debut des donnees |
806 | 815 |
@type start : C{str} |
807 |
(parametre optionnel, initialise à None) |
|
808 | 816 |
@param duration : plage de temps des données |
809 | 817 |
@type duration : C{str} |
810 |
(parametre optionnel, initialise à 86400 = plage de 1 jour)
|
|
818 |
(parametre optionnel, initialise a 86400 = plage de 1 jour)
|
|
811 | 819 |
|
812 |
@return : dictionnaire applique sur un template -> singlegraph.html
|
|
813 |
@rtype: dict
|
|
820 |
@return : page avec l image du graphe et boutons de deplacement dans le temps
|
|
821 |
@rtype: page html
|
|
814 | 822 |
""" |
815 | 823 |
|
816 | 824 |
presets = [ |
817 |
{"caption" : "Last 12h", "duration" : 43200},
|
|
818 |
{"caption" : "Last 24h", "duration" : 86400},
|
|
819 |
{"caption" : "Last 2d", "duration" : 192800},
|
|
820 |
{"caption" : "Last 7d", "duration" : 604800},
|
|
821 |
{"caption" : "Last 14d", "duration" : 1209600},
|
|
822 |
{"caption" : "Last 3m", "duration" : 86400*31*3},
|
|
823 |
{"caption" : "Last 6m", "duration" : 86400*183},
|
|
824 |
{"caption" : "Last year", "duration" : 86400*365},
|
|
825 |
{"caption" : _("Last %sh") % '12', "duration" : 43200},
|
|
826 |
{"caption" : _("Last %sh") % '24', "duration" : 86400},
|
|
827 |
{"caption" : _("Last %sd") % '2', "duration" : 192800},
|
|
828 |
{"caption" : _("Last %sd") % '7', "duration" : 604800},
|
|
829 |
{"caption" : _("Last %sd") % '14', "duration" : 1209600},
|
|
830 |
{"caption" : _("Last %sm") % '3', "duration" : 86400*31*3},
|
|
831 |
{"caption" : _("Last %sm") % '6', "duration" : 86400*183},
|
|
832 |
{"caption" : _("Last year"), "duration" : 86400*365},
|
|
825 | 833 |
] |
826 | 834 |
|
827 | 835 |
if start is None: |
... | ... | |
835 | 843 |
""" |
836 | 844 |
Formulaire de recherche sur les hotes |
837 | 845 |
|
838 |
@return : page |
|
839 |
@rtype: page (-> dict sur template searchhostform.html)
|
|
846 |
@return : page avec formulaire de recherche
|
|
847 |
@rtype: page html
|
|
840 | 848 |
""" |
841 | 849 |
searchhostform = SearchHostForm('search_host_form', \ |
842 | 850 |
submit_text=None) |
... | ... | |
846 | 854 |
@expose ('searchhost.html') |
847 | 855 |
def searchHost(self, query=None): |
848 | 856 |
""" |
849 |
Recherche d hotes |
|
857 |
Recherche d hotes repondant au critere de recherche
|
|
850 | 858 |
|
851 | 859 |
@param query : prefixe de recherche sur les hotes |
852 | 860 |
@type query : C{str} |
853 | 861 |
|
854 | 862 |
@return : page |
855 |
@rtype: page (-> dict sur template searchhost.html)
|
|
863 |
@rtype: page html
|
|
856 | 864 |
""" |
857 | 865 |
|
858 | 866 |
hosts = [] |
... | ... | |
887 | 895 |
@expose ('getopensearch.xml', content_type='text/xml') |
888 | 896 |
def getOpenSearch(self): |
889 | 897 |
""" |
890 |
getOpenSearch
|
|
898 |
Moteur de recherche des graphes
|
|
891 | 899 |
|
892 |
@return : page
|
|
893 |
@rtype: page xml (-> dict sur template getopensearch.xml)
|
|
900 |
@return : document
|
|
901 |
@rtype: document xml
|
|
894 | 902 |
""" |
895 | 903 |
|
896 | 904 |
here = "http://" |
... | ... | |
903 | 911 |
|
904 | 912 |
def getRRDServer(self, host=None): |
905 | 913 |
""" |
906 |
Determination Server RRD pour l hote courant |
|
907 |
(Server RRD -> nom de l application associee = rrdgraph) |
|
914 |
Determination Serveur RRD pour l hote courant
|
|
915 |
(Serveur RRD -> nom de l application associee = rrdgraph)
|
|
908 | 916 |
|
909 | 917 |
@param host : hôte |
910 | 918 |
@type host : C{str} |
911 | 919 |
|
912 |
@return : server
|
|
920 |
@return : serveur RRD
|
|
913 | 921 |
@rtype: C{str} |
914 | 922 |
""" |
915 | 923 |
|
... | ... | |
931 | 939 |
|
932 | 940 |
def getNagiosServer(self, host=None): |
933 | 941 |
""" |
934 |
Determination Server Nagios pour l hote courant |
|
942 |
Determination Serveur Nagios pour l hote courant
|
|
935 | 943 |
(Server Nagios -> nom de l application associee = nagios) |
936 | 944 |
|
937 | 945 |
@param host : hôte |
938 | 946 |
@type host : C{str} |
939 | 947 |
|
940 |
@return : server
|
|
948 |
@return : serveur Nagios
|
|
941 | 949 |
@rtype: C{str} |
942 | 950 |
""" |
943 | 951 |
|
Also available in: Unified diff