Skip to content

Instantly share code, notes, and snippets.

@narutaro
Last active January 5, 2016 00:44
Show Gist options
  • Save narutaro/84433c3cbf54e8b719d2 to your computer and use it in GitHub Desktop.
Save narutaro/84433c3cbf54e8b719d2 to your computer and use it in GitHub Desktop.
pmacct

#Preparing a docker container

Use a docker container to setup pmacct. Port 5678/udp for receiving NetFlow.

$ docker run -d -h pmacct --name=pmacct -p 8889:8889 -p 5678:5678/udp -v /home/inoue/docker/pmacct:/pmacct -it ubuntu

Build essentials.

apt-get install build-essential checkinstall
apt-get install libpcap-dev  #otherwise error - "configure: error: ERROR: missing pcap.h"

Then, configure, make and make install.

The version I use is 1.5.2.

root@pmacct:/# pmacctd -V
Promiscuous Mode Accounting Daemon, pmacctd 1.5.2 (20150907-00)
root@pmacct:/# sfacctd -V
sFlow Accounting Daemon, sfacctd 1.5.2 (20150907-00)
root@pmacct:/# nfacctd -V
NetFlow Accounting Daemon, nfacctd 1.5.2 (20150907-00)

Receiving test flows

root@pmacct:/pmacct# nfacctd -l 5678
WARN ( cmdline ): No plugin has been activated; defaulting to in-memory table.
INFO ( default/core ): Reading configuration from cmdline.
WARN ( default/memory ): defaulting to SRC HOST aggregation.
INFO ( default/core ): waiting for NetFlow data on 0.0.0.0:5678
OK ( default/memory ): waiting for data on: '/tmp/collect.pipe'
INFO: expecting flow '1300989140' but received '1300989139' collector=0.0.0.0:5678 agent=10.66.18.103:65534
INFO: expecting flow '1300989140' but received '1300989139' collector=0.0.0.0:5678 agent=10.66.18.103:65534
INFO: expecting flow '1300989140' but received '1300989139' collector=0.0.0.0:5678 agent=10.66.18.103:65534
INFO: expecting flow '1300989140' but received '1300989139' collector=0.0.0.0:5678 agent=10.66.18.103:65534
INFO: expecting flow '1300989140' but received '1300989139' collector=0.0.0.0:5678 agent=10.66.18.103:65534
INFO: expecting flow '1300989140' but received '1300989139' collector=0.0.0.0:5678 agent=10.66.18.103:65534

#Config file a.conf

!
daemonize: true
!nfacctd_ip: 1.2.3.4
nfacctd_port: 5678
plugins: memory[display]
aggregate[display]: src_host, dst_host, src_port, dst_port, proto
!

#Start with the file a.conf

nfacctd -f a.conf

#Clear conter

root@pmacct:/pmacct# pmacct -e
OK: Clearing stats.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment