RRDTool:如何在圖表中獲得累積值

RRDTool:如何在圖表中獲得累積值

我想使用 rrdtool 建立一個圖表,其中包含 IPTable 中的一些值。我已經配置了collectd 服務來捕獲這些事件並將它們儲存在rrd 資料庫中。

收集配置:

LoadPlugin tail <Plugin tail>
        <File "/var/log/iptables.log">
                Plugin "firewall"
                Instance "iptables"
                Interval 60
                <Match>
                        Regex "INPUT/DROP"
                        DSType "GaugeInc"
                        Type "gauge"
                        Instance "incoming-total"
                </Match>
                <Match>
                        Regex "DPT=22 "
                        DSType "GaugeInc"
                        Type "gauge"
                        Instance "incoming-port22"
                </Match>
                <Match>
                        Regex "DPT=80 "
                        DSType "GaugeInc"
                        Type "gauge"
                        Instance "incoming-port80"
                </Match>
                <Match>
                        Regex "DPT=443 "
                        DSType "GaugeInc"
                        Type "gauge"
                        Instance "incoming-port443"
                </Match>
                <Match>
                        Regex "DPT=8080 "
                        DSType "GaugeInc"
                        Type "gauge"
                        Instance "incoming-port8080"
                </Match>
        </File> </Plugin>

值的儲存方式如下:

1696950174.458,nan
1696950234.458,nan
1696950294.458,1.000000
1696950354.458,nan
1696950414.458,nan
1696950474.458,nan
1696950534.458,nan
1696950594.458,nan
1696950654.458,nan
1696950714.458,1.000000

我想要一個顯示數值的圖表。

這是我的rrdgraph配置的一部分。知道出了什麼問題以及我該怎麼做嗎?

args.append('{image_dir}/firewall-{period}.png'.format(**config))
args.extend(config['defaults'])
args.extend(['--start', config['start']])
args.extend(['--title', '"{title_firewall}{title_by_period}"'.format(**config)])
args.append('--slope-mode')
args.extend(['--lower-limit', '0'])
args.extend(['--vertical-label', '"Dropped connections"'])

args.append('DEF:citavg="{data_dir}/firewall-iptables/gauge-incoming-total.rrd":value:AVERAGE'.format(**config))
args.append('DEF:citmax="{data_dir}/firewall-iptables/gauge-incoming-total.rrd":value:MAX'.format(**config))

args.append('LINE1:citavg{color_firewall_total}:"Total           "'.format(**config))
args.append('GPRINT:citavg:AVERAGE:"%5.1lf%s Avg"')
args.append('GPRINT:citmax:MAX:"%5.1lf%s Max"')

args.append('COMMENT:"{last_update}"'.format(**config))

謝謝

相關內容