public inbox for development@lists.ipfire.org
 help / color / mirror / Atom feed
From: Michael Tremer <michael.tremer@ipfire.org>
To: development@lists.ipfire.org
Subject: Re: [PATCH 2/4] [V2] zabbix_agentd: Fix agent modules directory
Date: Mon, 12 Apr 2021 11:52:55 +0100	[thread overview]
Message-ID: <0BCB9613-A55B-4A52-B141-0308A899582C@ipfire.org> (raw)
In-Reply-To: <b651bc8d59787feea3d74e8e12d7f4b199efd237.camel@disroot.org>

[-- Attachment #1: Type: text/plain, Size: 7062 bytes --]

Hello,

I agree, /etc isn’t exactly the best place for it, but it comes with a couple of benefits:

* We will include those files in the backup (or at least should be doing so)

* We have control over /usr/lib/zabbix and can do whatever we need there (I was assuming that there are some system files in there - if that is wrong and there is nothing in this directory apart from user files, we can leave it as /usr/lib/zabbix)

-Michael

> On 12 Apr 2021, at 11:50, Robin Roevens <robin.roevens(a)disroot.org> wrote:
> 
> (forgot to reply to all :-))
> 
> Hi
> 
> In theory, I think I could move the modules dir from current
> /usr/lib/zabbix to /etc/zabbix_agentd/modules for example.
> 
> However modules are not planin text config files but rather binary
> (possibly user-created and compiled) libraries that plug into the agent
> to extend it's functionality. So I assume a user will probably have the
> source code of the binary library some place else and could probably
> easily re-deploy the compiled modules after the backup is restored in a
> recovery situation. But I figured, as it is in a way a configuration of
> the agent instance, it should also be backed up, not requiring users to
> re-deploy those after a recovery. 
> But moving binary files into /etc/... feels a bit awkward.. but
> technically it could be done.
> 
> Robin
> 
> Michael Tremer schreef op ma 12-04-2021 om 11:26 [+0100]:
>> Hello,
>> 
>> So, this is slightly more complicated.
>> 
>> The usual way how we do things is to back up any kind of
>> configuration, uninstall everything, install the new package and then
>> restore the configuration.
>> 
>> Having custom files in a system directory is probably going to break
>> this.
>> 
>> Is there any way to have custom scripts in /etc/zabbix/… or something
>> similar?
>> 
>> -Michael
>> 
>>> On 10 Apr 2021, at 22:13, Robin Roevens <robin.roevens(a)disroot.org>
>>> wrote:
>>> 
>>> Hi Adolf
>>> 
>>> Indeed, I should have explicitly mentioned the modules-dir; the
>>> original /usr/lib/modules which was removed from the rootfile and
>>> the
>>> custom one, introduced by Alex, but not backed up until now:
>>> /usr/lib/zabbix/.
>>> I have been digging in the mailinglist archives to find out why
>>> Alex
>>> was using /usr/lib/zabbix/ and thus I was 'deep' into the modules-
>>> dirs
>>> saga that I considered it 'common knowledge' at that point in time
>>> where I committed this change. But of course, it is no common
>>> knowledge
>>> for you guys :-)
>>> I will try to pay more attention to such things in the future.
>>> 
>>> Regards
>>> Robin
>>> 
>>> Adolf Belka schreef op vr 09-04-2021 om 21:36 [+0200]:
>>>> Hi Robin,
>>>> 
>>>> The patches seem fine to me, although again my lack of zabbix
>>>> knowledge means I can't comment on specifics easily.
>>>> 
>>>> Only minor general point I had was that the commit message might
>>>> have
>>>> more clearly specified that the modules-dir is /usr/lib/zabbix. I
>>>> had
>>>> to read through the whole patch to come to that conclusion.
>>>> 
>>>> Overall these look good patches for your first input.
>>>> 
>>>> Regards,
>>>> 
>>>> Adolf
>>>> 
>>>> On 07/04/2021 22:44, Robin Roevens wrote:
>>>>> - Add agent modules-dir to backup
>>>>> - Remove original, not used agent modules dir from rootfile
>>>>> - Delete agent modules dir only when empty on uninstall thus
>>>>> keeping
>>>>>    possible user deployed custom module files but removing it
>>>>> if
>>>>> unused.
>>>>> 
>>>>> Signed-off-by: Robin Roevens <robin.roevens(a)disroot.org>
>>>>> ---
>>>>>   config/backup/includes/zabbix_agentd    | 3 ++-
>>>>>   config/rootfiles/packages/zabbix_agentd | 4 ++--
>>>>>   src/paks/zabbix_agentd/install.sh       | 2 ++
>>>>>   src/paks/zabbix_agentd/uninstall.sh     | 5 +++++
>>>>>   src/paks/zabbix_agentd/update.sh        | 1 +
>>>>>   5 files changed, 12 insertions(+), 3 deletions(-)
>>>>> 
>>>>> diff --git a/config/backup/includes/zabbix_agentd
>>>>> b/config/backup/includes/zabbix_agentd
>>>>> index cba18d772..d3305cb96 100644
>>>>> --- a/config/backup/includes/zabbix_agentd
>>>>> +++ b/config/backup/includes/zabbix_agentd
>>>>> @@ -1,2 +1,3 @@
>>>>>   /etc/sudoers.d/zabbix
>>>>> -/etc/zabbix_agentd/*
>>>>> +/etc/zabbix_agentd/
>>>>> +/usr/lib/zabbix/
>>>>> diff --git a/config/rootfiles/packages/zabbix_agentd
>>>>> b/config/rootfiles/packages/zabbix_agentd
>>>>> index 4420bda05..a938f2605 100644
>>>>> --- a/config/rootfiles/packages/zabbix_agentd
>>>>> +++ b/config/rootfiles/packages/zabbix_agentd
>>>>> @@ -8,8 +8,8 @@ etc/zabbix_agentd/zabbix_agentd.d
>>>>>   etc/zabbix_agentd/zabbix_agentd.d/userparameter_pakfire.conf
>>>>>   usr/bin/zabbix_get
>>>>>   usr/bin/zabbix_sender
>>>>> -usr/lib/modules
>>>>> -usr/lib/zabbix
>>>>> +#usr/lib/modules
>>>>> +#usr/lib/zabbix
>>>>>   usr/sbin/zabbix_agentd
>>>>>   #usr/share/man/man1/zabbix_get.1
>>>>>   #usr/share/man/man1/zabbix_sender.1
>>>>> diff --git a/src/paks/zabbix_agentd/install.sh
>>>>> b/src/paks/zabbix_agentd/install.sh
>>>>> index e1450a1d8..b98230ea1 100644
>>>>> --- a/src/paks/zabbix_agentd/install.sh
>>>>> +++ b/src/paks/zabbix_agentd/install.sh
>>>>> @@ -41,6 +41,8 @@ ln -sf ../init.d/zabbix_agentd
>>>>> /etc/rc.d/rc6.d/K02zabbix_agentd
>>>>>   # Create additonal directories and set permissions
>>>>>   mkdir -pv /var/log/zabbix
>>>>>   chown zabbix.zabbix /var/log/zabbix
>>>>> +mkdir -pv /usr/lib/zabbix
>>>>> +chown zabbix.zabbix /usr/lib/zabbix
>>>>>   
>>>>>   restore_backup ${NAME}
>>>>>   start_service --background ${NAME}
>>>>> diff --git a/src/paks/zabbix_agentd/uninstall.sh
>>>>> b/src/paks/zabbix_agentd/uninstall.sh
>>>>> index edff3b818..b771d1f63 100644
>>>>> --- a/src/paks/zabbix_agentd/uninstall.sh
>>>>> +++ b/src/paks/zabbix_agentd/uninstall.sh
>>>>> @@ -26,5 +26,10 @@ stop_service ${NAME}
>>>>>   make_backup ${NAME}
>>>>>   remove_files
>>>>>   
>>>>> +# Remove agent modules dir if empty
>>>>> +if [ -z "$(ls -A /usr/lib/zabbix/)" ]; then
>>>>> +       rmdir /usr/lib/zabbix
>>>>> +fi
>>>>> +
>>>>>   # Remove init-scripts and symlinks
>>>>>   rm -rfv /etc/rc.d/rc*.d/*zabbix_agentd
>>>>> diff --git a/src/paks/zabbix_agentd/update.sh
>>>>> b/src/paks/zabbix_agentd/update.sh
>>>>> index 7fc1c96fb..68bba4f80 100644
>>>>> --- a/src/paks/zabbix_agentd/update.sh
>>>>> +++ b/src/paks/zabbix_agentd/update.sh
>>>>> @@ -22,6 +22,7 @@
>>>>>  
>>>>> ###############################################################
>>>>> ####
>>>>> #########
>>>>>   #
>>>>>   . /opt/pakfire/lib/functions.sh
>>>>> +extract_backup_includes
>>>>>   ./uninstall.sh
>>>>>   ./install.sh
>>>>>   
>>>> 
>>> 
>>> 
>>> -- 
>>> Dit bericht is gescanned op virussen en andere gevaarlijke
>>> inhoud door MailScanner en lijkt schoon te zijn.
>>> 
>> 
>> 
> 
> 
> -- 
> Dit bericht is gescanned op virussen en andere gevaarlijke
> inhoud door MailScanner en lijkt schoon te zijn.
> 


  reply	other threads:[~2021-04-12 10:52 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-07 20:44 [PATCH 0/4] [V2] zabbix_agentd: new maintainer/summary Robin Roevens
2021-04-07 20:44 ` [PATCH 1/4] [V2] zabbix_agentd: Update to v5.0.10 (LTS) Robin Roevens
2021-04-09 19:25   ` Adolf Belka
2021-04-10 21:05     ` Robin Roevens
2021-04-12 10:27     ` Michael Tremer
2021-04-12 11:23       ` Adolf Belka
2021-04-12 13:48         ` Michael Tremer
2021-04-12 10:26   ` Michael Tremer
2021-04-07 20:44 ` [PATCH 2/4] [V2] zabbix_agentd: Fix agent modules directory Robin Roevens
2021-04-09 19:36   ` Adolf Belka
2021-04-10 21:13     ` Robin Roevens
2021-04-12 10:26       ` Michael Tremer
2021-04-12 10:50         ` Robin Roevens
2021-04-12 10:52           ` Michael Tremer [this message]
2021-04-12 11:38             ` Robin Roevens
2021-04-12 13:45               ` Michael Tremer
2021-04-07 20:44 ` [PATCH 3/4] [V2] zabbix_agentd: Better configfile handling during update Robin Roevens
2021-04-07 20:44 ` [PATCH 4/4] [V2] zabbix_agentd: Add IPFire specific userparameters Robin Roevens
2021-04-12 10:36   ` Michael Tremer
2021-04-12 22:16     ` Robin Roevens
2021-04-15 11:21       ` Michael Tremer
2021-04-15 13:12         ` Robin Roevens
2021-04-15 20:34           ` Robin Roevens
2021-04-19 13:42             ` Michael Tremer
2021-04-19 13:37           ` Michael Tremer
2021-04-19 20:50             ` Robin Roevens
2021-04-12 10:32 ` [PATCH 0/4] [V2] zabbix_agentd: new maintainer/summary Michael Tremer
2021-04-12 21:19   ` Robin Roevens

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0BCB9613-A55B-4A52-B141-0308A899582C@ipfire.org \
    --to=michael.tremer@ipfire.org \
    --cc=development@lists.ipfire.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox