Ad Widget

Collapse

PATCH: External scripts

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • primos
    Member
    • Jul 2005
    • 61

    #16
    Fix

    I've changed one line, now it works.

    SET_STR_RESULT(result,strdup(msg)); --------------->into ------------->set_result_type(result,item->value_type,strdup(msg));

    lp, p

    Comment

    • Sarek
      Junior Member
      • Aug 2006
      • 24

      #17
      Good catch! Thanks!

      I've updated the post above with that change.

      Originally posted by primos
      I've changed one line, now it works.

      SET_STR_RESULT(result,strdup(msg)); --------------->into ------------->set_result_type(result,item->value_type,strdup(msg));

      lp, p

      Comment

      • RohrbaGe
        Senior Member
        • Aug 2005
        • 167

        #18
        Single script

        Sarek, yes I understand what you mean.
        My basic idea was to have only one script, but I will live with one script per key.
        Anyway we will not monitor more than 15 values on the AS400.

        I will try your code in the next days. So if you mean you C is rusty, well
        mine is much more rusty. And the php code, well, we do not talk about...
        I have several ideas, but I can“t code yet. ASP I know better..

        Regards
        Gerald


        Originally posted by Sarek
        Yes, it would probably hang. As I said I'm a little rusty with my C.

        I'm not sure I understand the question. are you asking if you can call an external script and write multiple values? If so then the answer would be no. Just like with every other check you only get to set one value in the database. You just need a script or executable that you can call that returns one line. Only the first line is read and used, everything else is ignored. As a habbit I also have my scripts exit 0.

        Comment

        • Sarek
          Junior Member
          • Aug 2006
          • 24

          #19
          Well you can have one script that you pass a parameter to in order to tell it to return something else.

          Originally posted by RohrbaGe
          Sarek, yes I understand what you mean.
          My basic idea was to have only one script, but I will live with one script per key.
          Anyway we will not monitor more than 15 values on the AS400.

          I will try your code in the next days. So if you mean you C is rusty, well
          mine is much more rusty. And the php code, well, we do not talk about...
          I have several ideas, but I can“t code yet. ASP I know better..

          Regards
          Gerald

          Comment

          • Xlylith
            Junior Member
            • Aug 2006
            • 2

            #20
            Snmp

            Wow, I haven't checked this thread before posting in http://www.zabbix.com/forum/showthread.php?t=3867

            I'll try it...probably this workaround is what I am looking for.

            Salam,
            Yudhistiro T.K

            Comment

            • RohrbaGe
              Senior Member
              • Aug 2005
              • 167

              #21
              use one script for multiple values

              Sarek,
              you are right, the parameter will make the key unique.
              It seems to work fine during my basic tests.
              The patching is a nightmare, I really hope Alexei will pickup your code.
              I will continue in the next days to start monitoring the AS400 with that external checks.


              Regards
              Gerald


              Originally posted by Sarek
              Well you can have one script that you pass a parameter to inthis wath I thought also first. order to tell it to return something else.

              Comment

              • RohrbaGe
                Senior Member
                • Aug 2005
                • 167

                #22
                zabbix 1.1.2

                Hi,

                has anybody tested to use the external script on 1.1.2.

                I applied all the changes at the source manually, but I can“t
                get it running under 1.1.2. Under 1.1.1 it has worked fine.

                I double checked already the changes without success.

                In the zabbix log I found:
                Not supported item type:9
                I checked the c code, because 9 is the number for the external checks.

                Has someone else the extenal scrips running under 1.1.2?

                Regards
                Gerald

                Comment

                • Sarek
                  Junior Member
                  • Aug 2006
                  • 24

                  #23
                  I haven't tried it with 1.1.2 yet. I've got so many patches in there I've done myself I don't want to go through the pain of adding them back! If I get some time in the next few days I'll have a look.

                  But, off the top of my head, it sounds like a define is missing in some .h file.

                  Originally posted by RohrbaGe
                  Hi,

                  has anybody tested to use the external script on 1.1.2.

                  I applied all the changes at the source manually, but I can“t
                  get it running under 1.1.2. Under 1.1.1 it has worked fine.

                  I double checked already the changes without success.

                  In the zabbix log I found:
                  Not supported item type:9
                  I checked the c code, because 9 is the number for the external checks.

                  Has someone else the extenal scrips running under 1.1.2?

                  Regards
                  Gerald

                  Comment

                  • James Wells
                    Senior Member
                    • Jun 2005
                    • 664

                    #24
                    Greetings,

                    I am currently looking into this with Zabbix 1.3 and will produce a full patch if / when I get it working. I do have one question though. Reading through the thread, I see;
                    Originally posted by Sarek
                    To be able to create a trigger for these I had to change
                    include/config.inc.php
                    Line 655 to:
                    Code:
                    if (eregi('^\{([0-9a-zA-Z\_\.-]+)\:([]\[0-9a-zA-Z\_\*\/\.\,\'\:\(\) -]+)\.([a-z]{3,11})\(([#0-9a-zA-Z\_\/\.\,[:space:]]+)\)\}$', $expression, $arr))
                    Can someone please show me what this was changed from? For some reason I am not seeing what line this is in the newer code.
                    Unofficial Zabbix Developer

                    Comment

                    • Sarek
                      Junior Member
                      • Aug 2006
                      • 24

                      #25
                      Maybe my brain is in a fuzz from all the pain meds I'm taking but I can't find the original code/diff. I'll try again later. The server I had everything on doesn't have the source now. *sigh*

                      Originally posted by James Wells
                      Greetings,

                      I am currently looking into this with Zabbix 1.3 and will produce a full patch if / when I get it working. I do have one question though. Reading through the thread, I see;

                      Can someone please show me what this was changed from? For some reason I am not seeing what line this is in the newer code.

                      Comment

                      • araw
                        Member
                        • May 2005
                        • 31

                        #26
                        Patched to 1.1.2

                        Heyas

                        Following diff patches cleanly against 1.1.2 release.

                        http://cstubbs.a..../zabbix-1.1.2_external_items.diff

                        Thanks for keeping the patch alive while I've been away Mike.

                        Comment

                        • napel25
                          Junior Member
                          • Nov 2006
                          • 18

                          #27
                          The patch for 1.1.2 release compiles without problems on a 1.1.4 release. thnx

                          Comment

                          • napel25
                            Junior Member
                            • Nov 2006
                            • 18

                            #28
                            Items work fine with this patch, but I get an error when I try to create a trigger:

                            SQL error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '12311,'sh','0')' at line 1
                            Query: insert into functions (itemid,triggerid,function,parameter) values (,12311,'sh','0')

                            The expression is:
                            ({template_test:test.sh(0).last(0)})=1

                            Does anyone know a workaround or escape characters so that the parser will not get confused?

                            Comment

                            • sjackson909
                              Junior Member
                              • Dec 2006
                              • 2

                              #29
                              Is there a why Zabbix External cmd can pass the IP address and not the hostname? Other all this patch is going to fix all my problems.

                              Thanks
                              -Seth

                              Comment

                              • napel25
                                Junior Member
                                • Nov 2006
                                • 18

                                #30
                                I'm not sure what happens when you use a IP number in stead of the host name. But you call a local shell script with the external item type. In that script you can call the ip-number from the names server with the given host name.

                                It's probably possible...

                                Comment

                                Working...