Ad Widget

Collapse

External items implementation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • araw
    Member
    • May 2005
    • 31

    #1

    External items implementation




    My patch adds 'ExternalScriptsPath' to zabbix_server.conf, it is a path to a directory with executables, the names for which become the item keys. The first argument passed to the executable is the IP address or the hostname if useip!='1'. Anything within [ and ] is passed to the executable as additional command line arguments. If the file cannot be read or executed it should be tagged as "unsupported" and become disabled.

    I think the UserParameter statements are brilliant for agent configuration, but you cannot run an agent everywhere, and the ability for Zabbix to run external scripts from the server itself is essential in order to achieve the flexibility it needs to become a good all round monitoring/alerting system.

    Using UserParameter also also means agent reconfiguration and restart, as well as (ideally) requiring that each individual agent configuration file is monitoring and copied to CVS with something like RANCID.

    This is just a request for comment really. Can anyone see any major drawbacks to this (multiple layers of fork/context switches yes I know), or any problems with the code that I've not anticipated ? Any suggestions etc ?

    I think a flexible compiled plugin system would be more ideal for extending Zabbix with a reasonable level of assurity that the function performed is trustworthy and the type and extent of results will be guaranteed. Has anyone started work on something like that ?

    Example for external items,

    [root@zabbix zabbix]# ls -l /usr/lib/zabbix/external/
    total 32
    -rwxr-xr-x 1 zabbix zabbix 363 May 31 17:33 latency
    -rwxr-xr-x 1 zabbix zabbix 794 May 31 18:25 packetloss
    -rwxr-xr-x 1 zabbix zabbix 398 May 31 17:33 ping
    -rwxr-xr-x 1 zabbix zabbix 970 May 31 17:43 temptraxe

    [root@zabbix zabbix]# cat /usr/lib/zabbix/external/temptraxe
    #!/bin/sh

    CHECK_TEMPTRAXE="/usr/lib/nagios/plugins/contrib/check_temptraxe"

    HOST="${1}"
    PROBE="${2}"

    if [ -z "${HOST}" ]
    then
    echo "Usage: ${0} <HOST> [<PROBE>]"
    exit 1
    fi

    if [ -z "${PROBE}" ]
    then
    PROBE=1
    fi

    RESULT=`${CHECK_TEMPTRAXE} --celsius -H ${HOST} -p ${PROBE} | grep ^Temp | sed -e "s/^.*=\ //" -e "s/\ C.*$//"`

    if [ -z "${RESULT}" ]
    then
    echo "999.0"
    else
    echo "${RESULT}"
    fi

    # EOF

    mysql> SELECT key_, hostid, nextcheck, lastvalue, status, units, delta FROM items WHERE type='8' AND key_ LIKE '%temptrax%';
    +--------------+--------+------------+-----------+--------+-------+-------+
    | key_ | hostid | nextcheck | lastvalue | status | units | delta |
    +--------------+--------+------------+-----------+--------+-------+-------+
    | temptraxe[1] | 10059 | 1117897980 | 13.9 | 0 | degC | 0 |
    | temptraxe[2] | 10059 | 1117897980 | 30.3 | 0 | degC | 0 |
    | temptraxe[4] | 10059 | 1117897980 | 23.4 | 0 | degC | 0 |
    | temptraxe[3] | 10059 | 1117897980 | 27.2 | 0 | degC | 0 |
    +--------------+--------+------------+-----------+--------+-------+-------+
    4 rows in set (0.02 sec)

    mysql> SELECT key_, hostid, nextcheck, lastvalue, status, units, delta FROM items WHERE type='8' AND hostid='10018';
    +------------+--------+------------+-----------+--------+-------+-------+
    | key_ | hostid | nextcheck | lastvalue | status | units | delta |
    +------------+--------+------------+-----------+--------+-------+-------+
    | latency | 10018 | 1117531500 | 15.7 | 0 | ms | 0 |
    | packetloss | 10018 | 1117531500 | 0 | 1 | % | 0 |
    +------------+--------+------------+-----------+--------+-------+-------+
    2 rows in set (0.01 sec)

    mysql>
    Last edited by araw; 04-06-2005, 17:30.
  • primos
    Member
    • Jul 2005
    • 61

    #2
    char_count1

    char_count1 ??
    I'm trying to make it work with alpha12 but char_count1 function is missing!

    Could you copy/paste here the function.

    Comment

    • araw
      Member
      • May 2005
      • 31

      #3
      That's a variable integer named 'char_count', not a function.

      Comment

      • primos
        Member
        • Jul 2005
        • 61

        #4
        Ups, my mistake. Question: do you plan to write this diff for future version of zabbix 12 (or upcomming beta1), because I'm not sure Alexei will include it in the next edition, because I read changelog and this functionality was planned fo alpha12, well looking at the alpha12 servers code I don't see it.

        Comment

        • araw
          Member
          • May 2005
          • 31

          #5


          I have not tested this in any way, it may not even compile, I've gotten too pissed off with the fact alpha12's modified autoconf/automake doesn't work properly to be bothered even testing that much.

          Also, I'm not working with Zabbix at present. It's a fine system for small networks or simple monitoring scenarios (ie. a small to medium sized data centre/co-lo facility), and I would like to work with it more but I do not have the funding or the time do so, as it doesn't cut it for use on a large network at this point.

          Comment

          • primos
            Member
            • Jul 2005
            • 61

            #6
            Don't worry Alexei claims that this will be in new 1.1beta1 code!

            Comment

            • nikoula
              Junior Member
              • Jul 2005
              • 29

              #7
              some help

              I'm trying to add some simple check items on my zabbix, and i find this post.
              thanks for its

              but i can't see what changes was made on zabbix conf files, 'cause the web site refuse connection. (i mean http://araw.subverted.net when i'm talking about connection refused by web site)

              thx,
              Nicolas.
              Last edited by nikoula; 01-09-2005, 13:04.

              Comment

              • nikoula
                Junior Member
                • Jul 2005
                • 29

                #8
                ok the web site is running now

                thx for all

                Comment

                • James Wells
                  Senior Member
                  • Jun 2005
                  • 664

                  #9
                  I still am not able to get access to the diff and png files. I am still getting a connection refused.
                  Unofficial Zabbix Developer

                  Comment

                  • primos
                    Member
                    • Jul 2005
                    • 61

                    #10
                    hello

                    I've added the external patch (by hand) and fixed triggers for 1.1alpha12 (coppied cvs files for server code 23/8/05) so for testing until beta is released this is a working code for me. If you want the source code download it and try it!

                    http://gajba.gorkic.com/zabbix-1.1al...nal_items.diff -- > diff from araw , if you wish patch for alpha10 I have it too

                    http://gajba.gorkic.com/zabbix-1.1alpha12.zip -- > php gui is not fixed (I think, but the server code works as expected)

                    ps triggers work well but not shure for actions and mailing(for me it does not matter for the time being, I count on all of this to work out of box in beta1)!
                    Last edited by primos; 09-09-2005, 11:46.

                    Comment

                    • araw
                      Member
                      • May 2005
                      • 31

                      #11
                      Sorry guys, it's running on a box under my desk at work. Quite reliable until I had to re-patch stuff to do some MLPPP debugging. It'll be patched back in sometime tonight, and I have a few other things for Zabbix in the works that I'll post up sometime soon.

                      Comment

                      • nikoula
                        Junior Member
                        • Jul 2005
                        • 29

                        #12
                        re external items

                        can anyone repost the diff file to patch zabbix to use external items please ?

                        Comment

                        • Sarek
                          Junior Member
                          • Aug 2006
                          • 24

                          #13
                          Anyone still have this? I'll even take a patch for the beta. Was just about to add this myself.

                          Now I have to go find the changes I made before to add calculated items.

                          Comment

                          • primos
                            Member
                            • Jul 2005
                            • 61

                            #14
                            I'm using this with beta and still hope to see this in one of the upcoming releases. I was tolled this will be integrated in the 1.1 production release, so far nothing. I have so many things done via external items for me regular release is worthless.If your're going to implement this feature into 1.1.1, I'm interested too, very much.

                            OLD PATCH:

                            Comment

                            • Sarek
                              Junior Member
                              • Aug 2006
                              • 24

                              #15
                              I was bored and went ahead and did this yesterday to 1.1.1
                              I put it in the patch forum.

                              External Items Patch


                              Originally posted by primos
                              I'm using this with beta and still hope to see this in one of the upcoming releases. I was tolled this will be integrated in the 1.1 production release, so far nothing. I have so many things done via external items for me regular release is worthless.If your're going to implement this feature into 1.1.1, I'm interested too, very much.

                              OLD PATCH:
                              http://silos.gorkic.com/zabbix/patch.txt
                              Last edited by Sarek; 24-08-2006, 17:42.

                              Comment

                              Working...