summaryrefslogtreecommitdiff
path: root/tools/rrdui-create.py
blob: 3b4602166b3bbaf74bf2734886eb07bc47242342 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/python

import os, sys
import rrdtool

from rrdui import *

def createItems(graphs):

    for item in graphs:
        if os.path.exists(item.filedata):
            continue

        args = [item.filedata, "-b-1y", "-s10"]

        # The creation info
        (fields, rras) = item.getCreateInfo()

        # Flesh it out properly, and add it
        args.extend(["RRA:%s" % r for r in rras])
        args.extend(["DS:%s:%s" % (f, fields[f]) for f in fields.keys()])

        # And create it
        rrdtool.create(*args)

# Basics
graphs = loadGraphs()
createItems(graphs)