On Wed, May 30, 2012 at 01:50:51PM +0100, Mark Brooks wrote:
> Hi all,
> This was detected in 5.1.0, when using the ipvs plugin to collect
> stats from ipvs with firewall marks. (I am quite new to using collectd
> so if Ive missed something please shout)
>
> The observed normal folder naming convention is -
> ipvs-<virtual IP>_{UDP,TCP}<port>
>
> which is fine until you use a firewall mark as you get
> ipvs-0.0.0.0_TCP0/
>
> Which is usable unless you have more than one firewall mark pointing
> to the same real servers, as everything ends up in the same directory.
>
> The patch detects if the Virtual IP is a firewall mark and uses that
> to form the folder name instead. So if your using a firewall mark you
> would get
>
> ipvs-<firewall_mark>_FWM0Signed-off-by: Sebastian Harl <[email protected]> ;-) > Mark > ----------------------------------------------------------------------------------------------------------------- > > diff -pur collectd-5.1.0/src/ipvs.c collectd-5.1.0-mine/src/ipvs.c > --- collectd-5.1.0/src/ipvs.c 2012-04-02 09:04:58.000000000 +0100 > +++ collectd-5.1.0-mine/src/ipvs.c 2012-05-30 13:05:58.239637001 +0100 > @@ -188,14 +188,20 @@ static int get_pi (struct ip_vs_service_ > > if ((NULL == se) || (NULL == pi)) > return 0; > - > - addr.s_addr = se->addr; > - > + > + if (se->fwmark) { > + len = ssnprintf (pi, size, "%u_FWM%u", se->fwmark, > + ntohs (se->port)); > + } > + else { > + addr.s_addr = se->addr; > + > + len = ssnprintf (pi, size, "%s_%s%u", inet_ntoa (addr), > + (se->protocol == IPPROTO_TCP) ? "TCP" : "UDP", > + ntohs (se->port)); > + } > /* inet_ntoa() returns a pointer to a statically allocated buffer > * I hope non-glibc systems behave the same */ > - len = ssnprintf (pi, size, "%s_%s%u", inet_ntoa (addr), > - (se->protocol == IPPROTO_TCP) ? "TCP" : "UDP", > - ntohs (se->port)); > > if ((0 > len) || (size <= len)) { > log_err ("plugin instance truncated: %s", pi); > > _______________________________________________ > collectd mailing list > [email protected] > http://mailman.verplant.org/listinfo/collectd -- Sebastian "tokkee" Harl +++ GnuPG-ID: 0x8501C7FC +++ http://tokkee.org/ Those who would give up Essential Liberty to purchase a little Temporary Safety, deserve neither Liberty nor Safety. -- Benjamin Franklin
signature.asc
Description: Digital signature
_______________________________________________ collectd mailing list [email protected] http://mailman.verplant.org/listinfo/collectd
