joschi99 / Osiris

Osiris NMS
0 stars 1 forks source link

ITSonix: service widget shows incorrect datas #34

Closed joschi99 closed 8 years ago

joschi99 commented 8 years ago

customer: ITSonix service-widget: 1.3.2 centreon 2.5.x

The service widget has more issues:

joschi99 commented 8 years ago

Upgrading the widget to version 1.4.0 no datas are more reported by the widget. Compatibility problem?

Maybe the problem is related on some database mismatch between host, services, hostgroups and servicegroups. This could be also the issue for issue #4 Customer send me his database for furter analysis.

joschi99 commented 8 years ago

Hallo Roman,

ich habe mir die Daten angesehen und nichts auffälliges gefunden. Es wäre aber schön, wenn wir mal folgenden Test machen könnten:

Wenn das läuft, könntest du eine Servicegruppe nach der anderen neu anlegen und jeweils prüfen, ob es Probleme gibt. Kannst du das mal machen?

Lg Jochen

joschi99 commented 8 years ago

Teamviewersession mit Roman gemacht. Auch ohne jede Servicegruppe sind immer die gleichen Fehler im Widget:

Da das Problem auf anderen Systemen nicht auftritt und entweder das doppelte oder die hälfte angezeigt wird, ist ziemlich sicher entweder eine SQL-Abfrage nicht richtig bzw. ist in einer Tabelle eine Datenleiche vorhanden, Ich werde deshalb auf einer leeren VM mit der gleichen Version von Roman das Backup einspielen, um das Problem zu simulieren.

Als Workaround stellt Roman im Widget die Anzahl der angezeigten Dienste auf 100.

joschi99 commented 8 years ago

Das Widget führt folgendes SQL in der DB centreon_storage aus:

SELECT SQL_CALC_FOUND_ROWS h.host_id,
        h.name as hostname,
        h.state as h_state,
        s.service_id,
        s.description,
        s.state as s_state,
        s.last_hard_state,
        s.output,
        s.scheduled_downtime_depth as s_scheduled_downtime_depth,
        s.acknowledged as s_acknowledged,
        s.notify as s_notify,
        s.active_checks as s_active_checks,
        s.passive_checks as s_passive_checks,
        h.scheduled_downtime_depth as h_scheduled_downtime_depth,
        h.acknowledged as h_acknowledged,
        h.notify as h_notify,
        h.active_checks as h_active_checks,
        h.passive_checks as h_passive_checks,
        s.last_check,
        s.last_state_change,
        s.last_hard_state_change,
        s.check_attempt,
        s.max_check_attempts,
        h.action_url as h_action_url,
        h.notes_url as h_notes_url,
        s.action_url as s_action_url,
        s.notes_url as s_notes_url, 
        cv2.value AS criticality_id,
        cv.value AS criticality_level
 FROM hosts h, services s 
 LEFT JOIN customvariables cv ON (s.service_id = cv.service_id AND s.host_id = cv.host_id AND cv.name = 'CRITICALITY_LEVEL') 
 LEFT JOIN customvariables cv2 ON (s.service_id = cv2.service_id AND s.host_id = cv2.host_id AND cv2.name = 'CRITICALITY_ID') 

 WHERE s.host_id = h.host_id 
 AND h.name NOT LIKE '_Module_%' 
 AND s.enabled = 1 

Für weitere Analysen benötige ich den aktuellen Inhalt dieser DB, zumindest der Tabellen hosts, services und customvariables.

joschi99 commented 8 years ago

Da in Osiris2.0 noch die Nagios Engine verwendet wird, wird die Datenbank centstatus verwedenet. Die entsprechenden Tabellen wurden exportiert. centstatus.sql.txt

joschi99 commented 8 years ago

In allen 3 Tabellen sind die Daten doppelt enthalten, wobei sie sich nur im Feld "config_type" unterscheiden (0/1).

Das SQL, welches vom Widget ausgeführt wird, ist folgendes:

SELECT SQL_CALC_FOUND_ROWS h.host_id,
                 h.display_name as hostname,
                 hs.current_state as h_state,
                 s.service_id,
                 s.display_name as description,
                 ss.current_state as s_state,
                 ss.last_hard_state,
                 ss.output,
                 ss.scheduled_downtime_depth as s_scheduled_downtime_depth,
                 ss.problem_has_been_acknowledged as s_acknowledged,
                 ss.notifications_enabled as s_notify,
                 s.active_checks_enabled as s_active_checks,
                 s.passive_checks_enabled as s_passive_checks,
                 hs.scheduled_downtime_depth as h_scheduled_downtime_depth,
                 hs.problem_has_been_acknowledged as h_acknowledged,
                 hs.notifications_enabled as h_notify,
                 h.active_checks_enabled as h_active_checks,
                 h.passive_checks_enabled as h_passive_checks,
                 UNIX_TIMESTAMP(ss.last_check) as last_check,
                 UNIX_TIMESTAMP(ss.last_state_change) as last_state_change,
                 UNIX_TIMESTAMP(ss.last_hard_state_change) as last_hard_state_change,
                 ss.current_check_attempt as check_attempt,
                 ss.max_check_attempts,
                 h.action_url as h_action_url,
                 h.notes_url as h_notes_url,
                 s.action_url as s_action_url,
                 s.notes_url as s_notes_url 
FROM nagios_hosts h, nagios_hoststatus hs, nagios_services s, nagios_servicestatus ss 
WHERE s.host_object_id = h.host_object_id 
AND h.host_object_id = hs.host_object_id 
AND ss.service_object_id = s.service_object_id
AND h.display_name NOT LIKE '_Module_%' 
AND s.config_type = 0