Cacti favicon

From Strugglers
Jump to: navigation, search
Example of the Cacti favicon

Cacti is a network graphing package based on RRDTool.

Problem

Cacti's very pretty, but it lacks a Favicon. I often lose my Cacti windows amongst the myriad other tabs in my Firefox.

Uploading a favicon would be simple enough but that only makes sense if the virtual host is used only for Cacti. If you are in that position then you can just copy the icon to the root of your Cacti virtual host and name it favicon.ico, and stop reading now.

Solution

Following some instructions found on the Cacti forums it is possible to install a favicon even when Cacti does not run from the web root. You need to upload the icon and slightly edit 5 of Cacti's PHP files.

Get the icon

Copy the icon to your Cacti images directory (/usr/share/cacti/images/ on Debian sarge).

Modify Cacti files to serve the image

The following files need to be modified. The paths are relative to the base of the Cacti installation (/usr/share/cacti/ on Debian sarge).

auth_login.php

Around line 97, just underneath the line with the <title> tag:

        <link href="images/cacti_favicon.ico" rel="image/x-icon" />
        <link rel="shortcut icon" href="images/cacti_favicon.ico" type="image/x-icon" />

include/auth.php

include/top_graph_header.php

include/top_header.php

In each file there is one line that reads:

<link href="include/main.css" rel="stylesheet">

Add:

<link href="images/cacti_favicon.ico" rel="image/x-icon" />
<link rel="shortcut icon" href="images/cacti_favicon.ico" type="image/x-icon" />

Below it in each file.

lib/graph_export.php

Around line 275 you should see:

copy("$cacti_root_path/images/shadow.gif", "$cacti_export_path/shadow.gif");

Add:

copy("$cacti_root_path/images/cacti_favicon.ico", "$cacti_export_path/cacti_favicon.ico");

below it.

Around line 410 you should see:

<link href='main.css' rel='stylesheet' />

Add:

<link href='cacti_favicon.ico' rel='image/x-icon' />
<link rel='shortcut icon' href='cacti_favicon.ico' type='image/x-icon' />

below it.

Notes

Don't forget you'll have to do this again anytime Cacti is upgraded! Hopefully me or someone else will find time to send a patch upstream.