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
Property | Description | Type | Required |
---|---|---|---|
|
Rooms graphical representation settings Default value:
|
- |
|
|
Infrastructures graphical representation settings Default value:
|
- |
|
|
Graphical representation margins Default value:
|
- |
|
|
Rack graphical representation settings Default value:
|
- |
|
|
Rack row graphical representation settings Default value:
|
- |
|
|
Drawing coloring rules Default value:
|
- |
Objects
ColoringRules
Library class type: DrawingsColoringRules
Property | Description | Type | Required |
---|---|---|---|
|
List of equipments coloring rules. Default value: |
- |
|
|
List of racks coloring rules. Default value: |
- |
EquipmentColoringRule
Library class type: DrawingsEquipmentColoringRule
Property | Description | Type | Required |
---|---|---|---|
|
Name of type of quipments associated to the coloring rule. |
str |
- |
|
List of tags equipments must have to be associated to the coloring rule. |
str |
- |
|
The background color of the equipments. Default value: |
- |
|
|
The border color of the equipments. Default value: |
- |
Infrastructure
Library class type: DrawingsInfrastructure
Property | Description | Type | Required |
---|---|---|---|
|
Scale of 1mm in pixels in Infrastructures graphical representations Default value: |
float |
- |
Margin
Library class type: DrawingsMargin
Property | Description | Type | Required |
---|---|---|---|
|
Margin at the top of graphical representations. Default value: |
int |
- |
|
Margin on the left of graphical representations. Default value: |
int |
- |
Rack
Library class type: DrawingsRack
Property | Description | Type | Required |
---|---|---|---|
|
Space between row labels and racks labels in infrastructures graphical representations Default value: |
int |
- |
|
Space between racks labels and racks in infrastructures graphical representations Default value: |
int |
- |
|
The height of a rack unit in millimeters Default value: |
float |
- |
|
Width of racks pane in infrastructures graphical representations Default value: |
int |
- |
|
Space between racks in infrastructures graphical representations Default value: |
int |
- |
|
The depth of a door in millimeters in rooms graphical representations Default value: |
int |
- |
RackColoringRule
Library class type: DrawingsRackColoringRule
Property | Description | Type | Required |
---|---|---|---|
|
Name of type of rack associated to the coloring rule. |
str |
- |
|
List of tags racks must have to be associated to the coloring rule. |
str |
- |
|
The color of the racks frame. Default value: |
- |
|
|
The color of the racks pane. Default value: |
- |
Defined Types
Name | Examples | Resulting type | Comment |
---|---|---|---|
|
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. |