Ad Widget

Collapse

item with script i wrote not supported

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bennethos
    Member
    • Jan 2005
    • 31

    #1

    item with script i wrote not supported

    Hi guys,

    I have a script that contains the following :

    #!/bin/bash

    ping -s 1000 -c 1 213.49.18.85 | grep icmp | awk '{ print $7}' | sed -e 's/time=//g'

    it gives an output like this :

    28.6
    ----------
    when i check my zabbix_server.log :
    006433:20060215:104705 Active parameter [lat.test] is not supported by agent on host [mariko.gigaspeeds.be]
    006433:20060215:104705 Type of received value [ZBX_NOTSUPPORTED] is not sutable for [[email protected]]

    Permissions of my script are ok

    zabbix@mariko:~$ ls -la ping_1500.sh
    -rwx--x--x 1 zabbix zabbix 137 Feb 15 10:45 ping_1500.sh

    any ideas' ??? I really need this script

    also tried with fping and a grep and sed to get the number only, but i get same result... all my other scripts work fine
    Last edited by bennethos; 15-02-2006, 14:05.
  • cameronsto
    Senior Member
    • Oct 2005
    • 148

    #2
    Run the zabbix agent with the '-p' argument. This will print out the results of most built-in items it supports and also will run all the UserParameter items you have setup. Check the output of your user item and make sure it looks good. You may have to remove any leading or trailing spaces if they are there. You can do this by piping the output to sed:
    Code:
    sed 's/ //g'
    -cameron

    Comment

    • bennethos
      Member
      • Jan 2005
      • 31

      #3
      zabbix_agentd -p | grep ping
      ping.test [s|93.2]

      I still get the msg that zabbix does not support it...

      Ive configged it as a "float", "store as is", refresh 10s

      Also added the sed line to remove white spaces...

      weird thing is, if i execute the script in my shell with >> ping.log to it, and i make :
      UserParameter=ping.echo,cat /home/zabbix/ping.log

      it works ! as a charachter and as a float...

      Could it be my script is not replying within the 0.5ms as indicated in the manual ??

      Its rather stupid writing a crontab that pings a host each 5 minutes, logging it in a file and writing a script for zabbix that echo's the log value dont you think so ?

      thx for your promt reply !

      Comment

      • Alexei
        Founder, CEO
        Zabbix Certified Trainer
        Zabbix Certified SpecialistZabbix Certified Professional
        • Sep 2004
        • 5654

        #4
        Are you sure your scipt is able to find all external commands (ping, awk, whatever) without proper environment (PATH)? Try to put full names to all executed commands.
        Alexei Vladishev
        Creator of Zabbix, Product manager
        New York | Tokyo | Riga
        My Twitter

        Comment

        • cameronsto
          Senior Member
          • Oct 2005
          • 148

          #5
          Try changing the type of your item to 'Character' and see if it works then. I'm having a similar problem right now with a userparameter of my own that works as 'Character' but not as float.

          -cameron

          Comment

          • bennethos
            Member
            • Jan 2005
            • 31

            #6
            if I check the zabbix_agentd in shell the script gives :
            zabbix_agentd -p : | grep ping
            ping.test [s|26.1]

            tried it as charachter, added full path names for awk, sed, grep, ping etc...

            weird thing is, it gives a correct value as you see, but when i check the log file :


            in log file :
            020467:20060218:111157 Active parameter [ping.test] is not supported by agent on host [mariko.gigaspeeds.be]
            020467:20060218:111157 Type of received value [ZBX_NOTSUPPORTED] is not sutable for [[email protected]]

            :-( getting desperate here

            thx for your help so far

            Comment

            • Godzilla
              Junior Member
              • Aug 2005
              • 24

              #7
              I have this type of problem also.

              After upgrading from 1.1beta2 to beta6, I took me a couple of days to find out that my awk '{print $4}' needs to be changed to awk '{print $ 4}'

              Also, the value cannot be saved as a float anymore. It needs to be saved as a character.

              It's ridiculous to have a cron to save the value into a file then use UserParameter to cat the file for the value.

              I cannot graph values defined under character.

              How to solve this?

              Comment

              • Alexei
                Founder, CEO
                Zabbix Certified Trainer
                Zabbix Certified SpecialistZabbix Certified Professional
                • Sep 2004
                • 5654

                #8
                I do not quite understand why the values cannot be saved as float. Do you see anything in zabbix_server log file? Anything in error field for the item? May I have result of execution of your custom script? Thanks.
                Alexei Vladishev
                Creator of Zabbix, Product manager
                New York | Tokyo | Riga
                My Twitter

                Comment

                • Godzilla
                  Junior Member
                  • Aug 2005
                  • 24

                  #9
                  my file that I'm trying to get info from:
                  # cat /home/as400p/monitor/cpysts
                  JOBLSTSTS $DATE $TIME JOBLSTSTS
                  COUNT
                  L-Deplotter 22/02/06 11:45:16 4
                  L-Plotter 22/02/06 11:45:16 4
                  1*CPYASN 22/02/06 11:45:16 1
                  - ++++++++ 00:00:00 9
                  * * * E N D O F R E P O R T * * *


                  what I'm trying to get:
                  # grep "00:00:00" /home/as400p/monitor/cpysts|awk '{print $ 4}'
                  9


                  my zabbix_agentd file:
                  UserParameter=as400p,grep "00:00:00" /home/as400p/monitor/cpysts|awk '{print $ 4}'


                  error reports a control char "^M" stuck at the end:
                  016617:20060222:123527 get_value_agent: host[HK.HF.SVR.ZabbixLocalhost] ip[172.16.0.31] key [as400p]
                  016617:20060222:123527 Sending [as400p]
                  016617:20060222:123527 Type of received value [9^M] is not sutable for [[email protected]]
                  016617:20060222:123527 Returning NOTSUPPORTED
                  016617:20060222:123527 Parameter [as400p] is not supported by agent on host [HK.HF.SVR.ZabbixLocalhost] Old status [0]


                  I'm trying to save as float but I cannot get rid of the control char.
                  It works fine in beta2, but not in beta6.

                  Thanks for any help

                  Comment

                  • Godzilla
                    Junior Member
                    • Aug 2005
                    • 24

                    #10
                    It works now. I added a "sed" statement.

                    grep "00:00:00" /home/as400p/monitor/cpysts|awk '{print $ 4}'|sed 's/\r//'

                    Comment

                    • bennethos
                      Member
                      • Jan 2005
                      • 31

                      #11
                      not solved for me yet

                      here is my script again... :

                      when i run it :
                      mariko:/home/zabbix# ./ping_1500.sh
                      157

                      the script contains :
                      #!/bin/bash

                      /bin/ping -c 1 -s 1400 213.49.18.85 |/bin/grep icmp |/usr/bin/awk '{print $ 7}' |/bin/sed -e 's/time=//g' |/bin/sed -e 's/ //g' |/bin/sed 's/\r//'

                      Alexei, I added like you suggested full paths... and I changed print$7 to print $ 7 like godzilla...

                      when I do zabbix_agentd -p | grep pingtest I get :
                      pingtest [s|123]

                      My zabbix_agentd.conf contains :
                      UserParameter=pingtest,/home/zabbix/ping_1500.sh

                      my file permissions :
                      -rwxr-x--- 1 zabbix zabbix 387 2006-02-22 10:53 /home/zabbix/ping_1500.sh

                      my zabbix_server.log logfile indicates :

                      020467:20060222:105619 Active parameter [pingtest] is not supported by agent on host [mariko.gigaspeeds.be]

                      I tried it as charachter, float etc...



                      btw, I'm running a cron each 5 Minutes, that executes my script >> its in a ping.log file... then i added a UserParameter in zabbix_agentd.conf that cat's the log file AND THIS DOES WORK ! Even as a float !!!

                      Hope you can help me out alexei

                      running debian with 2.4.6 kernel and the latest beta zabbix
                      Last edited by bennethos; 22-02-2006, 12:21.

                      Comment

                      • krusty
                        Senior Member
                        • Oct 2005
                        • 222

                        #12
                        Originally posted by bennethos
                        my file permissions :
                        -rwxr-x--- 1 zabbix zabbix 387 2006-02-22 10:53 /home/zabbix/ping_1500.sh
                        maybe you have to chmod the script like this

                        Code:
                        chmod 4750 ping_1500.sh

                        Comment

                        • bennethos
                          Member
                          • Jan 2005
                          • 31

                          #13
                          still not working...

                          ZBX_NOT_SUPPORTED it gives me in the monitoring latest data, then I get in the items list an unsupported item

                          Comment

                          • elkor
                            Senior Member
                            • Jul 2005
                            • 299

                            #14
                            it's early.. and I have only been half following this thread so forgive me if this is something stupid or something that's been gone over before, but why is there a "s|" in your output?

                            wouldn't you just want numeric?

                            man, I need coffee.....

                            Comment

                            • cameronsto
                              Senior Member
                              • Oct 2005
                              • 148

                              #15
                              Originally posted by elkor
                              it's early.. and I have only been half following this thread so forgive me if this is something stupid or something that's been gone over before, but why is there a "s|" in your output?

                              wouldn't you just want numeric?

                              man, I need coffee.....
                              That's the way zabbix outputs the results when you do "zabbix_agentd -p". Go make some coffee.

                              -cameron

                              Comment

                              Working...