0

Zabbix: increase the maximum length of the graph name

It often happens that the name of a graph in Zabbix is ​​more than 20 characters allowed and the system truncates it.

But this limitation can be changed. To do this, you need to make changes to the interface by editing the following file: /usr/share/zabbix/include/items.inc.php

Find the following code block:

// apply value mapping
    switch ($item['value_type']) {
            case ITEM_VALUE_TYPE_STR:
                    $mapping = getMappedValue($value, $item['valuemapid']);
            // break; is not missing here
            case ITEM_VALUE_TYPE_TEXT:
            case ITEM_VALUE_TYPE_LOG:
                    if ($trim && mb_strlen($value) > 20) {
                            $value = mb_substr($value, 0, 20).'...';
                    }
 
                    if ($mapping !== false) {
                            $value = $mapping.' ('.$value.')';
                    }
                    break;
            default:
                    $value = applyValueMap($value, $item['valuemapid']);
    }
 
    return $value;

We are interested in the following lines: if ($ trim && mb_strlen ($ value)> 20) and $ value = mb_substr ($ value, 0, 20). ‘…’. The first line checks the condition that the number of characters in the name of the graph is more than 20, and if it is satisfied, the second one truncates it to 20 characters.

Replace the values ​​20 with the ones you need, for example 40, this is quite enough. The disadvantage of this method is that when updating zabbix it replaces files with new ones and this procedure will have to be repeated again.