Uploaded image for project: 'ZABBIX FEATURE REQUESTS'
  1. ZABBIX FEATURE REQUESTS
  2. ZBXNEXT-3110

Updated freebsd RC script from zabbix agent

XMLWordPrintable

    • Icon: Change Request Change Request
    • Resolution: Unresolved
    • Icon: Trivial Trivial
    • None
    • 2.4.7
    • Agent (G)
    • freebsd systems

      Two issues

      1. Currently the freebsd rc.d script to start the agent has the config file hardwired in. This is not ideal as when you are managing a heterogeneous enviroment you have to remember where the config file its stored on that particular OS. It would be nice to have a fixed location common to all unix OS's. eg /opt/zabbix/etc/agentd.conf or similar. There is no way to do this on freebsd without hacking the startup script. Linux you can through /etc/sysconfig

      2. There is no ability to run a pre script before the agent is started. On RHEL linux you can do this easily with the /etc/sysconfig stuff. It is useful to be able to this as you can standardize the format of things like hostname or programatically determine things like bind interfaces. Therefore please considers the following replacement to the freebsd rc.d script.

      Default operation shouldn't be altered. However if you define

      #!/bin/sh
      
      # PROVIDE: zabbix_agentd
      # REQUIRE: DAEMON
      # KEYWORD: shutdown
      #
      # Add the following lines to /etc/rc.conf.local or /etc/rc.conf to
      # enable zabbix_agentd:
      #
      # zabbix_agentd_enable (bool): Set to NO by default.  Set it to YES to
      #         enable zabbix_agentd.
      #
      
      
      . /etc/rc.subr
      
      name="zabbix_agentd"
      rcvar=zabbix_agentd_enable
      start_precmd="zabbix_precmd"
      required_files="/usr/local/etc/zabbix24/zabbix_agentd.conf"
      
      
      # read configuration and set defaultsc
      load_rc_config "$name"
      : ${zabbix_agentd_enable="NO"}
      #: ${zabbix_agentd_pre:=/usr/local/etc/zabbix24/${name}.pre.sh}
      
      
      if [ ! -z "$zabbix_agentd_conf" ] ; then
              zabbix_agentd_flags="${zabbix_agentd_flags} -c ${zabbix_agentd_conf}"
              required_files=${zabbix_agentd_conf}
      fi
      
      zabbix_precmd()
      {
              if [ ! -z "$zabbix_agentd_pre" ] ; then
                      if [ -e $zabbix_agentd_pre ] ; then
                              . $zabbix_agentd_pre
                      fi
              fi
      
      }
      
      
      command="/usr/local/sbin/${name}"
      
      
      run_rc_command "$1"
      

      here is the diff

      # diff zabbix_agentd zabbix_agentd.old
      13a14
      >
      17a19,20
      > start_precmd="zabbix_precmd"
      > required_files="/usr/local/etc/zabbix24/zabbix_agentd.conf"
      19,22d21
      < command="/usr/local/sbin/${name}"
      < required_files="/usr/local/etc/zabbix24/${name}.conf"
      <
      < load_rc_config $name
      23a23,24
      > # read configuration and set defaultsc
      > load_rc_config "$name"
      24a26,46
      > #: ${zabbix_agentd_pre:=/usr/local/etc/zabbix24/${name}.pre.sh}
      >
      >
      > if [ ! -z "$zabbix_agentd_conf" ] ; then
      >       zabbix_agentd_flags="${zabbix_agentd_flags} -c ${zabbix_agentd_conf}"
      >       required_files=${zabbix_agentd_conf}
      > fi
      >
      > zabbix_precmd()
      > {
      >       if [ ! -z "$zabbix_agentd_pre" ] ; then
      >               if [ -e $zabbix_agentd_pre ] ; then
      >                       . $zabbix_agentd_pre
      >               fi
      >       fi
      >
      > }
      >
      >
      > command="/usr/local/sbin/${name}"
      >
      26a49
      >
      

            Unassigned Unassigned
            cscott chris scott
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: