Ad Widget

Collapse

can not add trigger / zabbix 1.8.3

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dakol
    Member
    • Jan 2008
    • 50

    #1

    can not add trigger / zabbix 1.8.3

    Trigger expression:
    {Template_test-JMS:zapcat[{$DOMAIN}, jmx[com.sun.messaging.jms.server:type=ConsumerManager, subtype=Monitor][NumConsumers]].avg(300)}<1

    Error message:
    Unnecessary symbols detected: Check expression part starting from ' ].avg(300)}<1 '
    Host key does not exist. Check expression part starting from ' :zapcat[{$DOMAIN}, jmx[com.sun.messaging.jms.server:type=ConsumerManager, subtype=Monitor][NumConsumers]].avg(300)}<1 '

    any idea ?
  • mlange
    Member
    • Sep 2008
    • 78

    #2
    I am getting:
    Host key does not exist. Check expression part starting from ' :jmx[com.foo:Type=Statistic,Service=sample-service][average_call_duration].last(0)}>60000 '

    Comment

    • richlv
      Senior Member
      Zabbix Certified Trainer
      Zabbix Certified SpecialistZabbix Certified Professional
      • Oct 2005
      • 3112

      #3
      it's a problem with zapcat template - colons are not allowed in item keys

      Zabbix 3.0 Network Monitoring book

      Comment

      • mlange
        Member
        • Sep 2008
        • 78

        #4
        Any workarounds for this besides escaping with question marks? Don't catch why they changed the parsing in 1.8.3 - we are almost only using JMX items.

        Comment

        • slash5k1
          Junior Member
          • Sep 2008
          • 11

          #5
          zapcat patch to work with zabbix 1.8.3+

          Hi guys,

          Our company was hit with this as well so i had one of our devs review zapcat and fix the QueryHandler code to support the valid zabbix syntax.

          old item syntax:
          jmx[java.lang:type=MemoryPool,name=CMS Old Gen][Usage.committed]

          new item syntax:
          jmx["java.lang:type=MemoryPool,name=CMS Old Gen",Usage.committed]

          first parameter is used to define the path of the bean attribute you wish to query (needs to be enclosed with quotes)
          second parameter is the bean attribute you want to return the value of

          once you use the new syntax, triggers can be defined again

          *note
          he has removed jmx_op and trap functionality since we dont use it... hopefully some smart cookie can take this example and fix it properly upstream to support all functionality with the proper syntax

          Cheers

          Chris Anders
          Attached Files

          Comment

          • richlv
            Senior Member
            Zabbix Certified Trainer
            Zabbix Certified SpecialistZabbix Certified Professional
            • Oct 2005
            • 3112

            #6
            fixing this in zapcat is definitely the desired long term solution.

            as a short term workaround, there's a zapcat compatibility flag introduced - see ZAPCAT_COMPATIBILITY in http://www.zabbix.com/documentation/...config/defines
            Zabbix 3.0 Network Monitoring book

            Comment

            • xibbaz
              Member
              Zabbix Certified Specialist
              • Jun 2009
              • 74

              #7
              The ZAPCAT_COMPATIBILITY works only from 1.8.4 and I'm using 1.8.3.

              Code:
              {Template_HP_LJ_Toner_Level:prtMarkerSuppliesLevel.1.1.last(0)/Template_HP_LJ_Toner_Level:prtMarkerSuppliesMaxCapacity.1.1.last(0)}<0.05
              Unnecessary symbols detected: Check expression part starting from ' /Template_HP_LJ_Toner_LevelrtMarkerSuppliesMaxCapacity.1.1.last(0)}<0.05 '
              Apart upgrading Zabbix, isn't there any workaround?

              Comment

              • gabrielmoreira
                Junior Member
                • Mar 2011
                • 1

                #8
                Originally posted by slash5k1
                Hi guys,

                Our company was hit with this as well so i had one of our devs review zapcat and fix the QueryHandler code to support the valid zabbix syntax.

                old item syntax:
                jmx[java.lang:type=MemoryPool,name=CMS Old Gen][Usage.committed]

                new item syntax:
                jmx["java.lang:type=MemoryPool,name=CMS Old Gen",Usage.committed]

                first parameter is used to define the path of the bean attribute you wish to query (needs to be enclosed with quotes)
                second parameter is the bean attribute you want to return the value of

                once you use the new syntax, triggers can be defined again

                *note
                he has removed jmx_op and trap functionality since we dont use it... hopefully some smart cookie can take this example and fix it properly upstream to support all functionality with the proper syntax

                Cheers

                Chris Anders


                We changed to:
                Code:
                	private static final Pattern OLD_PATTERN = Pattern.compile("^([^\\[\n]+)(\\[([^\\]]*)\\])?(\\[([^\\]]*)\\])?$");
                	private static final Pattern NEW_PATTERN = Pattern.compile("^([^\\[\n]+)(\\[\"([^\"]*)\"(,\"([^\"]*)\")?\\])?$");
                
                	private String[] parseQuery(final String query) throws Exception {
                		Pattern queryFormatPattern = query.contains("\"") ? NEW_PATTERN : OLD_PATTERN;
                		Matcher matcher = queryFormatPattern.matcher(query);
                		if (matcher.find()) {
                			String command = matcher.group(1);
                			String object = matcher.group(3);
                			String attribute = matcher.group(5);
                			if (command == null) {
                				return null;
                			}
                			if (object == null) {
                				return new String[] { command };
                			}
                			if (attribute == null) {
                				return new String[] { command, object };
                			}
                			return new String[] { command, object, attribute };
                		}
                		return null;
                	}
                
                	private String response(final String query) throws Exception {
                		String[] queryParams = parseQuery(query);
                		if (queryParams != null && queryParams.length != 0) {
                			String first = queryParams[0];
                			if (first.equals("jmx") && queryParams.length == 3) {
                				try {
                					return JMXHelper.query(queryParams[1], queryParams[2]);
                				} catch (InstanceNotFoundException e) {
                					log.debug("no bean named " + queryParams[1], e);
                					return NOTSUPPORTED;
                				} catch (AttributeNotFoundException e) {
                					log.debug("no attribute named " + queryParams[1] + " on bean named " + queryParams[2], e);
                					return NOTSUPPORTED;
                				}
                			} else if (first.equals("system.property") && queryParams.length == 2) {
                				return querySystemProperty(queryParams[1]);
                			} else if (first.equals("system.env") && queryParams.length == 2) {
                				return queryEnvironment(queryParams[1]);
                			} else if (first.equals("agent.ping")) {
                				return "1";
                			} else if (first.equals("agent.version")) {
                				return "zapcat 1.2";
                			}
                		}
                		return NOTSUPPORTED;
                	}

                Comment

                Working...