Pencil’s documentation¶
Pencil is a simple wrapper around Graphite URL API
You can report bugs and discuss features on the issues page.
Usage¶
Pencil is straightforward to use :
>>> from pencil import Pencil
>>> pencil = Pencil(begin="-12hours").set_title("Network").add_metric("front.network.eth0.if_*").area_mode("stacked")
>>> pencil.url("http://graphite.local/render/", 510, 318)
'http://graphite.local/render/?fontName=Helvetica&lineMode=slope&from=-12hours&target=front.network.eth0.if_%2A&title=Network&areaMode=stacked&graphType=line&height=318&bgcolor=FFFFFF&width=510&template=alphas&fgcolor=000000'
API¶
-
class
pencil.
Pencil
(begin=None, until=None)¶ -
add_deploy
(deploy, colors='')¶ Add a deploy metric
-
add_metric
(metric, colors='')¶ Add a metric to image, may be either a graphite path or a function (such as avg)
-
area_mode
(mode)¶ May be “none”, “first”, “stacked” or “all”. This causes the area under lines to be shaded in, when using “all” you may need to use an alpha masked color
Default : “none”
-
format
(value)¶ Set output format as “csv” or “json”
Default : None
-
graph_type
(value)¶ Setup graph type, “line” or “pie”
Default : “line”
-
hide_axes
(boolean)¶ Hides both the x and y axis labels as well as the background grid
-
hide_legend
(boolean)¶ Hides the graph legend
-
line_mode
(mode)¶ May be either “slope” or “staircase”
Default : “slope”
-
line_width
(value)¶ Sets the line thickness, by default this is set depending on the size of the image
-
set_bgcolor
(color)¶ Set image background color
Default : white
-
set_fgcolor
(color)¶ Set font color
Default : black
-
set_font
(font)¶ Set font for text
Default : “Helvetica”
-
set_template
(template)¶ Used for alternate coloring schemes
Default : “alphas”
-
set_title
(title)¶ Set the image title
-
set_vtitle
(title)¶ Set the image vertical title
-
url
(base, width, height)¶ Return image url based on the given URL for Graphite
-
y_max
(value)¶ yMax set the maximun y-value for the generated image
-
y_min
(value)¶ yMin set the minimum y value for the generated image
-