summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--rrdtool-controller.lua5
-rw-r--r--rrdtool-listrrd-html.lsp10
-rw-r--r--rrdtool-model.lua11
-rw-r--r--rrdtool.roles2
4 files changed, 27 insertions, 1 deletions
diff --git a/rrdtool-controller.lua b/rrdtool-controller.lua
index 71c429f..56b9a1e 100644
--- a/rrdtool-controller.lua
+++ b/rrdtool-controller.lua
@@ -27,3 +27,8 @@ function listrrd(self)
return cfe({ type="list", value=configfiles.value, label="RoundRobinDatabase (rrd) files" })
end
+
+function createrrd(self)
+ return controllerfunctions.handle_form(self, self.model.createnewrrd, self.model.write_file, self.clientdata, "Save", "Edit Interfaces file", "File saved")
+
+end
diff --git a/rrdtool-listrrd-html.lsp b/rrdtool-listrrd-html.lsp
index ebbcc21..24c48d1 100644
--- a/rrdtool-listrrd-html.lsp
+++ b/rrdtool-listrrd-html.lsp
@@ -35,6 +35,16 @@ io.write("</span>")
<TD style="white-space:nowrap;" width="90%"><%= html.html_escape(string.gsub(file.value.filename.value, "^.*/", "")) %></TD>
</TR>
<% end %>
+
+ <% if session.permissions[page_info.controller].createrrd then %>
+ <TR>
+ <TD style="padding-right:20px;white-space:nowrap;">
+ <% io.write(html.link{value = "createrrd", label="Create new DB " }) %>
+ </TD>
+ <TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
+ </TR>
+ <% end %>
+
</TABLE>
<% if viewlibrary and viewlibrary.dispatch_component and session.permissions[page_info.controller].newfile then
diff --git a/rrdtool-model.lua b/rrdtool-model.lua
index 1cc032f..9e9295f 100644
--- a/rrdtool-model.lua
+++ b/rrdtool-model.lua
@@ -91,3 +91,14 @@ end
function getrrdlist()
return list_files(databases)
end
+
+function createnewrrd()
+ local newdb = {}
+ newdb.name = cfe({label="Name",value="mydb.rrd",descr="The name of the RRD you want to create. RRD files should end with the extension .rrd. However, RRDtool will accept any filename."})
+ newdb.start = cfe({label="Start",value="",descr="Specifies the time in seconds since 1970-01-01 UTC when the first value should be added to the RRD. RRDtool will not accept any data timed before or at the time specified."})
+ newdb.step = cfe({label="Step",value="",descr="Specifies the base interval in seconds with which data will be fed into the RRD."})
+ newdb.ds = cfe({label="Data stores",value="",descr="DS:ds-name:GAUGE | COUNTER | DERIVE | ABSOLUTE:heartbeat:min:max \
+DS:ds-name:COMPUTE:rpn-expression"})
+ newdb.rra = cfe({label="Round Robin Archive",value="",descr="RRA:AVERAGE | MIN | MAX | LAST:xff:steps:rows"})
+ return {value=newdb}
+end
diff --git a/rrdtool.roles b/rrdtool.roles
index 64cb47f..ad189cb 100644
--- a/rrdtool.roles
+++ b/rrdtool.roles
@@ -1,4 +1,4 @@
USER=rrdtool:status,rrdtool:welcome,rrdtool:startstop
EDITOR=rrdtool:config,rrdtool:listrrd
EXPERT=rrdtool:expert
-ADMIN=rrdtool:status,rrdtool:welcome,rrdtool:startstop,rrdtool:config,rrdtool:listrrd,rrdtool:expert,rrdtool:delete
+ADMIN=rrdtool:status,rrdtool:welcome,rrdtool:startstop,rrdtool:config,rrdtool:listrrd,rrdtool:expert,rrdtool:delete,rrdtool:createrrd