Ad Widget

Collapse

Zabbix-Agent restart no pid file...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MrRobbert
    Member
    • Nov 2006
    • 50

    #16
    root@VMWARESERVER01:/var/run/zabbix# chown zabbix /var/run/zabbix/
    root@VMWARESERVER01:/var/run/zabbix# chown zabbix /var/run/zabbix/*
    root@VMWARESERVER01:/var/run/zabbix# chmod 664 /var/run/zabbix/*
    root@VMWARESERVER01:/var/run/zabbix# chmod 755 /var/log/zabbix/
    root@VMWARESERVER01:/var/run/zabbix# chown zabbix /var/log/zabbix/*
    root@VMWARESERVER01:/var/run/zabbix# chmod 664 /var/log/zabbix/*
    root@VMWARESERVER01:/var/run/zabbix# ls -al
    total 0
    drwxr-xr-x 2 zabbix root 60 2006-11-27 10:50 .
    drwxr-xr-x 8 root root 400 2006-11-27 10:50 ..
    -rw-rw-r-- 1 zabbix root 0 2006-11-27 10:50 agentd.pid

    root@VMWARESERVER01:~# /etc/init.d/zabbix-agent restart
    Stopping Zabbix agent: zabbix_agentd
    No process in pidfile `/var/run/zabbix/agentd.pid' found running; none killed.
    Starting Zabbix agent: zabbix_agentd
    /var/run/zabbix/agentd.pid seems to be stolen. Removing..


    root@VMWARESERVER01:~# cd /var/run/zabbix/
    root@VMWARESERVER01:/var/run/zabbix# ls -al
    total 0
    drwxr-xr-x 2 zabbix root 40 2006-11-27 10:54 .
    drwxr-xr-x 8 root root 400 2006-11-27 10:50 ..
    root@VMWARESERVER01:/var/run/zabbix#

    Comment

    • cadbury
      Member
      • Apr 2005
      • 77

      #17
      and now if you start it?

      /etc/init.d/zabbix-agentd start

      Comment

      • MrRobbert
        Member
        • Nov 2006
        • 50

        #18
        i cant start zabbix-agentd.pid but i can start zabbix-agent.pid...



        root@VMWARESERVER01:/var/run/zabbix# /etc/init.d/zabbix-agentd start
        -bash: /etc/init.d/zabbix-agentd: No such file or directory
        root@VMWARESERVER01:/var/run/zabbix# /etc/init.d/zabbix-agent start
        Starting Zabbix agent: zabbix_agentd
        root@VMWARESERVER01:/var/run/zabbix#

        Comment

        • cadbury
          Member
          • Apr 2005
          • 77

          #19
          ok, it seems to have no init.d script for agentd.
          but running zabbix-agent is no good choice, because it's made to be run by a wrapper like xinetd.
          zabbix-agentd is much more simple.

          put the init.d script in /etc/init.d/ for agentd

          Comment

          • cadbury
            Member
            • Apr 2005
            • 77

            #20
            wait, when you run /etc/init.d/zabbix-agent start, it starts agentd.
            make a "ps -ax | grep zabbix" (yes it's a ps this time ),
            if there are some zabbix_agentd processes, it should be all right

            Comment

            • MrRobbert
              Member
              • Nov 2006
              • 50

              #21
              oke this is what it does...

              root@VMWARESERVER01://# /etc/init.d/zabbix-agent restart

              root@VMWARESERVER01://# ps -ax | grep zabbix
              Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html
              5314 pts/0 S+ 0:00 grep zabbix


              it actually doesnt do anything anymore when i start it or restart it...
              Last edited by MrRobbert; 28-11-2006, 11:18.

              Comment

              • cadbury
                Member
                • Apr 2005
                • 77

                #22
                ok so it's not running
                too bad

                first of all, put the init.d script for agentd,
                then retry starting

                to see if it runs, make a "ps ax", you should see zabbix_agentd

                if not, see the logs

                Comment

                • MrRobbert
                  Member
                  • Nov 2006
                  • 50

                  #23
                  So i have to create a new file:

                  /etc/init.d/zabbix-agentd

                  the content of this file will be:

                  Code:
                  #! /bin/sh
                  ### BEGIN INIT INFO
                  # Provides:          zabbix-agent
                  # Required-Start:    $local_fs $network
                  # Required-Stop:     $local_fs
                  # Default-Start:     S
                  # Default-Stop:      0 6
                  # Short-Description: Start zabbix-agent daemon
                  ### END INIT INFO
                  DAEMON=/usr/sbin/zabbix_agentd
                  NAME=zabbix_agentd
                  DESC="Zabbix agent"
                  PID=/var/run/zabbix-agent/$NAME.pid
                  
                  test -f $DAEMON || exit 0
                  
                  set -e
                  
                  case "$1" in
                    start)
                          rm -f $PID
                          echo "Starting $DESC: $NAME"
                          start-stop-daemon --oknodo --start --pidfile $PID \
                                  --exec $DAEMON  < /dev/null &> /dev/null
                          ;;
                    stop)
                          echo "Stopping $DESC: $NAME"
                          start-stop-daemon --oknodo --stop --exec $DAEMON
                          ;;
                    restart|force-reload)
                          $0 stop
                          $0 start
                          ;;
                    *)
                          N=/etc/init.d/$NAME
                          echo "Usage: $N {start|stop|restart|force-reload}" >&2
                          exit 1
                          ;;
                  esac
                  
                  exit 0

                  so i nano zabbix-agentd

                  put the script text in en i'll save it as zabbix-agentd


                  is this right or...?
                  Last edited by MrRobbert; 28-11-2006, 11:59.

                  Comment

                  • amcorreia
                    Member
                    • Mar 2006
                    • 73

                    #24
                    Hi,

                    this init.d script is pierced! (I tried use this script in debian and don't worked)

                    tri anything like this.


                    ########################################
                    PATH=/bin:/usr/bin:/sbin:/usr/sbin:/home/zabbix/bin
                    DAEMON=/usr/local/sbin/zabbix_server
                    NAME=zabbix_server
                    DESC="Zabbix Server"
                    PID=/var/run/zabbix/$NAME.pid # definido no arq de conf do server

                    test -x $DAEMON || exit 0
                    set -e
                    del_pid () {
                    if [ -f $PID ]; then
                    echo -n "Deleting pid... "
                    rm $PID
                    echo "OK"
                    fi
                    }

                    case "$1" in
                    start)
                    del_pid
                    echo "Starting $DESC: $NAME"
                    $DAEMON
                    ;;
                    stop)
                    del_pid
                    echo "Stopping $DESC: $NAME"
                    killall -9 $NAME
                    ;;
                    check_banco)
                    echo -n "Checando banco de dados: "
                    /usr/bin/mysqlcheck -u zabbix -p --silent --repair zabbix
                    echo "Completa"
                    ;;
                    restart|force-reload)
                    $0 stop
                    $0 start
                    ;;
                    *)
                    N=/etc/init.d/$NAME
                    echo "Usage: $N {start|stop|restart|check_banco|force-reload}"
                    #>&2
                    exit 1
                    ;;
                    esac

                    exit 0

                    Comment

                    • cadbury
                      Member
                      • Apr 2005
                      • 77

                      #25
                      you can use both scripts.

                      give it the same rights than the other /etc/ini.d scripts
                      (I don't have a linux right now so i can't give you the exact rights)

                      Comment

                      • amcorreia
                        Member
                        • Mar 2006
                        • 73

                        #26
                        Originally posted by cadbury
                        you can use both scripts.

                        give it the same rights than the other /etc/ini.d scripts
                        (I don't have a linux right now so i can't give you the exact rights)
                        permissions inside /etc/init.d are 755 and owner is root.root

                        Comment

                        • MrRobbert
                          Member
                          • Nov 2006
                          • 50

                          #27
                          oke i inserted the script, do i need to save the file with a specific extension i just saved it like 'zabbix-agent'

                          when i type /etc/init.d/zabbix-agent restart my host doesnt execute the script, at least that is how it seems to be...

                          ???????????





                          Code:
                          sTH=/bin:/usr/bin:/sbin:/usr/sbin:/home/zabbix/bin
                          DAEMON=/usr/sbin/zabbix_agentd
                          NAME=zabbix_agentd
                          DESC="Zabbix Server"
                          PID=/var/run/zabbix-agent/$NAME.pid # definido no arq de conf do server
                          
                          test -x $DAEMON || exit 0
                          set -e
                          del_pid () {
                          if [ -f $PID ]; then
                          echo -n "Deleting pid... "
                          rm $PID
                          echo "OK"
                          fi
                          }
                          
                          case "$1" in
                          start)
                          del_pid
                          echo "Starting $DESC: $NAME"
                          $DAEMON
                          ;;
                          stop)
                          del_pid
                          echo "Stopping $DESC: $NAME"
                          killall -9 $NAME
                          ;;
                          check_banco)
                          echo -n "Checando banco de dados: "
                          /usr/bin/mysqlcheck -u zabbix -p --silent --repair zabbix
                          echo "Completa"
                          ;;
                          restart|force-reload)
                          $0 stop
                          $0 start
                          ;;
                          *)
                          N=/etc/init.d/$NAME
                          echo "Usage: $N {start|stop|restart|check_banco|force-reload}"
                          #>&2
                          exit 1
                          ;;
                          esac
                          
                          exit 0




                          Code:
                          root@VMWARESERVER01:/etc/init.d# ls -all
                          total 308
                          drwxr-xr-x  2 root root  4096 2006-11-29 10:59 .
                          drwxr-xr-x 62 root root  4096 2006-11-29 09:38 ..
                          -rwxr-xr-x  1 root root  9282 2006-05-29 14:03 alsa-utils
                          -rwxr-xr-x  1 root root  1387 2006-05-08 23:44 atd
                          -rw-r--r--  1 root root  2553 2006-05-23 12:39 bootclean.sh
                          -rwxr-xr-x  1 root root  1788 2006-05-23 12:39 bootlogd
                          -rwxr-xr-x  1 root root  2030 2006-05-23 12:39 bootmisc.sh
                          -rwxr-xr-x  1 root root  1984 2006-05-23 12:39 checkfs.sh
                          -rwxr-xr-x  1 root root  8831 2006-05-23 12:39 checkroot.sh
                          -rwxr-xr-x  1 root root  5979 2006-01-23 17:50 console-screen.sh
                          -rwxr-xr-x  1 root root  1739 2005-11-15 13:42 cron
                          -rwxr-xr-x  1 root root   795 2006-02-23 17:37 dns-clean
                          -rwxr-xr-x  1 root root   923 2006-05-16 10:41 evms
                          -rwxr-xr-x  1 root root  6175 2006-05-21 20:46 glibc.sh
                          -rwxr-xr-x  1 root root  1404 2006-05-23 12:39 halt
                          -rwxr-xr-x  1 root root  5137 2005-04-21 12:10 hdparm
                          -rwxr-xr-x  1 root root   992 2006-05-23 12:39 hostname.sh
                          -rwxr-xr-x  1 root root  7072 2006-11-27 14:00 httpd.vmware
                          -rw-r--r--  1 root root  7072 2006-11-27 10:33 httpd.vmware.old.0
                          -rwxr-xr-x  1 root root  6947 2006-11-27 13:52 httpd.vmware.orig
                          -rwxr-xr-x  1 root root  3634 2006-05-16 03:43 hwclock.sh
                          -rwxr-xr-x  1 root root   222 2006-10-31 14:35 inetd
                          -rwxr-xr-x  1 root root  3170 2005-11-25 21:30 keymap.sh
                          -rwxr-xr-x  1 root root  1840 2006-04-24 20:36 klogd
                          -rwxr-xr-x  1 root root   748 2006-01-23 19:47 loopback
                          -rwxr-xr-x  1 root root  2867 2005-11-08 09:30 lvm
                          -rwxr-xr-x  1 root root   822 2005-11-25 16:16 makedev
                          -rwxr-xr-x  1 root root  1124 2006-05-16 14:41 mdadm
                          -rwxr-xr-x  1 root root  1059 2006-05-16 14:41 mdadm-raid
                          -rwxr-xr-x  1 root root   921 2006-05-05 17:47 module-init-tools
                          -rwxr-xr-x  1 root root  2069 2006-05-23 12:39 mountall.sh
                          -rwxr-xr-x  1 root root  1256 2006-05-23 12:39 mountdevsubfs
                          -rwxr-xr-x  1 root root  1384 2006-05-23 12:39 mountvirtfs
                          -rwxr-xr-x  1 root root  2290 2006-05-23 12:39 mtab
                          -rwxr-xr-x  1 root root  1685 2006-05-11 08:54 networking
                          -rwxr-xr-x  1 root root  3386 2006-03-23 21:40 pcmciautils
                          -rwxr-xr-x  1 root root  1061 2006-07-05 15:00 ppp
                          -rwxr-xr-x  1 root root   281 2006-07-05 15:00 pppd-dns
                          -rwxr-xr-x  1 root root  1234 2006-01-23 17:10 procps.sh
                          -rwxr-xr-x  1 root root  6897 2006-05-23 12:39 rc
                          -rwxr-xr-x  1 root root   522 2006-05-23 12:39 rc.local
                          -rwxr-xr-x  1 root root   188 2006-05-23 12:39 rcS
                          -rw-r--r--  1 root root   866 2006-05-23 12:39 README
                          -rwxr-xr-x  1 root root   732 2006-05-23 12:39 reboot
                          -rwxr-xr-x  1 root root  1226 2006-05-23 12:39 rmnologin
                          -rwxr-xr-x  1 root root  2924 2006-05-05 16:41 rsync
                          -rwxr-xr-x  1 root root  1081 2006-05-23 12:39 sendsigs
                          -rwxr-xr-x  1 root root  1126 2006-05-23 12:39 single
                          -rwxr-xr-x  1 root root  2679 2006-05-23 12:39 skeleton
                          -rwxr-xr-x  1 root root  1943 2006-04-04 14:42 snmpd
                          -rwxr-xr-x  1 root root  2016 2006-10-02 13:26 ssh
                          lrwxrwxrwx  1 root root     8 2006-10-31 15:53 stop-bootlogd -> bootlogd
                          -rwxr-xr-x  1 root root  1669 2006-04-24 20:36 sysklogd
                          -rwxr-xr-x  1 root root  2539 2006-05-22 16:24 udev
                          -rwxr-xr-x  1 root root  1588 2006-05-23 12:39 umountfs
                          -rwxr-xr-x  1 root root  1989 2006-05-23 12:39 umountnfs.sh
                          -rwxr-xr-x  1 root root   912 2006-05-23 12:39 umountroot
                          -rwxr-xr-x  1 root root  1965 2006-05-23 12:39 urandom
                          -r-xr-xr-x  1 root root 20319 2006-10-31 14:51 vmware
                          -rwxr-xr-x  1 root root  1967 2006-05-23 12:39 waitnfs.sh
                          -rwxr-xr-x  1 root root  1091 2006-04-24 19:53 x11-common
                          -rwxr-xr-x  1 root root  1481 2006-01-19 17:16 xinetd
                          -rwxr-xr-x  1 root root   766 2006-11-29 10:59 zabbix-agent
                          root@VMWARESERVER01:/etc/init.d# /etc/init.d/zabbix-agent restart
                          root@VMWARESERVER01:/etc/init.d#
                          Last edited by MrRobbert; 29-11-2006, 12:03.

                          Comment

                          • cadbury
                            Member
                            • Apr 2005
                            • 77

                            #28
                            name it zabbix_agentd, because zabbix_agent and zabbix_agentd are different things it can confuse

                            i'm no specialist in init.d scripts so i can't help you here

                            is the pidfile the same than in the file zabbix-agentd.conf :
                            PID=/var/run/zabbix-agent/zabbix_agentd.pid

                            does the file /usr/sbin/zabbix_agentd really exists, and have correct rights?
                            mine is like this :
                            240 -rwxr-xr-x 1 root root 241565 Nov 17 16:07 zabbix_agentd

                            Comment

                            • amcorreia
                              Member
                              • Mar 2006
                              • 73

                              #29
                              ....
                              more questions;

                              - You have compiled zabbix_agentd with shared library or static?
                              - where you installed zabbix_agentd ?
                              - where you installed zabbix_agentd.conf ?

                              Comment

                              • MrRobbert
                                Member
                                • Nov 2006
                                • 50

                                #30
                                Originally posted by amcorreia
                                ....
                                more questions;

                                - You have compiled zabbix_agentd with shared library or static?
                                I installed it with apt-get install zabbix-agent
                                i dont know if i had to choose something like library or static?


                                - where you installed zabbix_agentd ?
                                root@VMWARESERVER01:/etc/init.d# locate zabbix_agentd
                                /etc/zabbix/zabbix_agentd.conf
                                /etc/zabbix/zabbix_agentd.conf.dpkg-old
                                /usr/bin/zabbix_agentd
                                /usr/share/man/man1/zabbix_agentd.1.gz




                                - where you installed zabbix_agentd.conf ?
                                /etc/zabbix/zabbix_agentd.conf

                                Comment

                                Working...