Ad Widget


"SSH Connect" in Dashboard context menu - HOWTO

  • Filter
  • Time
  • Show
Clear All
new posts

    "SSH Connect" in Dashboard context menu - HOWTO

    Hi all,

    I want to tell you how to connect to hosts over SSH using context menu in Zabbix dashboard page.
    I really missed this feature so I made it single-handedly.

    As you know, scripts are executed on server side, there's no way to run "putty" on your PC that way.

    I used SSH java applet "MindTerm" which I installed on Zabbix PHP front-end server, here is download link:

    Download this applet and unpack to directory on server where is your Zabbix PHP front-end located.
    In my example it is /var/www/html/zabbix/mindterm

    After downloading and extracting, you must sign your applet with certificate.
    Proper tools are provided with Java JDK package.

    Here's the procedure:

    Generate key:
    keytool -genkey -keyalg rsa -alias testkey
    Export key:
    keytool -export -alias testkey -file testcert.crt
    Check JAR file:
    jar tvf mindterm.jar
    Sign JAR file:
    jarsigner mindterm.jar testkey
    Verify sign:
    jarsigner -verify -verbose -certs mindterm.jar
    So, we have signed SSH applet.
    How to use it?

    First, create a script in Zabix Administration panel.
    The script doesn't need to do anything, you may use command that does nothing,
    eg.: /bin/echo "Hello world!" > /dev/null

    In my example I created (for testing) a little bash script that does nothing:

    And the script itself (/home/zabbix/bin/test):

    exit 0

    We need the Zabbix "scriptid", you can find it in your browser status bar when you hover your script name on the list.

    It looks like this. My sriptid=6, as you can see:

    Then we need to modify Zabbix page "scripts_exec.php" in main directory of Zabbix PHP front-end.

    The concept:
    I want to run java applet in result message window, when I click "SSH Connect" in dashboard context menu, with specified destination host IP passed by applet parameter, without typing IP by hand.
    So we need to know IP of chosen host, and our scriptid.

    The modified file "scripts_exec.php" is attached to this post.
    You can replace this file (backup the old one first), changing scriptid and path to applet .jar file only.
    That's all.

    How it works?

    Do you like it?

    Final words:
    Remember, although applet is located on server, it runs on your desktop, so you need access to hosts you want connect to.
    I always need to connect to my VPN server when I'm out of office before I use this tool to connect to servers inside my company network.
    Of course your browser must support JAVA.

    If you want to use this feature in IE, you will need "" file,
    which is NOT included in MindTerm applet archive.
    But it's easy to find it with google, just up to 5 min. searching.

    In the same way you can add more features, eg. "VNC view" using this applet:

    Any comments welcomed.
    Environment used in this example: Zabbix 1.6.4 on Linux server

    Have fun!

    PS. This is my first post here. Sorry 4 my bad english. Zabbix is great!
    Attached Files
    Last edited by skygge; 18-06-2009, 12:31.

    Wow ! Excellent !

    I hope that this kind of functionality will be included in a future version of Zabbix.



      Thanks for the excellent HOWTO! Well done.
      Alexei Vladishev
      Creator of Zabbix, Product manager
      New York | Tokyo | Riga
      My Twitter


        Open source applet


        mindterm applet is not open source.
        Does anybody know an SSH or a remote desktop client applet whose licencing is compatible with GPL ?



          Originally posted by skygge View Post
          Remember, although applet is located on server, it runs on your desktop, so you need access to hosts you want connect to.
          It is possible to tunnel with SSH, so Zabbix server could make a connection to host, and client could make a connection to the Zabbix server.
          ssh client ---> Zabbix server ---> hostB
          An alternative - when logging in with SSH, it is possible to specify a command to execute. So the client could log into the Zabbix server and specify a command of ' hostB'. would be a script created by Zabbix, containing the necessary details to get onto hostB without further intervention from the user.

          This isn't limited to SSH of course. The Zabbix server could presumably tunnel anything, turning Zabbix into a remote management gateway.


            But it's not so secure, isn't it?

            Edit: BTW, I was looking for an GPL applet lately, but I found nothing interesting...
            Last edited by skygge; 22-06-2009, 16:20.


              Which 'it' are you talking about?



                It looks very nice but I have a problem with the new scripts_exec.php.

                When I put it, all my scripts work but I have an error message.

                Any ideas ?




                  at first, thanks for the great job.

                  But on my side it won't work. I got two errors :

                  When i try to open an connection via ssh to the Server. I get following error in the server log.

                  [Fri Jun 26 10:09:48 2009] [error] [client] File does not exist: /var/www/zabbix/com.mindbright.application.MindTerm.class, referer:
                  [Fri Jun 26 10:10:11 2009] [error] [client] File does not exist: /var/www/zabbix/com.mindbright.application.MindTerm.class, referer:

                  And the secound is the same error like koska.

                  i use the last Version 1.6.5

                  cu Mario


                    hmmm... hard for me to say what is wrong, I got it working with no errors... maybe you (both) can attach your scripts_exec.php so I could see the code and check it? Your scriptid is really 200200000000003? It's a quite big number...

                    Another, "file does not exists" mean that script couldn't find applet file, do you correctly replace the path to mindterm.jar in scripts_exec.php?


                    ps. I upgraded my Zabbix server to 1.6.5 and it's working still without any changes.
                    Last edited by skygge; 26-06-2009, 13:50.


                      HI skygge,

                      the big scriptid cames from the distributed Monitoring. We got ther an Master Zabbix, und an Satellit.

                      And i think that the path is correct. But ...

                      I have attached the file.


                      Attached Files


                        And what about attributes? Make sure that directory and files of mindterm applet are accessible by user httpd. What is in Apache error.log?
                        Last edited by skygge; 26-06-2009, 14:15.



                          Everything is working now, at the first time i used your script, but now i modified my own script and it's all right !

                          I put my php file if you want to have a look.

                          Very good job !

                          See ya
                          Attached Files
                          Last edited by koska; 26-06-2009, 14:50.


                            The Apache tells me the same like Zabbix_server :

                            [Fri Jun 26 14:54:52 2009] [error] [client] File does not exist: /var/www/zabbix/com.mindbright.application.MindTerm.class, referer:

                            And when i try to execute the mindterm.jar i got followin :

                            reamon2-vm:/var/www/zabbix# java /var/www/zabbix/mindterm/mindterm.jar
                            Exception in thread "main" java.lang.NoClassDefFoundError: /var/www/zabbix/mindterm/mindterm/jar
                            Caused by: java.lang.ClassNotFoundException: .var.www.zabbix.mindterm.mindterm.jar
                            at$ 217)
                            at Method)
                            at ava:205)
                            at java.lang.ClassLoader.loadClass( 23)
                            at sun.misc.Launcher$AppClassLoader.loadClass(Launche
                            at java.lang.ClassLoader.loadClass( 68)
                            at java.lang.ClassLoader.loadClassInternal(ClassLoade
                            Could not find the main class: /var/www/zabbix/mindterm/mindterm.jar. Program will exit.

                            I hope you can help me. This feature is cool.


                              There is something wrong with the path to your mindterm.jar. Maybe you can try change path to relative to scripts_exec.php instead absolute?

                              I did an experiment. I executed the command:
                              java /var/www/zabbix/mindterm/mindterm.jar
                              but with no mindterm.jar on this path and got error exactly the same as yours.

                              Go to the directory where is your applet on the server and type
                              Then give us the output.
                              Last edited by skygge; 26-06-2009, 20:22.



                              No announcement yet.