
IPTable의 일부 값을 사용하여 rrdtool을 사용하여 그래프를 만들고 싶습니다. 해당 이벤트를 포착하여 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))
감사해요