Merge pull request #1735 from sumpfralle/olsr-jsoninfo-parser-handle-empty-result
[oweals/luci.git] / applications / luci-app-statistics / luasrc / statistics / rrdtool / definitions / ping.lua
1 -- Copyright 2008 Freifunk Leipzig / Jo-Philipp Wich <jow@openwrt.org>
2 -- Licensed to the public under the Apache License 2.0.
3
4 module("luci.statistics.rrdtool.definitions.ping", package.seeall)
5
6 function item()
7         return luci.i18n.translate("Ping")
8 end
9
10 function rrdargs( graph, plugin, plugin_instance, dtype )
11
12         local ping = {
13                 title = "%H: ICMP Round Trip Time",
14                 vlabel = "ms",
15                 number_format = "%5.1lf ms",
16                 data = {
17                         sources = {
18                                 ping = {
19                                         "value"
20                                 }
21                         },
22                         options = {
23                                 ping__value = {
24                                         noarea = true,
25                                         overlay = true,
26                                         title = "%di"
27                                 }
28                         }
29                 }
30         }
31
32         local droprate = {
33                 title = "%H: ICMP Drop Rate",
34                 vlabel = "%",
35                 number_format = "%5.2lf %%",
36                 data = {
37                         types   = {
38                                 "ping_droprate"
39                         },
40                         options = {
41                                 ping_droprate = {
42                                         noarea = true,
43                                         overlay = true,
44                                         title = "%di",
45                                         transform_rpn = "100,*"
46                                 }
47                         }
48                 }
49         }
50
51         local stddev = {
52                 title = "%H: ICMP Standard Deviation",
53                 vlabel = "ms",
54                 number_format = "%5.1lf ms",
55                 data = {
56                         types   = {
57                                 "ping_stddev"
58                         },
59                         options = {
60                                 ping_stddev = {
61                                         noarea = true,
62                                         overlay = true,
63                                         title = "%di"
64                                 }
65                         }
66                 }
67         }
68
69         return { ping, droprate, stddev }
70 end