[collectd] [PATCH] IPVS plugin not handling firewall marks
Sebastian Harl
sh at tokkee.org
Fri Jun 1 11:59:47 CEST 2012
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>_FWM0
Signed-off-by: Sebastian Harl <sh at tokkee.org>
;-)
> 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
> collectd at verplant.org
> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://mailman.verplant.org/pipermail/collectd/attachments/20120601/fa1a919f/attachment.pgp>
More information about the collectd
mailing list