README.md 4.09 KB
Newer Older
Stauros Kroustouris's avatar
Stauros Kroustouris committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
Api
===
The json can return the following variables:

- pins, an array of pins that will be shown in the map
- url, the url of the page
- coords, the limits of the interestin area in the map
- links, the links from one pin to another

Pins
----
- name, the name of the pin. Required.
- geolat, geolng, the coords of the point. Required.
- location, if the point is a kind of institution. Required.
- image, if an image should be used instead of the pin
- url, the url that is linked with the pin, if the pin is not a child

Coords
------
The limits of the interesting area in the map:

- minlat, minimum latitude
- minlng, minimum longitude
- maxlat, maximum latitude
- maxlng, maximum longitude


Links
-----
- fmloc, from location
- toloc, to location

- fmto, from, to

- fmlat, from latitude
- fmlng, from longitude
- tolat, to latitude
- tolng, from logintude

- fmcity, from city
- tocity, to city

- mrtg_tag, tag
- mrtg_indexuri, uri

- fmnd, from node
- tond, to node

- capacity

- mrtg_type
- mrtg_dayuri, uri to diagram

- toif, to interface
- fromif, from interface

- mrtg_thumb, thumbnail of the diagram(?)


# The view used for peer_ifces
	CREATE VIEW `peer_ifces` AS (
	    select
	        `node`.`name` AS `name`,
	        `b`.`ifDescr` AS `interface`,
	        `db_members`.`location`.`location_id` AS `grnet_device_location`,
	        `db_members`.`peer_site`.`site_id` AS `site`,
	        `db_members`.`peer_site`.`peer_site_location` AS `site_location`,
	        `td`.`member_id` AS peer
	    from (
	        (
	            (
	                (
	                    (
	                        (
	                            (
	                                (
	                                    `observium`.`ports_stack` join `observium`.`ports` `a` on (
	                                        (
	                                            (
	                                                `a`.`ifIndex` = `observium`.`ports_stack`.`port_id_high`
	                                            ) and (
	                                                `a`.`device_id` = `observium`.`ports_stack`.`device_id`
	                                            )
	                                        )
	                                    )
	                                ) join `observium`.`ports` `b` on (
	                                    (
	                                        (
	                                            `b`.`ifIndex` = `observium`.`ports_stack`.`port_id_low`
	                                        ) and (
	                                            `b`.`device_id` = `observium`.`ports_stack`.`device_id`
	                                        )
	                                    )
	                                )
	                            ) join `grnetdb`.`tagged_ifce` `ti` on (
	                                (
	                                    `ti`.`ifce_id` = `b`.`port_id`
	                                )
	                            )
	                        ) join `grnetdb`.`tagged_domain` `td` on (
	                            (
	                                `ti`.`tagged_domain_id` = `td`.`domain_id`
	                            )
	                        )
	                    ) join `grnetdb`.`node` on (
	                        (
	                            `node`.`node_id` = `observium`.`ports_stack`.`device_id`
	                        )
	                    )
	                ) left join `db_members`.`location` on (
	                    (
	                        `db_members`.`location`.`location_id` = `node`.`location_id`
	                    )
	                )
	            ) left join `db_members`.`peer_site` on (
	                (
	                    `ti`.`site_id` = `db_members`.`peer_site`.`site_id`
	                )
	            )
	        ) left join db_members.peer on (
	            td.member_id = db_members.peer.peer_id
	        )
	    ) where (
	        (
	            `b`.`ifDescr` is not null
	        ) and (
	            `a`.`ifDescr` is not null
	        ) and (
	            `ti`.`tagged_domain_id` <> 100
	        )
	    ) group by `b`.`port_id`
	)