OpenWrt Forum Archive

Topic: multiple ping graphs with luci_statistics and rrdtool

The content of this topic has been archived on 3 May 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi,
I currently have over 10 hosts that I ping, collectd collectd the data and rrdtool draws nice graphs. I would like to add even more hosts but would like to separate them into two or even three separate graphs, how can I do that?

Any help is much appreciated.

I found LUA script that creates LUCI Statistics Ping page: /usr/lib/lua/luci/statistics/rrdtool/definitions/ping.lua

--[[

Luci statistics - ping plugin diagram definition
(c) 2008 Freifunk Leipzig / Jo-Philipp Wich <xm@leipzig.freifunk.net>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

$Id: ping.lua 6810 2011-01-29 03:33:48Z jow $

]]--

module("luci.statistics.rrdtool.definitions.ping", package.seeall)

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 = { "ping" } },
            options = { ping__ping = { noarea = true, title = "%di" } }
        } },

        -- Ping droprate
        { title = "%H: ICMP Drop Rate", vlabel = "%",
          number_format = "%5.2lf %%", data = {
            types   = { "ping_droprate" },
            options = { ping_droprate = { title = "%di" } }
        } },

        -- Ping standard deviation
        { title = "%H: ICMP Standard Deviation", vlabel = "ms",
          number_format = "%5.2lf ms", data = {
            types   = { "ping_stddev" },
            options = { ping_stddev = { title = "%di" } }
        } },
    }
end

Any idea how to separate  different ping groups in separate ping graphs?

(Last edited by valentt on 29 Jan 2012, 16:00)

that's pretty easy.
just add per_instance = true, just after return.

From
return {
        -- Ping roundtrip time
        { title = "%H: ICMP Round Trip Time", vlabel = "ms",
          number_format = "%5.1lf ms", data = {
            sources = { ping = { "ping" } },
            options = { ping__ping = { noarea = true, title = "%di" } }
        } },

To
return {
per_instance = true,
        -- Ping roundtrip time
        { title = "%H: ICMP Round Trip Time", vlabel = "ms",
          number_format = "%5.1lf ms", data = {
            sources = { ping = { "ping" } },
            options = { ping__ping = { noarea = true, title = "%di" } }
        } },

Awesome statistics. Unclear how to setup though.

install this package

luci-app-statistics

and then new tab will appear in luci, statistics.

then install each collectd package you would like to monitor and enable. 

collectd-mod-ping



Here is the long list of all of them. Additionally i did a luci-reload rather than restarting!

opkg list | grep collectd

vbcity wrote:

that's pretty easy.
just add per_instance = true, just after return.

From
return {
        -- Ping roundtrip time
        { title = "%H: ICMP Round Trip Time", vlabel = "ms",
          number_format = "%5.1lf ms", data = {
            sources = { ping = { "ping" } },
            options = { ping__ping = { noarea = true, title = "%di" } }
        } },

To
return {
per_instance = true,
        -- Ping roundtrip time
        { title = "%H: ICMP Round Trip Time", vlabel = "ms",
          number_format = "%5.1lf ms", data = {
            sources = { ping = { "ping" } },
            options = { ping__ping = { noarea = true, title = "%di" } }
        } },

I know this is kind of old thread, but I would like to correct this answer.
If you want to print separated graphs, you save to insert command per_instance=true INSIDE array of graph informations like

return {
        -- Ping roundtrip time
        { per_instance=true,
          title = "%H: ICMP Round Trip Time", vlabel = "ms",
          number_format = "%5.1lf ms", data = {
            sources = { ping = { "ping" } },
            options = { ping__ping = { noarea = true, title = "%di" } }
        } },

The discussion might have continued from here.