luci-app-statistics: conntrack: add percent usage graph 3711/head
authorKevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
Mon, 17 Feb 2020 20:15:15 +0000 (20:15 +0000)
committerKevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
Mon, 2 Mar 2020 10:04:01 +0000 (10:04 +0000)
The existing graph shows a conntrack entry usage value but doesn't show
a conntrack table size figure so you don't know if you're close to
filling the table.  Add a percent usage graph to show conntrack table
percent used.

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/conntrack.js

index d62c3cd0c92112be19d950fe5cc5c39ee1ca2032..c61d4f291203883bfe319e9c5cb572823d71c118 100644 (file)
@@ -6,7 +6,7 @@ return L.Class.extend({
        title: _('Conntrack'),
 
        rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
-               return {
+               var entries = {
                        title: "%H: Conntrack entries",
                        vlabel: "Count",
                        number_format: "%5.0lf",
@@ -26,5 +26,26 @@ return L.Class.extend({
                                }
                        }
                };
+
+               var percent = {
+                       title: "%H: Conntrack usage",
+                       vlabel: "Percent",
+                       number_format: "%5.1lf%%",
+                       y_min: "0",
+                       alt_autoscale_max: true,
+                       data: {
+                               instances: {
+                                       percent: [ "used" ]
+                               },
+                               options: {
+                                       percent_used: {
+                                               color: "00ff00",
+                                               title: "Used"
+                                       }
+                               }
+                       }
+               };
+
+               return [ entries, percent ];
        }
 });