Ad Widget

Collapse

External scripts

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Padawan.AVT
    Junior Member
    • May 2009
    • 26

    #1

    External scripts

    Hi everyone!

    I have a question regarding external checks:

    I have a script with string of parameters:
    Code:
    ./check_GA.sh testuser pass123 MYHOST
    When I'm adding it to Zabbix as below:

    check_GA.sh[testuser pass123 MYHOST]

    It doesn't return anything, but when I put the same in other script

    Code:
    less ./check_crmdocs_GA.sh
    #!/bin/bash
    
    cd /data/pandora/local/zabbix_scripts/externalscripts/ && ./check_GA.sh testuser pass123 MYHOST
    and put it in Zabbix as

    check_crmdocs_GA.sh[]

    all work as it should. How can I make check_GA.sh[testuser pass123 MYHOST] work instead of using a bunch of unnecessary scripts?
    Last edited by Padawan.AVT; 25-05-2009, 16:02.
  • Calimero
    Senior Member
    • Nov 2006
    • 481

    #2
    Did you set the "ExternalScripts" parameter in zabbix_server.conf ?

    By the way, as far as I remember $1 is the host IP or DNS name.

    Comment

    • Padawan.AVT
      Junior Member
      • May 2009
      • 26

      #3
      Yes,
      ExternalScripts=/data/pandora/local/zabbix_scripts/externalscripts

      You didn't get the problem: my external scripts work in Zabbix when they have no command-line parameters. If they have one they fail.
      When I run them with parameters from command line all ok. Environmental variables and all stuff is set correctly.
      If I put my script with parameters into another script without parameters, Zabbix processes it correctly.

      In Bash (on which my scriptsa are written) $1 stands for the first argument in command line.

      Comment

      • Silvery
        Junior Member
        Zabbix Certified Specialist
        • Oct 2008
        • 28

        #4
        But in Zabbix the $1 is reserved for the Host.
        That means "testuser" is $2 in your example.

        Comment

        • Padawan.AVT
          Junior Member
          • May 2009
          • 26

          #5
          Ah, that was the point
          And my script did a check to accept only 3 parameters.

          Thanks!

          Comment

          Working...