Search code examples
zabbix

Where does Zabbix store the Dashboard's Favorite objects (maps, screens and graphs)?


I've looked at the database schema, but found nothing related. I've looked at the PHP code for the dashboard page at /usr/share/zabbix/dashboard.php, but they use some code I can't quite grasp.

For example:

CFavorite::add('web.favorite.screenids', $id, $favouriteObject)

So, I understand it has to somewhere link that to each user profile. Here are the columns for the profile table, but I can't see where else in the database this information would be kept.

mysql> describe profiles;
+-----------+---------------------+------+-----+---------+-------+
| Field     | Type                | Null | Key | Default | Extra |
+-----------+---------------------+------+-----+---------+-------+
| profileid | bigint(20) unsigned | NO   | PRI | NULL    |       |
| userid    | bigint(20) unsigned | NO   | MUL | NULL    |       |
| idx       | varchar(96)         | NO   |     |         |       |
| idx2      | bigint(20) unsigned | NO   |     | 0       |       |
| value_id  | bigint(20) unsigned | NO   |     | 0       |       |
| value_int | int(11)             | NO   |     | 0       |       |
| value_str | varchar(255)        | NO   |     |         |       |
| source    | varchar(96)         | NO   |     |         |       |
| type      | int(11)             | NO   |     | 0       |       |
+-----------+---------------------+------+-----+---------+-------+

Solution

  • You've identified the correct table. There was partial documentation about this table at https://zabbix.org/wiki/Docs/DB_schema/3.4/profiles , I added more detail just now.

    An example of the meaningful fields when a screen favourite entry is stored:

    MariaDB [zabbix]> select userid,idx,value_id,source,type from profiles
        -> where idx like 'web.favorite.screenids';
    +--------+------------------------+----------+----------+------+
    | userid | idx                    | value_id | source   | type |
    +--------+------------------------+----------+----------+------+
    |     45 | web.favorite.screenids |       16 | screenid |    1 |
    +--------+------------------------+----------+----------+------+