HacklabMQ: Difference between revisions

From Hacklab.TO Public Wiki
Jump to navigation Jump to search
m (Typo.)
(Updated power details with the changes made today for branch circuit monitoring.)
Line 11: Line 11:
** Format: TBD
** Format: TBD
* statistics.power - Fanout exchange, messages pushed to this exchange indicate power statistics that can be stored/reported by other systems
* statistics.power - Fanout exchange, messages pushed to this exchange indicate power statistics that can be stored/reported by other systems
** Format: TBD
** Format: JSON, 'meter_id' key for what circuit or area is being metered (using standard lab electrical system identifiers), 'watts' for how many watts are in use at the time of reporting, 'cost' for cost per hour at the present time based on the wattage in use
* tegh.services - Fanout exchange, messages sent to this exchange indicate that a 3D printer has either come online or that a previously online printer has gone offline.
* tegh.services - Fanout exchange, messages sent to this exchange indicate that a 3D printer has either come online or that a previously online printer has gone offline.
** Format: JSON, TBD, The routing keys "tegh.service.up" and "tegh.service.down" are used to indicate 3D printers coming online and going offline respectively.
** Format: JSON, TBD, The routing keys "tegh.service.up" and "tegh.service.down" are used to indicate 3D printers coming online and going offline respectively.
Line 27: Line 27:
   "Building Door System" [shape=house style=filled fillcolor="palevioletred1"]
   "Building Door System" [shape=house style=filled fillcolor="palevioletred1"]
   "Building Power System" [shape=house style=filled fillcolor="palevioletred1"]
   "Building Power System" [shape=house style=filled fillcolor="palevioletred1"]
  "HackLab Power Monitor\npowermon" [shape=house style=filled fillcolor="palevioletred1"]
   "LED Sign\nsign0" [shape=house style=filled fillcolor="palevioletred1"]
   "LED Sign\nsign0" [shape=house style=filled fillcolor="palevioletred1"]
   "Stats Sign\nsign1" [shape=house style=filled fillcolor="palevioletred1"]
   "Stats Sign\nsign1" [shape=house style=filled fillcolor="palevioletred1"]
Line 34: Line 35:
   "notification.graphic" [shape=trapezium style=filled fillcolor="paleturquoise1"]
   "notification.graphic" [shape=trapezium style=filled fillcolor="paleturquoise1"]
   "notification.text" [shape=trapezium style=filled fillcolor="paleturquoise1"]
   "notification.text" [shape=trapezium style=filled fillcolor="paleturquoise1"]
   "statistics.power" [shape=trapezium style=dotted]
   "statistics.power" [shape=trapezium style=filled fillcolor="paleturquoise1"]
   "statistics.bandwidth" [shape=trapezium style=filled fillcolor="paleturquoise1"]
   "statistics.bandwidth" [shape=trapezium style=filled fillcolor="paleturquoise1"]
   "eight" [shape=trapezium style=filled fillcolor="paleturquoise1"]
   "eight" [shape=trapezium style=filled fillcolor="paleturquoise1"]
Line 44: Line 45:
   "notification.graphic.ledsign" [shape=box style=filled fillcolor="palegreen1"]
   "notification.graphic.ledsign" [shape=box style=filled fillcolor="palegreen1"]
   "notification.text.ledsign" [shape=box style=filled fillcolor="palegreen1"]
   "notification.text.ledsign" [shape=box style=filled fillcolor="palegreen1"]
   "statistics.power.statssign" [shape=box style=dotted style=dotted]
   "statistics.power.statssign" [shape=box style=filled fillcolor="palegreen1"]
   "statistics.bandwidth.statssign" [shape=box style=filled fillcolor="palegreen1"]
   "statistics.bandwidth.statssign" [shape=box style=filled fillcolor="palegreen1"]
   "eight.signs" [shape=box style=filled fillcolor="palegreen1"]
   "eight.signs" [shape=box style=filled fillcolor="palegreen1"]
Line 80: Line 81:


   "Building Power System" -> "HTTP Service\npowerdata" -> "statistics.power"
   "Building Power System" -> "HTTP Service\npowerdata" -> "statistics.power"
  "HackLab Power Monitor\npowermon" -> "powercollect" -> "statistics.power"
   "statistics.power" -> "statistics.power.statssign"
   "statistics.power" -> "statistics.power.statssign"
   "statistics.power.statssign" -> "statssignd"
   "statistics.power.statssign" -> "statssignd"

Revision as of 04:49, 23 January 2015

The lab has an AMQP-based message queuing infrastructure shared between various services. The broker RabbitMQ is located on moa (192.168.111.14), which is on the lab's LDAP system.

Exchanges

  • door.entry - Fanout exchange, one message gets pushed to the exchange
    • Format: XML format described on the doorbot page each time a card is swiped at the door.
  • notification.graphic - Fanout exchange, messages pushed to this exchange indicate animated graphics which should be sent to lab occupants somehow (e.g. LED sign)
    • Format: Name of the animation to display. Currently "ostrich" is the only supported animation.
  • notification.general - Fanout exchange, messages pushed to this exchange indicate graphics which should be sent to lab occupants somehow (e.g. LED sign, twitter, doorbot)
    • Format: JSON, 'text' and 'image' keys, images referenced should be in NFS user home directories
  • statistics.bandwidth - Fanout exchange, messages pushed to this exchange indicate bandwidth statistics that can be stored/reported by other systems
    • Format: TBD
  • statistics.power - Fanout exchange, messages pushed to this exchange indicate power statistics that can be stored/reported by other systems
    • Format: JSON, 'meter_id' key for what circuit or area is being metered (using standard lab electrical system identifiers), 'watts' for how many watts are in use at the time of reporting, 'cost' for cost per hour at the present time based on the wattage in use
  • tegh.services - Fanout exchange, messages sent to this exchange indicate that a 3D printer has either come online or that a previously online printer has gone offline.
    • Format: JSON, TBD, The routing keys "tegh.service.up" and "tegh.service.down" are used to indicate 3D printers coming online and going offline respectively.
  • eight - Fanout exchange, messages sent to this exchange indicate the number 8 should be printed full-screen (white text on a black background) and/or announced verbally. See also: 8.
    • Format: {eight: 8}

Queues

Queues are named <exchange>.<service>, e.g. doorbot's door.entry queue would be is door.entry.doorbot.

Message Flow Diagram

<graphviz> digraph graphname {

 node [  style=filled fillcolor="papayawhip" ]
 
 "Building Door System" [shape=house style=filled fillcolor="palevioletred1"]
 "Building Power System" [shape=house style=filled fillcolor="palevioletred1"]
 "HackLab Power Monitor\npowermon" [shape=house style=filled fillcolor="palevioletred1"]
 "LED Sign\nsign0" [shape=house style=filled fillcolor="palevioletred1"]
 "Stats Sign\nsign1" [shape=house style=filled fillcolor="palevioletred1"]
 "door.entry" [shape=trapezium style=filled fillcolor="paleturquoise1"]
 "notification.general" [shape=trapezium style=filled fillcolor="paleturquoise1"]
 "notification.graphic" [shape=trapezium style=filled fillcolor="paleturquoise1"]
 "notification.text" [shape=trapezium style=filled fillcolor="paleturquoise1"]
 "statistics.power" [shape=trapezium style=filled fillcolor="paleturquoise1"]
 "statistics.bandwidth" [shape=trapezium style=filled fillcolor="paleturquoise1"]
 "eight" [shape=trapezium style=filled fillcolor="paleturquoise1"]
 
 "door.entry.twitter" [shape=box style=filled fillcolor="palegreen1"]
 "door.entry.notification" [shape=box style=filled fillcolor="palegreen1"]
 "notification.general.doorbot" [shape=box style=filled fillcolor="palegreen1"]
 "notification.general.ledsign" [shape=box style=filled fillcolor="palegreen1"]
 "notification.graphic.ledsign" [shape=box style=filled fillcolor="palegreen1"]
 "notification.text.ledsign" [shape=box style=filled fillcolor="palegreen1"]
 "statistics.power.statssign" [shape=box style=filled fillcolor="palegreen1"]
 "statistics.bandwidth.statssign" [shape=box style=filled fillcolor="palegreen1"]
 "eight.signs" [shape=box style=filled fillcolor="palegreen1"]
 "HTTP API\nTwitter" [shape=hexagon style=filled fillcolor="royalblue1"]
 "IRC #hacklabto (recv)" [shape=hexagon style=filled fillcolor="royalblue1"]
 "IRC #hacklabto (send)" [shape=hexagon style=filled fillcolor="royalblue1"]
 
 "Building Door System" -> "HTTP Service\ncard_event" -> "door.entry"
 "door.entry" -> "door.entry.notification"
 "door.entry" -> "door.entry.twitter"
 "door.entry.notification" -> "doormsg_to_notification" -> "notification.general"
 "door.entry.twitter" -> "hacklab_door_tweeter" -> "HTTP API\nTwitter"
 "notification.general" -> "notification.general.doorbot"
 "notification.general" -> "notification.general.ledsign"
 "notification.general.doorbot" -> "doorbot (HacklabMQ)"
 "doorbot (HacklabMQ)" -> "IRC #hacklabto (send)"
 "notification.general.ledsign" -> "gennotification_sign_feeder";
 "gennotification_sign_feeder" -> "HTTP Service\nSign Text Renderer"
 "HTTP Service\nSign Text Renderer" -> bmix
 bmix -> "LED Sign\nsign0"
 "IRC #hacklabto (recv)" -> "doorbot (HacklabMQPublisher)"
 "doorbot (HacklabMQPublisher)" -> "notification.text" [ label="!sign" ]
 "notification.text" -> "notification.text.ledsign"
 "notification.text.ledsign" -> "ledsign_feeder"
 "ledsign_feeder" ->  "HTTP Service\nSign Text Renderer"
 
 "doorbot (HacklabMQPublisher)" -> "notification.graphic" [ label="*ostrich*" ]
 "notification.graphic" -> "notification.graphic.ledsign"
 "notification.graphic.ledsign" -> "ledsign_ostrich_feeder"
 "ledsign_ostrich_feeder" -> "bmix"
 "Building Power System" -> "HTTP Service\npowerdata" -> "statistics.power"
 "HackLab Power Monitor\npowermon" -> "powercollect" -> "statistics.power"
 "statistics.power" -> "statistics.power.statssign"
 "statistics.power.statssign" -> "statssignd"
 "Firewall SNMP" -> "bandwidth_feeder" -> "statistics.bandwidth" 
 "statistics.bandwidth" -> "statistics.bandwidth.statssign"
 "statistics.bandwidth.statssign" -> "statssignd"
 
 "eight" -> "eight.signs"
 "eight.signs" -> "eight_feeder"
 "eight_feeder" -> "Stats Sign\nsign1"
 "eight_feeder" -> "HTTP Service\nSign Text Renderer"
 "statssignd" -> "Stats Sign\nsign1"

} </graphviz>