Drawing Parameters

RacksDB offers the possibity to generate graphical representations of datacenter room and infrastructures with their racks and equipments in various images formats. The images are generated with various default drawing parameters that user are able to customize for their requirements.

The first section of this page describes how to specify drawing parameters with both RacksDB CLI and REST API. The second section is the reference documentation of all available drawing parameters with their format and default values.

Usage

CLI

The draw subcommand of racksdb CLI accepts drawing parameters with --parameters option. The value of this option must specify a path to a YAML file that contains the drawing parameters.

Show example custom.yml drawing parameters YAML file
margin:
  top: 200
colors:
  equipments:
  - type: sm610u
    background: "#348feb" # blue
  - tags: ["hpc", "servers"]
    border: "#a66321" # orange
  racks:
  - type: half
    pane: "#8d42f5" # purple
    frame: "#81a85e" # green

For example, to generate graphical representation of tiger infrastructure with custom drawing parameters in custom.yml file, run this command:

$ racksdb draw infrastructure --name=tiger --parameters=custom.yml

Alternatively, the option accepts the special value -. In this case, the drawing parameters are read on command standard input (stdin). For example:

$ racksdb draw room --name=noisy --parameters=- < custom.yaml

REST API

It is also possible to provide custom drawing parameters to RacksDB REST API. The REST API accepts drawing parameters in both JSON and YAML formats. The parameters must be sent in requests body content with content type header set according to the format.

For example, to generate graphical representation of mercury infrastructure with inline drawing parameters in JSON format, the following curl command can be used:

$ curl -X POST -H 'Content-Type: application/json' \
       --data '{"margin":{ "top": 200 }}' \
       http://localhost:5000/draw/infrastructure/mercury.png \
       --output mercury.png

Alternatively, the drawing parameters can be extracted a JSON file. For example with file custom.json:

$ curl -X POST -H 'Content-Type: application/json' \
       --data @custom.json
       http://localhost:5000/draw/infrastructure/mercury.png \
       --output mercury.png
Show example custom.json drawing parameters YAML file
{
    "margin": {
        "top": 200
    },
    "colors": {
        "equipments": [
            {
                "type": "sm610u",
                "background": "#348feb"
            },
            {
                "tags": ["hpc", "servers"],
                "border": "#a66321"
            }
        ],
        "racks": [
            {
                "type": "half",
                "pane": "#8d42f5",
                "frame": "#81a85e"
            }
        ]
    }
}

To send drawing parameters in YAML format, the content type HTTP header must be changed:

$ curl -X POST -H 'Content-Type: application/x-yaml' \
       --data-binary @custom.yml \
       http://localhost:5000/draw/infrastructure/mercury.png \
       --output mercury.png
To send YAML content with curl client, the --data-binary option must be used in favor of -d, --data to preserve line breaks.

Reference

Symbols legend

Some icons are used in the tables of this page for symbolic representations of advanced data types:

Other symbols are used for attributes of properties:

The optional/required attribute is indicated in the Required column of properties definition table. When defined, the default value attribute is mentioned in the Description column.

Database Root

Library class type: Drawings

Properties
Property Description Type Required

room

Rooms graphical representation settings

Default value:

scale: 0.07

 Room

-

infrastructure

Infrastructures graphical representation settings

Default value:

scale: 0.4

 Infrastructure

-

margin

Graphical representation margins

Default value:

left: 30
top: 30

 Margin

-

rack

Rack graphical representation settings

Default value:

door_depth: 50
label_offset: 20
offset: 20
pane_width: 10
spacing: 3
u_height: 44.45

 Rack

-

row

Rack row graphical representation settings

Default value:

label_offset: 20

 Row

-

colors

Drawing coloring rules

Default value:

equipments: []
racks: []

 ColoringRules

-

Objects

ColoringRules

Library class type: DrawingsColoringRules

Properties
Property Description Type Required

equipments

List of equipments coloring rules.

Default value: []

  EquipmentColoringRule

-

racks

List of racks coloring rules.

Default value: []

  RackColoringRule

-

EquipmentColoringRule

Library class type: DrawingsEquipmentColoringRule

Properties
Property Description Type Required

type

Name of type of quipments associated to the coloring rule.

str

-

tags

List of tags equipments must have to be associated to the coloring rule.

 str

-

background

The background color of the equipments.

Default value: #999999

 ~hexcolor

-

border

The border color of the equipments.

Default value: #333333

 ~hexcolor

-

Infrastructure

Library class type: DrawingsInfrastructure

Properties
Property Description Type Required

scale

Scale of 1mm in pixels in Infrastructures graphical representations

Default value: 0.4

float

-

Margin

Library class type: DrawingsMargin

Properties
Property Description Type Required

top

Margin at the top of graphical representations.

Default value: 30

int

-

left

Margin on the left of graphical representations.

Default value: 30

int

-

Rack

Library class type: DrawingsRack

Properties
Property Description Type Required

label_offset

Space between row labels and racks labels in infrastructures graphical representations

Default value: 20

int

-

offset

Space between racks labels and racks in infrastructures graphical representations

Default value: 20

int

-

u_height

The height of a rack unit in millimeters

Default value: 44.45

float

-

pane_width

Width of racks pane in infrastructures graphical representations

Default value: 10

int

-

spacing

Space between racks in infrastructures graphical representations

Default value: 3

int

-

door_depth

The depth of a door in millimeters in rooms graphical representations

Default value: 50

int

-

RackColoringRule

Library class type: DrawingsRackColoringRule

Properties
Property Description Type Required

type

Name of type of rack associated to the coloring rule.

str

-

tags

List of tags racks must have to be associated to the coloring rule.

 str

-

frame

The color of the racks frame.

Default value: #333333

 ~hexcolor

-

pane

The color of the racks pane.

Default value: #000000

 ~hexcolor

-

Room

Library class type: DrawingsRoom

Properties
Property Description Type Required

scale

Scale of 1mm in pixels in rooms graphical representations

Default value: 0.07

float

-

Row

Library class type: DrawingsRow

Properties
Property Description Type Required

label_offset

Space above row labels in infrastructure graphical representations

Default value: 20

int

-

Defined Types

Name Examples Resulting type Comment

~hexcolor

  • #ffffff

  • #a66321

tuple(float, float, float)

Hexadecimal color code (see Wikipedia article for more details). The resulting value is tuple of 3 floats between 0 and 1 representing the rate of red, green and blue primary colors in the resulting color.