Re: keepalived.data and keepalived.stats json output
Quentin Armitage <[email protected]> Fri, 14 Jul 2017 14:47:29 +0100
| Newsgroups | gmane.linux.keepalived.devel |
|---|---|
| Organization | The Armitage family |
| Message-ID | <[email protected]> |
On Fri, 2017-07-14 at 08:35 -0400, Damien Clabaut wrote: > Hello Keepalived developers, > > My team and I are considering modifying the file > https://github.com/acassen/keepalived/blob/master/keepalived/vrrp/vrrp_print.c > in order to make the /tmp/keepalived.data and /tmp/keepalived.stats a > valid json. > > In your opinion, what would be the best way to do this ? > > - Patching current functions so that kill -USR1 and kill -USR2 return > valid json ? > > - Adding handlers for kill -USR3 and kill -USR4 to return valid json, > leaving -USR1 and -USR2 in their current states ? > > The idea would be to port this patch to the master branch in the end. > > Regards, > I don't think we can alter the current functionality - there might be users who have scripts that parse the output files. Of course, there are no signals USR3 and USR4, but there is no reason why you can't use other signals that aren't currently used. I can see three ways of doing this, each of which I would be happy with: 1. Use 2 new signals (this seems to offer the greatest flexibility) 2. Have a global configuration option, e.g. dump_json, which if set will make USR1 and USR2 write json output 3. Use 1 additional signal that each time it is invoked toggles between the current format and json (the default would need to be the current format); this probably isn't the best approach. Depending on how much overhead in terms of code size there is with the json output, it might be useful to make the inclusion of json output a compile time option enabled by a configure option --enable-json. It would be good not to duplicate the existing code, since at the moment when a new option is added we already have to update vrrp_print.c, vrrp_data.c and vrrp_snmp.c, and to have to update a fourth place in the code would be somewhat excessive. In fact I have in mind that at sometime the code in vrrp_print.c and the dump_vrrp() code in vrrp_data.c should be merged. I hope that helps, Quentin Armitage ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Keepalived-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/keepalived-devel