Re: [pmacct-discussion] Best way to output ip addresses as integers

2017-09-04 Thread Paolo Lucente

Hi Yann,

Depending on the plugin you are using there could already be a built-in
or not. For the SQL plugins you have it: 'sql_num_hosts: true'; for all
the others you don't but actually adapting a feature like this would be
relatively easy/quick. 

If you use SQL plugins, specifically MySQL, you may be interested in
this outstanding PR (which is currently being reworked a bit by Guy so
to make use of INET6_ATON default and not optional):

https://github.com/pmacct/pmacct/pull/151 

Of course your approach with custom primitives would work very well, and
out of the box, nice tip actually. If you are not using a SQL plugin, it
may be a good short-term solution while the equivalent feature of
sql_num_hosts is worked out.

Paolo 

On Mon, Sep 04, 2017 at 10:42:08AM +0200, Yann Belin wrote:
> Hello,
> 
> I need to run some checks / manipulate source/destination IP addresses
> that I am getting from nfacctd, and for that purpose it makes much
> more sense to output hose IPs in their inetger form, rather than in
> their human-readable (x.x.x.x) form.
> 
> In order to do that, I created custom primitives that read the same
> fields than the native ones, but interpret it as unsigned integers
> instead.
> 
> name=src_host_intfield_type=8 len=4   semantics=u_int
> name=dst_host_intfield_type=12len=4   semantics=u_int
> 
> Is it the best method? Or is there a built-in way to achieve the same result.
> 
> Kind regards,
> 
> Yann
> 
> ___
> pmacct-discussion mailing list
> http://www.pmacct.net/#mailinglists

___
pmacct-discussion mailing list
http://www.pmacct.net/#mailinglists


[pmacct-discussion] Best way to output ip addresses as integers

2017-09-04 Thread Yann Belin
Hello,

I need to run some checks / manipulate source/destination IP addresses
that I am getting from nfacctd, and for that purpose it makes much
more sense to output hose IPs in their inetger form, rather than in
their human-readable (x.x.x.x) form.

In order to do that, I created custom primitives that read the same
fields than the native ones, but interpret it as unsigned integers
instead.

name=src_host_intfield_type=8 len=4   semantics=u_int
name=dst_host_intfield_type=12len=4   semantics=u_int

Is it the best method? Or is there a built-in way to achieve the same result.

Kind regards,

Yann

___
pmacct-discussion mailing list
http://www.pmacct.net/#mailinglists