luci-app-statistics: cleanup ping definitions
authorFlorian Eckert <fe@dev.tdt.de>
Fri, 13 Sep 2019 12:01:36 +0000 (14:01 +0200)
committerFlorian Eckert <fe@dev.tdt.de>
Fri, 13 Sep 2019 12:14:35 +0000 (14:14 +0200)
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/ping.lua

index e290af549a74c31711da3ac29b7ed2920635bcdb..6ad11985ecfb26e9addc17d0ead83d4d671ce658 100644 (file)
@@ -9,25 +9,44 @@ end
 
 function rrdargs( graph, plugin, plugin_instance, dtype )
 
-       return {
-               -- Ping roundtrip time
-               { title = "%H: ICMP Round Trip Time",
-                 vlabel = "ms",
-                 number_format = "%5.1lf ms",
-                 data = {
-                       sources = { ping = { "value" } },
-                       options = { ping__value = {
-                               noarea = true, overlay = true, title = "%di" } }
-               } },
+       local ping = {
+               title = "%H: ICMP Round Trip Time",
+               vlabel = "ms",
+               number_format = "%5.1lf ms",
+               data = {
+                       sources = {
+                               ping = {
+                                       "value"
+                               }
+                       },
+                       options = {
+                               ping__value = {
+                                       noarea = true,
+                                       overlay = true,
+                                       title = "%di"
+                               }
+                       }
+               }
+       }
 
-               -- Ping droprate
-               { title = "%H: ICMP Drop Rate",
-                 vlabel = "%",
-                 number_format = "%5.2lf %%",
-                 data = {
-                       types   = { "ping_droprate" },
-                       options = { ping_droprate = {
-                               noarea = true, overlay = true, title = "%di", transform_rpn = "100,*" } }
-               } }
+       local droprate = {
+               title = "%H: ICMP Drop Rate",
+               vlabel = "%",
+               number_format = "%5.2lf %%",
+               data = {
+                       types   = {
+                               "ping_droprate"
+                       },
+                       options = {
+                               ping_droprate = {
+                                       noarea = true,
+                                       overlay = true,
+                                       title = "%di",
+                                       transform_rpn = "100,*"
+                               }
+                       }
+               }
        }
+
+       return { ping, droprate }
 end