Ad Widget

Collapse

Sanity check

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mbrijun
    Member
    • Mar 2006
    • 63

    #1

    Sanity check

    Hello zabbix gurus,

    I have noticed that some of my hosts have applications listed from the templates that are not linked to them. This is probably due to me not following the unlinking procedures correctly in the past.

    I have been poking around the mysql tables for a while, but so far have been unable to devise a query that would show me the extend of the inconsistencies.

    Anyone has such a query?

    Thank you.
  • mbrijun
    Member
    • Mar 2006
    • 63

    #2
    Hi,

    this is the query that I devised for determining how many templated and non-templated items each host has. The difference between the 2 columns indicates that the host has some host-specific items.

    Now, just need to do the same for the applications.

    select
    ht.hostid,
    (select a.host from zabbix.hosts a where a.hostid = ht.hostid) as hostname,
    count(i.itemid) as number_of_templated_items,
    (select count(b.itemid) from zabbix.items b where b.hostid = ht.hostid) as number_of_all_items
    from
    zabbix.hosts_templates ht,
    zabbix.hosts h,
    zabbix.items i
    where
    ht.templateid = h.hostid and
    h.hostid = i.hostid
    group by
    ht.hostid
    order by
    hostname;

    Comment

    Working...