Ad Widget

Collapse

How can set zabbix to system service?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zhxd
    Junior Member
    • Jul 2010
    • 6

    #1

    How can set zabbix to system service?

    I installed zabbix 1.8.2(sourcecode compile for install)on CentOS.
    zabbix_server and zabbix_agentd can start and work.
    But I want add zabbix_server and zabbix into system service list.I can use chkconfig to control zabbix's service,then.
    I run:
    # cd /usr/local/zabbix/sbin
    # ls
    total 2416
    -rwxr-xr-x 1 root root 406381 Jul 4 17:14 zabbix_agent
    -rwxr-xr-x 1 root root 480931 Jul 4 17:14 zabbix_agentd
    -rwxr-xr-x 1 root root 1566291 Jul 4 17:14 zabbix_server
    # chkconfig --add zabbix_server
    error reading information on service zabbix_server: No such file or directory.

    How can I to do?Wait for your help,thank you!
    Last edited by zhxd; 05-07-2010, 10:26. Reason: [resolved]
  • MrKen
    Senior Member
    • Oct 2008
    • 652

    #2
    Something like this:

    [[email protected]]# cp misc/init.d/redhat/zabbix_agentd_ctl /etc/init.d/zabbix_agentd
    - and same for zabbix_server.

    Then edit /etc/init.d/zabbix_agentd and zabbix_server
    BASEDIR=/usr/local/zabbix
    ZABBIX_AGENTD=$BASEDIR/sbin/zabbix_agentd [change bin to sbin]

    [[email protected]]# chkconfig --level 345 zabbix_agentd on
    [[email protected]]# chkconfig --level 345 zabbix_server on

    MrKen
    *edit*

    You might also want
    chkconfig --level 345 httpd on
    chkconfig --level 345 mysqld on
    Last edited by MrKen; 05-07-2010, 07:52. Reason: last bit
    Disclaimer: All of the above is pure speculation.

    Comment

    • zhxd
      Junior Member
      • Jul 2010
      • 6

      #3
      Originally posted by MrKen
      Something like this:

      [[email protected]]# cp misc/init.d/redhat/zabbix_agentd_ctl /etc/init.d/zabbix_agentd
      - and same for zabbix_server.

      Then edit /etc/init.d/zabbix_agentd and zabbix_server
      BASEDIR=/usr/local/zabbix
      ZABBIX_AGENTD=$BASEDIR/sbin/zabbix_agentd [change bin to sbin]

      [[email protected]]# chkconfig --level 345 zabbix_agentd on
      [[email protected]]# chkconfig --level 345 zabbix_server on

      MrKen
      *edit*

      You might also want
      chkconfig --level 345 httpd on
      chkconfig --level 345 mysqld on

      Thanks for your help!
      But I like you to do,when I run the command,it alert error,yet:
      [root@localhost init.d]# pwd
      /etc/init.d
      [root@localhost init.d]# ls -l zabbix_*
      -rwxr-xr-x 1 root root 3220 Jul 5 14:14 zabbix_agentd
      -rwxr-xr-x 1 root root 3204 Jul 5 14:14 zabbix_server
      [root@localhost init.d]# chkconfig --level 345 zabbix_server on
      service zabbix_server does not support chkconfig
      [root@localhost init.d]# chkconfig --level 345 zabbix_agentd on
      service zabbix_agentd does not support chkconfig
      Last edited by zhxd; 05-07-2010, 08:20.

      Comment

      • MrKen
        Senior Member
        • Oct 2008
        • 652

        #4
        Sorry, missed something,

        edit /etc/init.d/zabbix_agentd & zabbix_server

        and add near the top just below #!/bin/sh
        # chkconfig: 345 95 95
        # chkconfig: Zabbix Agentd

        #!/bin/sh
        #
        #chkconfig: 345 95 95
        #description: Zabbix Server

        Try again.
        Disclaimer: All of the above is pure speculation.

        Comment

        • zhxd
          Junior Member
          • Jul 2010
          • 6

          #5
          Thanks for your always help!
          I do that like you.
          zabbix server set system service,successfully!
          But zabbix agentd can't set system service,yet:
          [root@localhost init.d]# chkconfig --level 345 zabbix_agentd on
          service zabbix_agentd does not support chkconfig
          [root@localhost init.d]# chkconfig zabbix_agentd on
          service zabbix_agentd does not support chkconfig
          [root@localhost init.d]# more zabbix_agentd
          #!/bin/sh
          #
          # chkconfig: 345 95 95
          # chkconfig: Zabbix Agentd
          #
          # zabbix_agentd_ctl
          #
          # control script to stop/start/restart zabbix_agentd
          # author: charlie collins
          # date: 01.21.2002
          #
          # revised 09.21.2003
          # (setup for Red Hat 7.3 with Zabbix 1.0 beta)
          # (should work for other Red Hat and Sys V style init machines as well)
          #
          # (modeled after apache style control scripts)
          # (this script can be placed in init.d and respective runlevel for startup usage)

          …………………………………………………………………………………………………………

          Always trouble you,I'm very sorry。
          Last edited by zhxd; 05-07-2010, 10:04.

          Comment

          • MrKen
            Senior Member
            • Oct 2008
            • 652

            #6
            You have one small error!

            # chkconfig: Zabbix Agentd

            Change that to:

            # description: Zabbix Agentd


            edit: Actually that was my fault, in post #4 above. Sorry!
            Disclaimer: All of the above is pure speculation.

            Comment

            • zhxd
              Junior Member
              • Jul 2010
              • 6

              #7
              Originally posted by MrKen
              You have one small error!

              # chkconfig: Zabbix Agentd

              Change that to:

              # description: Zabbix Agentd


              edit: Actually that was my fault, in post #4 above. Sorry!
              That's all right!
              I did not notice this place.
              Alas,Finally resolved.
              I will written it into my blog.
              Thanks a lot for your always help,again!
              Last edited by zhxd; 05-07-2010, 10:30.

              Comment

              Working...