Walter Heck
2012-Jan-22 20:48 UTC
[Puppet Users] Augeas lens for zabbix agent config files?
Hi all, I''m trying to come up with a lens for the zabbix agent config files. I find the lens language untransparent at best, so I''m struggeling to figure out what''s up. The debugging possibilities are extremely limited. Here''s what I have now: zabbix.aug: ===(** An adjusted copy of the postfix_main module **) module Zabbix_agent autoload xfm (************************************************************************ * USEFUL PRIMITIVES *************************************************************************) let eol = Util.eol let comment = Util.comment let empty = Util.empty let eq = del /[ \t]*=/ " =" let word = /[A-Za-z0-9_.-]+/ let value let chr = /[^# \t\n]/ in let any = /.*/ in let line = (chr . any* . chr | chr) in store line (************************************************************************ * ENTRIES *************************************************************************) let entry = [ key word . eq . (value)? . eol ] (************************************************************************ * LENS *************************************************************************) let lns = (comment|empty|entry) * let filter = incl "/etc/zabbix/zabbix_agentd.conf" . incl "/etc/zabbix/zabbix_agent.conf" . Util.stdexcl let xfm = transform lns filter == a sample snippet from a zabbix agent.conf: == # head -n25 /etc/zabbix/zabbix_agentd.conf ########################################################### # PUPPET MANAGED # # Do not edit this file on a server node unless you # # are willing to have your changes overwritten by # # Puppet. If you really want to change the contents # # repository and check it out on the puppet server. # ########################################################### # This is config file for zabbix_agentd # To get more information about ZABBIX, go http://www.zabbix.com ############ GENERAL PARAMETERS ################# # List of comma delimited IP addresses (or hostnames) of ZABBIX servers. # No spaces allowed. First entry is used for sending active checks. # Note that hostnames must resolve hostname->IP address and # IP address->hostname. Server=backend.yomamma.com # Server port for sending active checks #ServerPort=10051 # Unique hostname. Required for active checks. == And the augeas output (all empty): =[/etc/puppet] # augparse /usr/share/augeas/lenses/contrib/zabbix_agent.aug [/etc/puppet] # augtool -e ls /files/etc/zabbix/zabbix_agentd.conf = Any help would be sincerely appreciated :) cheers, -- Walter Heck -- follow @walterheck on twitter to see what I''m up to! -- Check out my new startup: Server Monitoring as a Service @ http://tribily.com Follow @tribily on Twitter and/or ''Like'' our Facebook page at http://www.facebook.com/tribily -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Dominic Cleal
2012-Jan-23 09:34 UTC
Re: [Puppet Users] Augeas lens for zabbix agent config files?
Hi Walter, [ CCing the augeas-devel list, as that''s the best place for Augeas lens problems and help ] On 22/01/12 20:48, Walter Heck wrote:> Hi all, > > I''m trying to come up with a lens for the zabbix agent config files. I > find the lens language untransparent at best, so I''m struggeling to > figure out what''s up. The debugging possibilities are extremely > limited. Here''s what I have now:For debugging, I''d strongly recommend creating a test file, which you can do this simply with your existing Zabbix config. I''ve created a sample here that uses the head -n25 output you pasted - I suggest you fill in the rest: https://gist.github.com/1662040 Store it in lenses/tests/test_zabbix_agent.aug and then you can run: augparse -I lenses/ lenses/tests/test_zabbix_agent.aug (with your new lens under the lenses directory) No output means the lens has checked out fine and the output tree (in the bottom half of the test) matches the input file at the top.> And the augeas output (all empty): > => [/etc/puppet] # augparse /usr/share/augeas/lenses/contrib/zabbix_agent.aug > [/etc/puppet] # augtool -e ls /files/etc/zabbix/zabbix_agentd.conf > =Since the output of head -n25 works perfectly for me, I suspect the problem might be parsing something in the remainder of the file. Try running "print /augeas//error" from within augtool and see if you get /files/etc/zabbix/zabbix_agentd.conf listed. This wiki page explains how to parse the parse errors: http://augeas.net/page/Tracking_down_errors There are some other useful tutorials about creating lenses, the ambiguity problems you might hit and other subjects on the wiki: http://augeas.net/page/Main_Page If you manage to solve it, please do consider sending your new lens (and accompanying test) upstream to the augeas-devel list, we''d love to include it. Hope that helps. -- Dominic Cleal Red Hat Consulting m: +44 (0)7817 878113
Walter Heck
2012-Jan-23 09:44 UTC
Re: [Puppet Users] Augeas lens for zabbix agent config files?
Thanks for the pointers Dominic, I''ll check them out later this week and report back with my findings! On Mon, Jan 23, 2012 at 11:34, Dominic Cleal <dcleal@redhat.com> wrote:> Hi Walter, > > [ CCing the augeas-devel list, as that''s the best place for Augeas lens > problems and help ] > > On 22/01/12 20:48, Walter Heck wrote: >> Hi all, >> >> I''m trying to come up with a lens for the zabbix agent config files. I >> find the lens language untransparent at best, so I''m struggeling to >> figure out what''s up. The debugging possibilities are extremely >> limited. Here''s what I have now: > > For debugging, I''d strongly recommend creating a test file, which you > can do this simply with your existing Zabbix config. I''ve created a > sample here that uses the head -n25 output you pasted - I suggest you > fill in the rest: > https://gist.github.com/1662040 > > Store it in lenses/tests/test_zabbix_agent.aug and then you can run: > augparse -I lenses/ lenses/tests/test_zabbix_agent.aug > > (with your new lens under the lenses directory) > > No output means the lens has checked out fine and the output tree (in > the bottom half of the test) matches the input file at the top. > >> And the augeas output (all empty): >> =>> [/etc/puppet] # augparse /usr/share/augeas/lenses/contrib/zabbix_agent.aug >> [/etc/puppet] # augtool -e ls /files/etc/zabbix/zabbix_agentd.conf >> => > Since the output of head -n25 works perfectly for me, I suspect the > problem might be parsing something in the remainder of the file. > > Try running "print /augeas//error" from within augtool and see if you > get /files/etc/zabbix/zabbix_agentd.conf listed. This wiki page > explains how to parse the parse errors: > http://augeas.net/page/Tracking_down_errors > > There are some other useful tutorials about creating lenses, the > ambiguity problems you might hit and other subjects on the wiki: > http://augeas.net/page/Main_Page > > If you manage to solve it, please do consider sending your new lens (and > accompanying test) upstream to the augeas-devel list, we''d love to > include it. > > Hope that helps. > > -- > Dominic Cleal > Red Hat Consulting > m: +44 (0)7817 878113-- Walter Heck -- follow @walterheck on twitter to see what I''m up to! -- Check out my new startup: Server Monitoring as a Service @ http://tribily.com Follow @tribily on Twitter and/or ''Like'' our Facebook page at http://www.facebook.com/tribily -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Florian Koch
2012-Mar-30 09:49 UTC
[Puppet Users] Re: Augeas lens for zabbix agent config files?
Am Sonntag, 22. Januar 2012 21:48:36 UTC+1 schrieb Walter Heck:> > Hi all, > > I''m trying to come up with a lens for the zabbix agent config files. I > find the lens language untransparent at best, so I''m struggeling to > figure out what''s up. The debugging possibilities are extremely > limited. Here''s what I have now: > > zabbix.aug: > ===> (** > An adjusted copy of the postfix_main module > **) > module Zabbix_agent > > autoload xfm > (************************************************************************ > * USEFUL PRIMITIVES > *************************************************************************) > let eol = Util.eol > let comment = Util.comment > let empty = Util.empty > let eq = del /[ \t]*=/ " =" > let word = /[A-Za-z0-9_.-]+/ > > let value > let chr = /[^# \t\n]/ in > let any = /.*/ in > let line = (chr . any* . chr | chr) in > store line > (************************************************************************ > * ENTRIES > *************************************************************************) > let entry = [ key word . eq . (value)? . eol ] > (************************************************************************ > * LENS > *************************************************************************) > let lns = (comment|empty|entry) * > let filter = incl "/etc/zabbix/zabbix_agentd.conf" > . incl "/etc/zabbix/zabbix_agent.conf" > . Util.stdexcl > let xfm = transform lns filter > ==> > a sample snippet from a zabbix agent.conf: > ==> # head -n25 /etc/zabbix/zabbix_agentd.conf > ########################################################### > # PUPPET MANAGED # > # Do not edit this file on a server node unless you # > # are willing to have your changes overwritten by # > # Puppet. If you really want to change the contents # > # repository and check it out on the puppet server. # > ########################################################### > > # This is config file for zabbix_agentd > # To get more information about ZABBIX, go http://www.zabbix.com > > ############ GENERAL PARAMETERS ################# > > # List of comma delimited IP addresses (or hostnames) of ZABBIX servers. > # No spaces allowed. First entry is used for sending active checks. > # Note that hostnames must resolve hostname->IP address and > # IP address->hostname. > > Server=backend.yomamma.com > > # Server port for sending active checks > > #ServerPort=10051 > > # Unique hostname. Required for active checks. > ==> > And the augeas output (all empty): > => [/etc/puppet] # augparse /usr/share/augeas/lenses/contrib/zabbix_agent.aug > [/etc/puppet] # augtool -e ls /files/etc/zabbix/zabbix_agentd.conf > => > Any help would be sincerely appreciated :) > > cheers, > -- > Walter Heck > > -- > follow @walterheck on twitter to see what I''m up to! > -- > Check out my new startup: Server Monitoring as a Service @ > http://tribily.com > Follow @tribily on Twitter and/or ''Like'' our Facebook page at > http://www.facebook.com/tribily > >Am Sonntag, 22. Januar 2012 21:48:36 UTC+1 schrieb Walter Heck:> > Hi all, > > I''m trying to come up with a lens for the zabbix agent config files. I > find the lens language untransparent at best, so I''m struggeling to > figure out what''s up. The debugging possibilities are extremely > limited. Here''s what I have now: > > zabbix.aug: > ===> (** > An adjusted copy of the postfix_main module > **) > module Zabbix_agent > > autoload xfm > (************************************************************************ > * USEFUL PRIMITIVES > *************************************************************************) > let eol = Util.eol > let comment = Util.comment > let empty = Util.empty > let eq = del /[ \t]*=/ " =" > let word = /[A-Za-z0-9_.-]+/ > > let value > let chr = /[^# \t\n]/ in > let any = /.*/ in > let line = (chr . any* . chr | chr) in > store line > (************************************************************************ > * ENTRIES > *************************************************************************) > let entry = [ key word . eq . (value)? . eol ] > (************************************************************************ > * LENS > *************************************************************************) > let lns = (comment|empty|entry) * > let filter = incl "/etc/zabbix/zabbix_agentd.conf" > . incl "/etc/zabbix/zabbix_agent.conf" > . Util.stdexcl > let xfm = transform lns filter > ==> > a sample snippet from a zabbix agent.conf: > ==> # head -n25 /etc/zabbix/zabbix_agentd.conf > ########################################################### > # PUPPET MANAGED # > # Do not edit this file on a server node unless you # > # are willing to have your changes overwritten by # > # Puppet. If you really want to change the contents # > # repository and check it out on the puppet server. # > ########################################################### > > # This is config file for zabbix_agentd > # To get more information about ZABBIX, go http://www.zabbix.com > > ############ GENERAL PARAMETERS ################# > > # List of comma delimited IP addresses (or hostnames) of ZABBIX servers. > # No spaces allowed. First entry is used for sending active checks. > # Note that hostnames must resolve hostname->IP address and > # IP address->hostname. > > Server=backend.yomamma.com > > # Server port for sending active checks > > #ServerPort=10051 > > # Unique hostname. Required for active checks. > ==> > And the augeas output (all empty): > => [/etc/puppet] # augparse /usr/share/augeas/lenses/contrib/zabbix_agent.aug > [/etc/puppet] # augtool -e ls /files/etc/zabbix/zabbix_agentd.conf > => > Any help would be sincerely appreciated :) > > cheers, > -- > Walter Heck > > -- > follow @walterheck on twitter to see what I''m up to! > -- > Check out my new startup: Server Monitoring as a Service @ > http://tribily.com > Follow @tribily on Twitter and/or ''Like'' our Facebook page at > http://www.facebook.com/tribily > >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/qTI-9cpEtmUJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Florian Koch
2012-Mar-30 09:49 UTC
[Puppet Users] Re: Augeas lens for zabbix agent config files?
Hi Walter, any news with the zabbix_agentd lens? rgds Florian Am Sonntag, 22. Januar 2012 21:48:36 UTC+1 schrieb Walter Heck:> > Hi all, > > I''m trying to come up with a lens for the zabbix agent config files. I > find the lens language untransparent at best, so I''m struggeling to > figure out what''s up. The debugging possibilities are extremely > limited. Here''s what I have now: > > zabbix.aug: > ===> (** > An adjusted copy of the postfix_main module > **) > module Zabbix_agent > > autoload xfm > (************************************************************************ > * USEFUL PRIMITIVES > *************************************************************************) > let eol = Util.eol > let comment = Util.comment > let empty = Util.empty > let eq = del /[ \t]*=/ " =" > let word = /[A-Za-z0-9_.-]+/ > > let value > let chr = /[^# \t\n]/ in > let any = /.*/ in > let line = (chr . any* . chr | chr) in > store line > (************************************************************************ > * ENTRIES > *************************************************************************) > let entry = [ key word . eq . (value)? . eol ] > (************************************************************************ > * LENS > *************************************************************************) > let lns = (comment|empty|entry) * > let filter = incl "/etc/zabbix/zabbix_agentd.conf" > . incl "/etc/zabbix/zabbix_agent.conf" > . Util.stdexcl > let xfm = transform lns filter > ==> > a sample snippet from a zabbix agent.conf: > ==> # head -n25 /etc/zabbix/zabbix_agentd.conf > ########################################################### > # PUPPET MANAGED # > # Do not edit this file on a server node unless you # > # are willing to have your changes overwritten by # > # Puppet. If you really want to change the contents # > # repository and check it out on the puppet server. # > ########################################################### > > # This is config file for zabbix_agentd > # To get more information about ZABBIX, go http://www.zabbix.com > > ############ GENERAL PARAMETERS ################# > > # List of comma delimited IP addresses (or hostnames) of ZABBIX servers. > # No spaces allowed. First entry is used for sending active checks. > # Note that hostnames must resolve hostname->IP address and > # IP address->hostname. > > Server=backend.yomamma.com > > # Server port for sending active checks > > #ServerPort=10051 > > # Unique hostname. Required for active checks. > ==> > And the augeas output (all empty): > => [/etc/puppet] # augparse /usr/share/augeas/lenses/contrib/zabbix_agent.aug > [/etc/puppet] # augtool -e ls /files/etc/zabbix/zabbix_agentd.conf > => > Any help would be sincerely appreciated :) > > cheers, > -- > Walter Heck > > -- > follow @walterheck on twitter to see what I''m up to! > -- > Check out my new startup: Server Monitoring as a Service @ > http://tribily.com > Follow @tribily on Twitter and/or ''Like'' our Facebook page at > http://www.facebook.com/tribily > >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/4EsBd_4PWnAJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Walter Heck
2012-Mar-30 10:28 UTC
Re: [Puppet Users] Re: Augeas lens for zabbix agent config files?
Hi Florian, sorry, haven''t had time to get back to it. Feel free to whip something up :) Walter On Fri, Mar 30, 2012 at 17:49, Florian Koch <florian.koch1981@googlemail.com> wrote:> Hi Walter, > > any news with the zabbix_agentd lens? > > rgds Florian > > > Am Sonntag, 22. Januar 2012 21:48:36 UTC+1 schrieb Walter Heck: >> >> Hi all, >> >> I''m trying to come up with a lens for the zabbix agent config files. I >> find the lens language untransparent at best, so I''m struggeling to >> figure out what''s up. The debugging possibilities are extremely >> limited. Here''s what I have now: >> >> zabbix.aug: >> ===>> (** >> An adjusted copy of the postfix_main module >> **) >> module Zabbix_agent >> >> autoload xfm >> (************************************************************************ >> * USEFUL PRIMITIVES >> >> *************************************************************************) >> let eol = Util.eol >> let comment = Util.comment >> let empty = Util.empty >> let eq = del /[ \t]*=/ " =" >> let word = /[A-Za-z0-9_.-]+/ >> >> let value >> let chr = /[^# \t\n]/ in >> let any = /.*/ in >> let line = (chr . any* . chr | chr) in >> store line >> (************************************************************************ >> * ENTRIES >> >> *************************************************************************) >> let entry = [ key word . eq . (value)? . eol ] >> (************************************************************************ >> * LENS >> >> *************************************************************************) >> let lns = (comment|empty|entry) * >> let filter = incl "/etc/zabbix/zabbix_agentd.conf" >> . incl "/etc/zabbix/zabbix_agent.conf" >> . Util.stdexcl >> let xfm = transform lns filter >> ==>> >> a sample snippet from a zabbix agent.conf: >> ==>> # head -n25 /etc/zabbix/zabbix_agentd.conf >> ########################################################### >> # PUPPET MANAGED # >> # Do not edit this file on a server node unless you # >> # are willing to have your changes overwritten by # >> # Puppet. If you really want to change the contents # >> # repository and check it out on the puppet server. # >> ########################################################### >> >> # This is config file for zabbix_agentd >> # To get more information about ZABBIX, go http://www.zabbix.com >> >> ############ GENERAL PARAMETERS ################# >> >> # List of comma delimited IP addresses (or hostnames) of ZABBIX servers. >> # No spaces allowed. First entry is used for sending active checks. >> # Note that hostnames must resolve hostname->IP address and >> # IP address->hostname. >> >> Server=backend.yomamma.com >> >> # Server port for sending active checks >> >> #ServerPort=10051 >> >> # Unique hostname. Required for active checks. >> ==>> >> And the augeas output (all empty): >> =>> [/etc/puppet] # augparse /usr/share/augeas/lenses/contrib/zabbix_agent.aug >> [/etc/puppet] # augtool -e ls /files/etc/zabbix/zabbix_agentd.conf >> =>> >> Any help would be sincerely appreciated :) >> >> cheers, >> -- >> Walter Heck >> >> -- >> follow @walterheck on twitter to see what I''m up to! >> -- >> Check out my new startup: Server Monitoring as a Service @ >> http://tribily.com >> Follow @tribily on Twitter and/or ''Like'' our Facebook page at >> http://www.facebook.com/tribily > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/puppet-users/-/4EsBd_4PWnAJ. > > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en.-- Walter Heck -- follow @walterheck on twitter to see what I''m up to! -- Check out my new startup: Server Monitoring as a Service @ http://tribily.com Follow @tribily on Twitter and/or ''Like'' our Facebook page at http://www.facebook.com/tribily -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.