Ad Widget

Collapse

Zabbix Telnet Script

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Zabbix Telnet Script

    Hello Guys

    I would like to ask for your guidance on creating custom script on zabbix

    I have already tried to do a custom script for telnet command on my zabbix server as shown in attached file.

    But when I tested it on my Maps, it show "cannot execute script" as shown below


    When I try to manually telnet the server, it show ok as shown


    Is there anything wrong on my telnet script?
    Last edited by PingPong93; 25-01-2018, 05:16.

    #2
    In the action, you can use the command to finish processing.

    By setting only the connection with the telnet command,
    telnet will be waiting for input without terminating processing.
    In other words, processing of the command does not end so it can not be used.

    What do you want to connect by telnet and execute?

    Comment


      #3
      Zabbix Telnet Script

      Originally posted by Atsushi View Post
      In the action, you can use the command to finish processing.

      By setting only the connection with the telnet command,
      telnet will be waiting for input without terminating processing.
      In other words, processing of the command does not end so it can not be used.

      What do you want to connect by telnet and execute?

      Thanks Atsushi

      I have use remote command on my action, but I insist to do global script that can run on maps.

      Any suggestions? I would like to telnet my zabbix servers and execute the result.

      Comment


        #4
        If you want to execute a command using telnet, it would be a good idea to write a script to do that.
        Since interactive response processing is required when connecting via telnet, there is a method of using the expect command.

        If it is a UNIX like OS, you can execute the command with the following script.

        Code:
        #!/bin/sh
        host_ip="192.168.1.1"
        login_user="user1"
        login_pass="password"
        exec_command="ls"
        
        expect -c "
                set timeout 5
                spawn telnet ${host_ip}
                expect -nocase \"login:\"
                send \"${login_user}\n\"
                expect -nocase \"Password:\"
                send \"${login_pass}\n\"
                expect \"$ \"
                send \"${exec_command}\n\"
                expect \"$ \"
                send \"exit\n\"
        "
        Please customize it according to what you want to do.

        Comment

        Announcement

        Collapse
        No announcement yet.
        Working...
        X