NetXMS Support Forum

English Support => General Support => Topic started by: reez_q11 on February 21, 2018, 10:36:37 AM

Title: mysql query for object status (with grafana)
Post by: reez_q11 on February 21, 2018, 10:36:37 AM
hi,

i'm testing querying object status on database (mysql) with grafana. so i can put some dashboard on grafana. but seems the object status on the database isn't valid. i had already test it with 2 netxms server. do you know how i can read object status from database? what am i missing?

thx.


on console (valid):
(https://www.netxms.org/forum/general-support/mysql-query-for-object-status-(with-grafana)/?action=dlattach;attach=3952;image)

on grafana query (not valid):
(https://www.netxms.org/forum/general-support/mysql-query-for-object-status-(with-grafana)/?action=dlattach;attach=3950;image)

mysql query:

Quoteselect
   o.name,
   net.service_type,
   node.name as `node`,
   case
      when poller.name is null then "default (netxms server)"
      else poller.name
   end as `poller`,
   ip_port as `tcp port`,
   o.`status` as c
from object_properties o
   inner join network_services net on o.object_id = net.id
   inner join object_properties node on net.node_id = node.object_id
   left join object_properties poller on net.poller_node_id = poller.object_id
where
  o.`status` <> 6

Title: Re: mysql query for object status (with grafana)
Post by: Victor Kirhenshtein on February 21, 2018, 01:08:40 PM
Hi,

server only updates object_properties table when something persistent changes (like object name) and on shutdown (to save status and other runtime information). On large installations it removes a lot of unnecessary DB updates.

Best regards,
Victor