Ad Widget

Collapse

Init.d scripts generate start up error for running the agentd/server

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • xaviercardoza
    Junior Member
    • Oct 2010
    • 29

    #1

    Init.d scripts generate start up error for running the agentd/server

    Below is the scripts on page 18 I typed from the Zabbix 1.8 Network monitoring book (Richards Olups), but it was written for suse 10. After I run the command ln -s to generate the symlinks I try to run the agentd and server but it returns back with an error which is pointing to the around the last command echo.

    ERROR message
    "
    /etc/init.d/zabbix_agentd: line 123: unexpected EOF while looking for matching ` "'
    /etc/init.d/zabbix_agentd: line 129: syntax error: unexpected end of file
    "



    #! /bin/sh
    # Copyright (c) 07/2004 A.Tophofen, Germany
    # Modified for Zabbix 1.1alpha7 and SuSE Linux 9.2
    # April 2005, A. Kiepe, Switzerland
    #
    # init.d/zabbix_server
    #
    ### BEGIN INIT INFO
    # Provides: zabbix_agentd
    # Required-Start: $network $remote_fs $local_fs
    # Required-Stop: $network $remote_fs $local_fs
    # Default-Start: 3 5
    # Default-Stop: 0 1 2 6
    # Description: Zabbix Monitoring agentd deamon
    ### END INIT INFO

    ZABBIX_CONFIG="/etc/zabbix/zabbix_agentd.conf"

    test -r $ZABBIX_CONFIG || { echo "$ZABBIX_CONFIG Missing";
    if [ "$1" = "stop" ]; then exit 0;
    else exit 6; fi; }

    ZABBIX_BIN="/usr/local/sbin/zabbix_agentd"

    test -x $ZABBIX_BIN || { echo "$ZABBIX_BIN not installed";
    if [ "$1" = "stop" ]; then exit 0;
    else exit 5; fi; }

    . /etc/rc.status

    # Reset status of this service
    rc_reset

    NAME="Zabbix agentd daemon"
    ZABBIX_PID="/var/tmp/zabbix_agentd.pid"

    case "$1" in
    start)
    echo -n "Starting ${NAME} "
    ## Start Daemon with startproc(8). If this fails
    ## the return value is set appropriately by startproc
    /sbin/startproc -t l -p $ZABBIX_PID $ZABBIX_BIN

    # Remember status and be verbose
    rc_status -v
    ;;
    stop)
    echo -n "Shutting down ${NAME}"
    ## Stop daemon with killproc(8) and if this fails
    ## killproc sets the return value according to LSB.

    /sbin/killproc -TERM $ZABBIX_BIN

    # Remember status and be verbose
    rc_status -v
    ;;
    try-restart|condrestart)
    ## Do a restart only if the service was active before
    ## Note: try-restart is now part of the LSB (as of 1.9)
    ## RH has similar command named condrestart.
    if test "$1" = "condrestart"; then
    echo "$[attn} Use try-restart ${done} (LSB)${attn} rather than
    condrestart ${warn} (RH) ${norm}"
    fi
    $0 status
    if test $? = 0; then
    $0 restart
    else
    rc_reset # Not running is not a failure
    fi
    # Remember status and be quiet
    rc_status
    ;;
    restart)
    ## Stop the service and regardless of whethewr it was
    ## running or not, start it again
    $0 stop
    $0 start
    # Remember status and be quiet
    rc_status
    ;;
    force-reload)
    ## Zabbix server daemon does not support configuration reloading
    ## thus it is restarted, if running


    echo -n "Reload service $NAME "


    $0 try-restart
    rc_status
    ;;
    reload)
    ## Zabbic server deamon does not support configuration reloading
    ## thus reload fails

    rc_failed 3
    rc_status -v
    ;;

    status)
    echo -n "Checking for service $NAME "

    ## Check status with checkproc(8), if process is running
    ## checkproc will return with exit status 0

    # Return value is slightly different for the status command:
    # 0 - service up and running
    # 1 - service dead, but PID file exists
    # 2 - service dead, but /var/lock/ lock file exists
    # 3 - service not running (unused)
    # 4 - service status unknown :-(
    # 5--199 reserved (5--99 LSB, 100--149 distro, 150--199 appl.)

    # NOTE: checkproc returns LSB compliant status values.
    /sbin/checkproc -p $ZABBIX_PID $ZABBIX_BIN
    # NOTE: rc_status knows that we can called this init script with
    # "status" option and adapts its message accordingly
    rc_status -v
    ;;
    probe)
    ## Optional: Probe for the necessity of a reload, print out the
    ## argument to this init script which is required for a reload
    ## Note: probe is not (yet) part of the LSB (as of 1.9)

    test $ZABBIX_CONFIG -nt $ZABBIX_PID && echo reload
    ;;
    *)
    echo "Usage: $0 {start|stop|status|try-restart|force-reload|reload|probe}"
    exit 1
    ;;
    esac
    rc_exit
  • richlv
    Senior Member
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Oct 2005
    • 3112

    #2
    that one quite definitely is not from the book. first, it is for suse 9.2, second, it refers to server in the header and agentd in the file itself, third... well, it's probably just outdated

    also, if you have the book, you should have access to the electronic version of that script - no need to retype it.
    Zabbix 3.0 Network Monitoring book

    Comment

    • xaviercardoza
      Junior Member
      • Oct 2010
      • 29

      #3
      PLEASE. Let me sure on what I am saying . It is from the book where I typed it from PAGE 18 to 25. Book is called Zabbix 1.8 Network Monitoring by Rihards Olup. The scripts was based on SUSE 10.2 SP2 but I am running SUSE 11

      However, I also agree with you after reading your email, it is also in 9.2 . DOE I only checked 9.3 which is why I typed it out, and just did not correct the comments

      Also upon reading you response I re-read the book and found out there there is an electronic version of the examples in the book.

      Anyways, back to helping me....... Do you know about the errors I spoke about in my main threat ?

      Comment

      • richlv
        Senior Member
        Zabbix Certified Trainer
        Zabbix Certified SpecialistZabbix Certified Professional
        • Oct 2005
        • 3112

        #4
        wanna bet - that script is not from the book ?
        i can place a lot on such a bet.

        anyway, it is a syntax error. that script is an older version of agentd script found in misc/init.d/suse/9.2 in zabbix source distribution. as such, i don't feel the need to debug your version - you can always grab the script from the book. or just the one from zabbix source directory, if you feel like it (if that one has errors, though, they should be fixed).
        Zabbix 3.0 Network Monitoring book

        Comment

        • xaviercardoza
          Junior Member
          • Oct 2010
          • 29

          #5
          Hey you my kind of techie

          Hi there,

          Don't mind the bet. name your stakes! I honor bets. I'm a good loser. I'll buy diner (TGI-Fridays), beers all night as long as the girlfriends don't mind a few guys with hang-overs. If not, lets see if they manage to get the yearly Zabbix Conference going I am sure I will lose the bet.

          Its a good admission, that you don't recognise the script I typed in because I must be seriously dislecsik.

          No seriously, thanks for your comments, given I am using SUSE 11 which version of the scripts should I user from the tar file 9.2/9.3 ? Or should I use the one from electronic version as provided by the web link www.packtpub.com/files/code/7689_code.zip ?

          Many thanks, and kind regards
          Lazarus,

          Comment

          • xaviercardoza
            Junior Member
            • Oct 2010
            • 29

            #6
            Script files from 9.3 worked a treat.

            Thank-you.

            Comment

            • richlv
              Senior Member
              Zabbix Certified Trainer
              Zabbix Certified SpecialistZabbix Certified Professional
              • Oct 2005
              • 3112

              #7
              it's great that the script worked for you

              as for the origin of the script, there are multiple differences - copyright is different, licence is missing, description and header overall differ a lot. some other parts are very similar (which is to be expected of initscripts, especially for the same distro) with minor differences.

              hopefully for 2.0 zabbix example initscripts will be at least somewhat improved and people will be able to just grab them and use as-is.
              Zabbix 3.0 Network Monitoring book

              Comment

              Working...