我想使用 rrdtool 创建一个图表,其中包含来自 IPTable 的一些值。我已配置了 collectd 服务来捕获这些事件并将其存储在 rrd 数据库中。
collectd配置:
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))
谢谢