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
Property | Description | Type | Required |
---|---|---|---|
|
General settings Default value:
|
- |
|
|
Rooms graphical representation settings Default value:
|
- |
|
|
Infrastructures graphical representation settings Default value:
|
- |
|
|
Dimensions of image 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: |
- |
Dimensions
Library class type: DrawingsDimensions
Property | Description | Type | Required |
---|---|---|---|
|
Maximum height of image in pixels Default value: |
int |
- |
|
Maximum width of image in pixels Default value: |
int |
- |
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 color of the equipment chassis. Default value: |
- |
|
|
The border color of the equipments. Default value: |
- |
|
|
The color of ghosted equipment. Default value: |
- |
General
Library class type: DrawingsGeneral
Property | Description | Type | Required |
---|---|---|---|
|
Control if entities are represented perfectly aligned on pixels with concession on relative dimensions correctess. Default value: |
bool |
- |
Infrastructure
Library class type: DrawingsInfrastructure
Property | Description | Type | Required |
---|---|---|---|
|
Control if equipment are labelled with their names Default value: |
bool |
- |
|
Draw only the equipment matching at least one of the tags. |
str |
- |
|
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: |
bool |
- |
|
Control if racks used by infrastructure that contain only unselected equipment are represented. Default value: |
bool |
- |
|
Control if racks present in the rows but not used by the infrastructure are represented in infrastructure diagrams. Default value: |
bool |
- |
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 |
---|---|---|---|
|
Vertical space between row labels and racks labels in infrastructures graphical representations Default value: |
int |
- |
|
Vertical 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 millimeters 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, float) |
Hexadecimal color code (see
Wikipedia article for more
details) with optional alpha channel. Default alpha channel value is |