Dec 172015
 

Our Cacti installation was not showing our complete “data source” title length under the “Graph Management” menu. But instead trimmed the title with three dots at the end (…) . Which made it impossible to select the right datasource to use.

cacit-title-length

This is not a value you can change in the GUI. If you want to change this you need to dive into the PHP code instead. Let’s just do that.

function title_trim($text, $max_length) {
        if (strlen($text) > $max_length) {
                return substr($text, 0, $max_length) . "...";
        }else{
                return $text;

The title is trimmed down if it’s longer then the $max_length value. Lazy as I’m I dind’t want to count the amount of characters. Instead i changed it to:
return substr($text, 0, $max_length) . ".$max_length.";
And the max_length in this case was 75. :)

When I grepped through the files in the Cacti dir’s in search of this ’75’ value i found:

lib/html.php: print ">" . title_trim(null_out_substitutions(htmlspecialchars($form_data[$id])), 75) . "\n";
lib/html.php: print ">" . title_trim(htmlspecialchars($row[$column_display]), 75) . "\n";
lib/html.php: print ">" . title_trim(null_out_substitutions(htmlspecialchars($row[$column_display])), 75) . "\n";

Bingo! We changed them to ‘100’ and where good to go.

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Anti-spam image