Ad Widget

Collapse

action message beeing truncated under 1.1.5

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dsipe
    Senior Member
    • Oct 2006
    • 184

    #1

    action message beeing truncated under 1.1.5

    Hi,

    I've migrated my production server this week from 1.1.4 to 1.1.5.

    Macro {TRIGGER.NAME} is truncated !

    Help wanted..
  • krelac
    Junior Member
    • Oct 2006
    • 24

    #2
    same here !

    [cpe] is unreachable on 10.10.5.26: OFF
    [cpe] is unreachable on: OFF

    Comment

    • fips
      Member
      • Sep 2005
      • 38

      #3
      Me to! And {HOSTNAME} are not displayed either in the message!

      Comment

      • Palmertree
        Senior Member
        • Sep 2005
        • 746

        #4
        I am getting the same behaviour for Zabbix Version 1.1.5. The subject line is getting truncated and also the end of the message body is getting truncated for email alerts.

        Comment

        • Palmertree
          Senior Member
          • Sep 2005
          • 746

          #5
          I've tried different character lenghts for the subject and the message and it seems to cut off on the same character. In the subject heading it seems to cut off on a " - " dash with spaces around it and in the message body it seems to be "\\". Still can not figure it out. Must be in the zabbix_server code somewhere.

          Comment

          • Palmertree
            Senior Member
            • Sep 2005
            • 746

            #6
            I was able to fix the message part of the body being truncated by change a parameter in the actions.c code. I change the message_len variable from a +1 to a +20. This seems to temporarily fix my message body problem but not the subject line being truncated in email alerts.

            while((row=DBfetch(result)))
            {
            action.actionid=atoi(row[0]);

            if(check_action_conditions(trigger, alarmid, trigger_value, action.actionid) == SUCCEED)
            {
            zabbix_log( LOG_LEVEL_DEBUG, "Conditions match our trigger. Do apply actions.");
            action.userid=atoi(row[1]);

            strscpy(action.subject,row[2]);

            action.message_len = strlen(row[3]) * 3 / 2 + 20;
            action.message = zbx_malloc(action.message_len);

            strnscpy(action.message,row[3], action.message_len);

            action.recipient = atoi(row[4]);
            action.maxrepeats = atoi(row[5]);
            action.repeatdelay = atoi(row[6]);
            strscpy(action.scripts,row[7]);
            action.actiontype = atoi(row[8]);

            substitute_macros(alarmid, trigger, &action, action.message, action.message_len);
            substitute_macros(alarmid, trigger, &action, action.subject, sizeof(action.subject));

            if(action.actiontype == ACTION_TYPE_MESSAGE)
            send_to_user(trigger,&action);

            Comment

            • Palmertree
              Senior Member
              • Sep 2005
              • 746

              #7
              I found a temp fix that corrected the subject and message body cutoffs. To fix it on my end I modified the expressions.c as follows (changes are in red):

              time_t now;
              struct tm *tm;

              DB_RESULT result;
              DB_ROW row;

              zabbix_log(LOG_LEVEL_DEBUG, "In substitute_simple_macros [%s]",data);

              replace_to_len = strlen(data);
              replace_to = zbx_malloc(replace_to_len);

              outfill = 0;
              outlen = strlen(data) * 3 / 2 + 20;
              str_out = zbx_malloc(outlen + 1);
              *str_out= '\0';

              pl = data;
              while((pr = strchr(pl, '{')) && outfill < outlen)
              {
              pr[0] = '\0';
              outfill = zbx_strlcat(str_out, pl, outlen);
              pr[0] = '{';

              snprintf(replace_to, replace_to_len, "{");
              var_len = 1;

              if(macro_type & (MACRO_TYPE_MESSAGE_SUBJECT | MACRO_TYPE_MESSAGE_BODY) &&
              strncmp(pr, MVAR_TRIGGER_NAME, strlen(MVAR_TRIGGER_NAME)) == 0)
              {

              Comment

              • phork
                Member
                • Nov 2006
                • 38

                #8
                I have tried both of those changes (the +20 in actions.c and expression.c) and I'm still experiencing the same issue. Any ideas?

                Comment

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

                  #9
                  Try +16000 instead of +20. Proper fix will be tested and released soon.
                  Alexei Vladishev
                  Creator of Zabbix, Product manager
                  New York | Tokyo | Riga
                  My Twitter

                  Comment

                  • phork
                    Member
                    • Nov 2006
                    • 38

                    #10
                    Thanks for the quick response. Tried upping the number and no go. Am I missing something? These are the only 2 changes im making:
                    [root@mirage zabbix_server]# grep 16000 actions.c
                    action.message_len = strlen(row[3]) * 3 / 2 + 16000;
                    [root@mirage zabbix_server]# grep 16000 expression.c
                    outlen = strlen(data) * 3 / 2 + 16000;

                    Comment

                    • Palmertree
                      Senior Member
                      • Sep 2005
                      • 746

                      #11
                      Make sure you change the right line in the expressions.c file. I believe there are 2 places that look the same but only one line needs to be changed. You should only have to change one line that is on or about line 620 Also, I found that I only need to modifiy the value in expression.c file and not the action.c file. As a result, you should only have to make a modification in one place in the expresion.c file on line 620.

                      Alex,
                      Thanks for your suggesion. I will make the appropriate adjustments of +16000 in my expresssion.c file and I will test.
                      Last edited by Palmertree; 03-02-2007, 23:03.

                      Comment

                      • phork
                        Member
                        • Nov 2006
                        • 38

                        #12
                        I've actually changed it in every place just to make sure, still no dice:
                        [root@mirage zabbix_server]# grep -n "16000" *
                        actions.c:722: action.message_len = strlen(row[3]) * 3 / 2 + 16000;
                        expression.c:620: outlen = strlen(data) * 3 / 2 + 16000;
                        expression.c:1167: outlen = strlen(data) * 3 / 2 + 16000;

                        Message body is fine (though it's very short so I doubt it would clip it anyway), but the subject is still getting chopped off. Gotta be something else going on here.

                        Comment

                        • Palmertree
                          Senior Member
                          • Sep 2005
                          • 746

                          #13
                          I'm not sure what's going on. I only had to modify line 620 in expression.c and not the 2nd instance. It fixed both my subject and message body from being truncated. What do your alerts or actions look like?

                          Comment

                          • phork
                            Member
                            • Nov 2006
                            • 38

                            #14
                            I went back with a fresh install and ONLY changed line 620 of expression.c and the problem persists. For my action the subject of the email is simply "{TRIGGER.NAME}" and the body is "Severity: {TRIGGER.SEVERITY}."

                            An example is a Trigger name of "Connection DOWN on server-name" yet when I get the email the subject line reads "Connection DO" exactly.

                            Comment

                            • James Wells
                              Senior Member
                              • Jun 2005
                              • 664

                              #15
                              Have you guys tried the patch created by Quekky? Reading through the source, his/her patch appears to be the right way to fix it;
                              trancated emails in zabbix_server 1.1.5
                              Unofficial Zabbix Developer

                              Comment

                              Working...