Ad Widget

Collapse

Change separator for UserParameter

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bast
    Junior Member
    • Sep 2008
    • 11

    #1

    Change separator for UserParameter

    I want to send a key with parameters witch contains comma or space (JMX MBean for Tomcat), but these caracters are deleted by zabbix agent.
    The use of " or ' not resolve the problem.
    Can I do something like this :
    Key : seb.test[Catalina:j2eeType=Servlet,name=admin.service.servi ce_jsp,WebModule=//localhost/admin,J2EEApplication=none,J2EEServer=none#process ingTime],separator=#
    UserParameter=seb.test[*],/my/script.pl $1 $2

    The zabbix agent use the separator parameter to distinct parameters ($1 and $2).
  • Alexei
    Founder, CEO
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Sep 2004
    • 5654

    #2
    You may use quotes:

    key["param1","param2"]
    Alexei Vladishev
    Creator of Zabbix, Product manager
    New York | Tokyo | Riga
    My Twitter

    Comment

    • bast
      Junior Member
      • Sep 2008
      • 11

      #3
      It is not correct.
      My zabbix agent configuration :
      UserParameter=seb.test[*],sudo /opt/zabbix/scripts/test.sh $1 $2 $3

      This is the logs (zabbix-agent 1.1.4-10etch1 on Debian Etch) :
      024142:20080919:113210 Connection from [a.b.c.d]. Allowed servers [S1,S2]
      024142:20080919:113210 Before read()
      024142:20080919:113210 After read() 2 [49]
      024142:20080919:113210 Got line:seb.test["name=nom,type=TYPE","param2","param3"]
      024142:20080919:113210 Run remote command [sudo /opt/zabbix/scripts/test.sh "name=nom type=TYPE" "param2"] Result [67] [ ....]

      The comma is deleted and the $3 parameter is not transmit.

      Comment

      • nelsonab
        Senior Member
        Zabbix Certified SpecialistZabbix Certified Professional
        • Sep 2006
        • 1233

        #4
        I have come across this too. There needs to be a way to "escape" the comma character. It is a narrow use case and one that can be worked around with the use of a wrapper to the main script, but that's a royal pain.

        Also there needs to be a way to extend the environment for sub processes. If the command line for the sub-process aka script is too long it will be truncated. I have mentioned this before and I think even submitted a bug for it.
        RHCE, author of zbxapi
        Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
        Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

        Comment

        • nelsonab
          Senior Member
          Zabbix Certified SpecialistZabbix Certified Professional
          • Sep 2006
          • 1233

          #5
          Can we bump up the priority?

          Actually I reported this from the perspective of remote commands on July 18 as ZBX-403.
          RHCE, author of zbxapi
          Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
          Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

          Comment

          • Alexei
            Founder, CEO
            Zabbix Certified Trainer
            Zabbix Certified SpecialistZabbix Certified Professional
            • Sep 2004
            • 5654

            #6
            For some reason I was pretty sure it is no longer the case in 1.6. It seem the problem still exists. To be fixed!
            Alexei Vladishev
            Creator of Zabbix, Product manager
            New York | Tokyo | Riga
            My Twitter

            Comment

            • Kees Jan Koster
              Member
              • Oct 2007
              • 83

              #7
              Originally posted by bast
              I want to send a key with parameters witch contains comma or space (JMX MBean for Tomcat), but these caracters are deleted by zabbix agent.
              The use of " or ' not resolve the problem.
              Can I do something like this :
              Key : seb.test[Catalina:j2eeType=Servlet,name=admin.service.servi ce_jsp,WebModule=//localhost/admin,J2EEApplication=none,J2EEServer=none#process ingTime],separator=#
              UserParameter=seb.test[*],/my/script.pl $1 $2

              The zabbix agent use the separator parameter to distinct parameters ($1 and $2).
              Uhm. Have you considered using Zapcat? http://kjkoster.org/zapcat It solves this for you, and includes some nice templates to boot. Plus, it runs in the JVM and has much lower run-time impact than perl (no offense).

              Comment

              • bast
                Junior Member
                • Sep 2008
                • 11

                #8
                Yes,
                It is a great solution. But the problem is that the zapcat webapp must be a host, so when I have several tomcat instances, I must have several hosts for one physical server.

                Comment

                • Kees Jan Koster
                  Member
                  • Oct 2007
                  • 83

                  #9
                  Dear bast,

                  Yeah, I thought about that too. The way I see it, a JVM is just that, a virtual machine. Thus, it shows up as a machine in Zabbix. Compare it to the host/client relation of VMWare machines.

                  There are all sorts of nasty issues that come up when you have more than one JVM on an actual host and you pretend they are 'part of' a host.

                  Kees Jan

                  Comment

                  • bast
                    Junior Member
                    • Sep 2008
                    • 11

                    #10
                    My solution use a little perl script and Tomcat /manager/jmxproxy.

                    I have made 2 templates :
                    • one who deal with Java (cpu, memory, gc, threads, ...)
                    • one who deal with Tomcat (http/ajp connectors, sessions, ...)


                    I can send you the script and the templates if you want.

                    Comment

                    • Kees Jan Koster
                      Member
                      • Oct 2007
                      • 83

                      #11
                      Dear Bast,

                      Yes, please. I am interested in your templates. Please mail them to [email protected].

                      Thanks.

                      Kees Jan

                      Comment

                      • Kees Jan Koster
                        Member
                        • Oct 2007
                        • 83

                        #12
                        Dear Bast,

                        I almost forgot: if you use Tomcat manager, please read this warning. :-)

                        Kees Jan

                        Comment

                        • Sasha
                          Zabbix developer
                          • Sep 2007
                          • 60

                          #13
                          UserParameter

                          Thank you!
                          The problem is fixed in version 1.6.x rev. 6169.
                          ZABBIX Developer
                          Riga, Latvia

                          Comment

                          • bast
                            Junior Member
                            • Sep 2008
                            • 11

                            #14
                            Thanks sacha !!
                            For the previous port from Kees Jan Poster :
                            Users can't access Tomcat Manager : it is behind a reverse proxy, and I use a firewall, and the RemoteAddrValve. I am working on Hibernate. I send you my results as soon as possible.
                            Have a nice day.

                            Comment

                            • nelsonab
                              Senior Member
                              Zabbix Certified SpecialistZabbix Certified Professional
                              • Sep 2006
                              • 1233

                              #15
                              Originally posted by Sasha
                              Thank you!
                              The problem is fixed in version 1.6.x rev. 6169.
                              I saw the ticket closed email, but how has the problem been resolved? Do we use a "\" character or is there another character we use to escape the "," character? Or do we even need to escape it at all?
                              RHCE, author of zbxapi
                              Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
                              Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

                              Comment

                              Working...