Ad Widget

Collapse

Message line truncated to 255 chars in email

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • novakm
    Member
    • Apr 2009
    • 38

    #1

    Message line truncated to 255 chars in email

    Hi everyone!
    I have just encountered an annoying issue with sending email with long lines.

    I am using zabbix_sender to notify zabbix of some events from Cisco devices logs. Zabbix receives the message correctly - I see following line in Latest Data -> History -> As plain text:

    TRAP: Jul 22 07:01:57 192.168.200.1 941: Jul 22 07:01:56.601 MET-DST: %DHCP_SNOOPING-5-DHCP_SNOOPING_MATCH_MAC_FAIL: DHCP_SNOOPING drop message because the chaddr doesn't match source mac, message type: DHCPDISCOVER, chaddr: e16c.d6ae.5290, MAC sa: 001e.ec1f.f462

    This triggers an action that sends email, but I receive only this:

    TRAP: Jul 22 07:01:57 192.168.200.1 941: Jul 22 07:01:56.601 MET-DST: %DHCP_SNOOPING-5-DHCP_SNOOPING_MATCH_MAC_FAIL: DHCP_SNOOPING drop message because the chaddr doesn't match source mac, message type: DHCPDISCOVER, chaddr: e16c.d6ae.5290, MAC sa: 001e.e

    It is 255 characters so I presume there is some limitation for one line when sending an email...

    The item that collects these logs is of type Zabbix trapper and has Log as Type of information. I tried to change it to Text, but then nothing is received when I used zabbix_sender.

    I am using Zabbix 1.8.2. Is there any solution to receive more than 255 characters?

    Thanks for any hints.

    Martin

    PS. Originally I placed this post into wrong forum part (http://www.zabbix.com/forum/showthread.php?t=18457). I couldn't find a way how to move it there, therefor I made this one, sorry for this.
  • Palmertree
    Senior Member
    • Sep 2005
    • 746

    #2
    We have the same issue. Our traps are longer than 255 chars and are truncated when displaying them with last function.

    Comment

    • novakm
      Member
      • Apr 2009
      • 38

      #3
      Thanks for reply.

      I guess the function last() is to blame then. I looked into manual but haven't found any other possibility to obtain data for action.

      I suppose there is no "easy" way to get more than 255 characters from item last values and it would require change of code to fix this?

      Comment

      • Bennie
        Member
        Zabbix Certified Specialist
        • Feb 2010
        • 73

        #4
        meh, posted in the other topic

        I didn't check it but 255 chars looks like a database table limitation.

        Comment

        • novakm
          Member
          • Apr 2009
          • 38

          #5
          With all respect I don't think this is the case as it is displayed correctly if you look at it in latest data -> History -> as plain text
          (as I described in the original post

          Comment

          • zalex_ua
            Senior Member
            Zabbix Certified Trainer
            Zabbix Certified SpecialistZabbix Certified Professional
            • Oct 2009
            • 1286

            #6
            novakm, please post Item key and it settings, trigger expression, action subject and message settings.
            I can not reproduce you problem, i receive more that 255 characters in mail.
            In DB exist one place limited for 255 char - column 'lastvalue' in the table 'items'.
            It used for Overview and Latest data pages.

            Comment

            • novakm
              Member
              • Apr 2009
              • 38

              #7
              Hello,
              thanks for your response. Here is requested information

              ITEM
              Description: snmptraps
              Type: Zabbix trapper
              Key: snmptraps
              Type of information: Log

              TRIGGER
              Expression: ({snmptrapper:snmptraps.str(TRAP)}=1)&({snmptrappe r:snmptraps.nodata(30)}=0)

              (my script takes the message and inserts string "TRAP: " in the beginning, I could not think of any other way to trigger it)

              ACTION
              Operation type: Send message
              Subject:
              {STATUS}:{HOSTNAME}:{TRIGGER.NAME}
              Message:
              {HOSTNAME} : {IPADDRESS}
              {TRIGGER.NAME}: {STATUS}
              {DATE} {TIME}
              Trigger key: {TRIGGER.KEY}
              Value: {{HOSTNAME}:{TRIGGER.KEY}.last(0)}
              Host: {HOSTNAME}

              From various comments I believe the part .last(0) is to blame, it probably takes the value from the 'lastvalue' column.

              But I know it is in the DB somewhere because if you let it display as plain text you can see the whole message. The question is whether it is possible to get to last untruncated value and send it in email somehow.

              Comment

              • zalex_ua
                Senior Member
                Zabbix Certified Trainer
                Zabbix Certified SpecialistZabbix Certified Professional
                • Oct 2009
                • 1286

                #8
                Originally posted by novakm
                Hello,
                Value: {{HOSTNAME}:{TRIGGER.KEY}.last(0)}
                Yes, this function truncate data to 255 char.

                Try macro {ITEM.LASTVALUE} instead of function {{HOSTNAME}:{TRIGGER.KEY}.last(0)}
                http://www.zabbix.com/documentation/.../config/macros
                This macro not truncate data to 255 char !!!

                Comment

                • novakm
                  Member
                  • Apr 2009
                  • 38

                  #9
                  Problem solved, thanks!

                  The documentation should be changed probably as it says
                  "The latest value of the Nth item of the trigger expression which caused a notification. Supported from Zabbix 1.4.3. It is alias to {{HOSTNAME}:{TRIGGER.KEY}.last(0)}"

                  Which clearly is not true as the {{HOSTNAME}:{TRIGGER.KEY}.last(0)} truncates the line to 255 chars and {ITEM.LASTVALUE} does not.

                  Nevertheless, it works

                  Comment

                  Working...