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/v0.4.0/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/v0.4.0/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/v0.4.0/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

general

General settings

Default value:

pixel_perfect: false

 General

-

room

Rooms graphical representation settings

Default value:

racks_labels: true

 Room

-

infrastructure

Infrastructures graphical representation settings

Default value:

discard_empty_racks: true
equipment_labels: true
ghost_unselected: false
other_racks: false

 Infrastructure

-

dimensions

Dimensions of image

Default value:

height: 1200
width: 1200

 Dimensions

-

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: 40
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

-

Dimensions

Library class type: DrawingsDimensions

Properties
Property Description Type Required

height

Maximum height of image in pixels

Default value: 1200

int

-

width

Maximum width of image in pixels

Default value: 1200

int

-

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

-

chassis

The color of the equipment chassis.

Default value: #3F3F3F

 ~hexcolor

-

border

The border color of the equipments.

Default value: #333333

 ~hexcolor

-

ghost

The color of ghosted equipment.

Default value: #737373

 ~hexcolor

-

General

Library class type: DrawingsGeneral

Properties
Property Description Type Required

pixel_perfect

Control if entities are represented perfectly aligned on pixels with concession on relative dimensions correctess.

Default value: False

bool

-

Infrastructure

Library class type: DrawingsInfrastructure

Properties
Property Description Type Required

equipment_labels

Control if equipment are labelled with their names

Default value: True

bool

-

equipment_tags

Draw only the equipment matching at least one of the tags.

 str

-

ghost_unselected

Control if unselected equipment are represented as ghosts in racks. When the value is true, infrastructure equipment that is not selected for the diagram is represented without details nor label just to mark its presence. When the value is false, this equipment is simply discarded.

Default value: False

bool

-

discard_empty_racks

Control if racks used by infrastructure that contain only unselected equipment are represented.

Default value: True

bool

-

other_racks

Control if racks present in the rows but not used by the infrastructure are represented in infrastructure diagrams.

Default value: False

bool

-

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

Vertical space between row labels and racks labels in infrastructures graphical representations

Default value: 20

int

-

offset

Vertical 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 millimeters in infrastructures graphical representations

Default value: 40

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

racks_labels

Control if racks are labelled with their names

Default value: True

bool

-

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

  • #348febaa

tuple(float, float, float, float)

Hexadecimal color code (see Wikipedia article for more details) with optional alpha channel. Default alpha channel value is ff (ie. fully opaque). The resulting value is tuple of 4 floats between 0 and 1 representing the rate of red, green and blue primary colors in the resulting color and the color opacity (from 0 for fully transparent to 1 for fully opaque).