[ZBXNEXT-497] Agent config's Include support for excluding files Created: 2010 Aug 27  Updated: 2014 May 09  Due: 2014 Apr 17  Resolved: 2014 Apr 30

Status: Closed
Project: ZABBIX FEATURE REQUESTS
Component/s: Agent (G)
Affects Version/s: 1.8.2
Fix Version/s: 2.3.0

Type: New Feature Request Priority: Minor
Reporter: Greg Swift Assignee: Martins Valkovskis
Resolution: Fixed Votes: 2
Labels: trivial, usability
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

I'm specifically working with RHEL 5 at this point. Not sure how this would affect windows, or even debian based packages.


Issue Links:
Duplicate
is duplicated by ZBXNEXT-1254 Specifying filter in Include director... Closed
is duplicated by ZBX-8162 zabbix_agent : using include director... Closed
is duplicated by ZBX-6120 please ignore editor backups in zabbi... Closed

 Description   

I'm working on setting up a better default agent config to distribute with our agents. In doing this I'm enabling the include directory. Since we distribute everything with RPMs, including our custom configs, there are situations where we can end up with .rpmsave and .rpmnew files in the Include directory. I tried setting Include to /etc/zabbix/userparams.d/*.conf, but it does not fail silently (thus it would work for me, I'd just rather it failed silently). If I put /etc/zabbix/userparams.d/ and there is nothing in it, but the directory exists, it is silent; but it would grab the .rpm

{save,new}

files.

So basically one or both of these is what I think would be useful:

1) Do not pass error to stdout/err if something Include directive doesn't exist. Put it in the log file. This would allow it to be enabled universally, without requiring someone to use it.
2) Allow some way to provide a list of matches to exclude if Include directive is a directory.

In the Fedora/RHEL rpm spec file there is a comment at the top regarding this needing to be resolved, but I couldn't find an existing bug that the packager had filed, so I thought I would.



 Comments   
Comment by Nikolajs Agafonovs (Inactive) [ 2014 Apr 08 ]

Available in development branch svn://svn.zabbix.com/branches/dev/ZBXNEXT-497

Comment by richlv [ 2014 Apr 08 ]

(1) there is no mention on how the solution is supposed to work...

nikolajs.agafonovs Only files with ".conf" extension will be processed as config files. Should I describe it now in documentation?

<richlv> i'd like to suggest to make this parameter support regexps... hardcoding to *.conf does not seem good, and hopefully we already have code for this from logrt items

asaveljevs Regexps might be a bit confusing. Instead, file globbing like "/path/to/configs/*.conf" should probably be preferred.

<richlv> or that, yes - though i can't recall existing code for that in zabbix, thus i suggested regexps first

<richlv> for the record, it was decided to support globs/placeholders asterisks in filename only. thus something like /path/01*files*.conf would work. it would also allow to somewhat order the included files, in a similar way to initscripts

nikolajs.agafonovs wildcards in filenames now working for unix and windows. One can check it in svn://svn.zabbix.com/branches/dev/ZBXNEXT-497 RESOLVED in r44366

asaveljevs This subissue was for deciding on the approach. Bugs with the implementation will be reported as separate subissues. CLOSED.

Comment by Aleksandrs Saveljevs [ 2014 Apr 08 ]

(2) The currently implemented solution is likely to crash if there is no "." symbol in the file name.

nikolajs.agafonovs RESOLVED in r44236

asaveljevs Please see r44261. It fixes a bit of style and a memory leak. RESOLVED.

asaveljevs Since it was decided to redesign the solution, r44261 no longer matters. WON'T FIX.

Comment by Aleksandrs Saveljevs [ 2014 Apr 08 ]

(3) The currently implemented solution is Windows-only.

nikolajs.agafonovs RESOLVED in r44236

asaveljevs CLOSED.

Comment by Nikolajs Agafonovs (Inactive) [ 2014 Apr 16 ]

(4) need to substitute strtok() function with some another function

asaveljevs It might be better to rewrite the algorithm so that it works without tokenizing.

nikolajs.agafonovs tokenizing could be used as general function, something like zbx_strtok()

nikolajs.agafonovscode refactored and fixed. RESOLVED in r44609

wiper I like the alternate idea better. While in theory tokenizing the patter first and then matching against it might give better performance for directories with large number of include files, it's not a concern here and the alternate implementation is simpler.
CLOSED

Comment by Aleksandrs Saveljevs [ 2014 Apr 24 ]

(5) Alternative implementation is available at svn://svn.zabbix.com/branches/dev/ZBXNEXT-497-alt . Unit test are available, too.

wiper Please review my changes in r44958 and 44966 (you can revert the last one if you don't like it)

wiper scratch the r44958, reverting it

asaveljevs Decided to abandon the *strcompare_func idea. CLOSED.

Comment by Andris Zeila [ 2014 Apr 30 ]

(6) In parse_cfg_object() function there are separate code path for directory processing in nix and windows. It would make a bit cleaner code (less 'embedded' ifdefs) if it was moved into parse_cfg_dir() function, which would have nix and windows versions.

asaveljevs RESOLVED in r45016.

wiper CLOSED

Comment by Aleksandrs Saveljevs [ 2014 Apr 30 ]

(7) If "Include" parameter contains a slash at the end, then we should check that the path is a directory. Currently, it can be parsed as a file, too.

asaveljevs RESOLVED in r45038.

wiper CLOSED

Comment by Andris Zeila [ 2014 May 08 ]

Successfully tested

Please review minor changes in r45160

asaveljevs Looks correct.

Comment by Aleksandrs Saveljevs [ 2014 May 08 ]

Available in pre-2.3.0 (trunk) r45179.

Comment by Martins Valkovskis [ 2014 May 09 ]

(8) Documentation.

Added to 'what's new': https://www.zabbix.com/documentation/2.4/manual/introduction/whatsnew240#daemon_improvements.

Reviewed by asaveljevs. CLOSED.

<richlv> i'd suggest to change "Ability to exclude files from Include directory" to something like "...include specific files..." - that seems to make it more clear what the new feature is

martins-v Changed to "include specific".

<richlv> thanks, CLOSED

Comment by Aleksandrs Saveljevs [ 2014 May 09 ]

(9) Pages describing daemon configuration should be updated, too:

It might be that https://www.zabbix.com/documentation/2.4/manual/appendix/config/special_notes_include needs to be adjusted as well.

martins-v Updated all of the listed. RESOLVED.

asaveljevs CLOSED.

Comment by Aleksandrs Saveljevs [ 2014 May 09 ]

(10) Pattern example should be included in sample configuration files.

asaveljevs RESOLVED in r45255.

wiper CLOSED

asaveljevs Merged into trunk in r45256.

Generated at Sat Apr 27 01:18:14 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.