Overall Service Health in Percent

Hello all,

Is there a way to show the overall Service Health in Percent?
With Nagios it was quite easy;
http://IP/nagios/cgi-bin/tac.cgi and then there is a graph with the overall Service and Host Health. With a curl Command you get the Value of the Graph.

Many Thanks and regards

try https://youricinga/icingaweb2/monitoring/health/stats

sorry, no percentage there

you can create a mysql check the the following query:

select SUM(CASE WHEN service_handled = 0 and service_state > 1 THEN 1 ELSE 0 END) / sum(1)*100 as problem from (SELECT so.name1 AS host_name, CASE WHEN hs.has_been_checked = 0 OR hs.has_been_checked IS NULL THEN 99 ELSE hs.current_state END AS host_state, hs.output AS host_output, CASE WHEN (hs.problem_has_been_acknowledged + hs.scheduled_downtime_depth) > 0 THEN 1 ELSE 0 END AS host_handled, hs.problem_has_been_acknowledged AS host_acknowledged, CASE WHEN (hs.scheduled_downtime_depth = 0) THEN 0 ELSE 1 END AS host_in_downtime, so.name2 AS service_description, CASE WHEN ss.has_been_checked = 0 OR ss.has_been_checked IS NULL THEN 99 ELSE ss.current_state END AS service_state, ss.problem_has_been_acknowledged AS service_acknowledged, CASE WHEN (ss.scheduled_downtime_depth = 0 OR ss.scheduled_downtime_depth IS NULL) THEN 0 ELSE 1 END AS service_in_downtime, CASE WHEN (ss.problem_has_been_acknowledged + ss.scheduled_downtime_depth + COALESCE(hs.current_state, 0)) > 0 THEN 1 ELSE 0 END AS service_handled, ss.output AS service_output, ss.perfdata AS service_perfdata, UNIX_TIMESTAMP(ss.last_state_change) AS service_last_state_change FROM icinga_objects AS so INNER JOIN icinga_services AS s ON s.service_object_id = so.object_id AND so.is_active = 1 AND so.objecttype_id = 2 INNER JOIN icinga_hoststatus AS hs ON hs.host_object_id = s.host_object_id INNER JOIN icinga_servicestatus AS ss ON ss.service_object_id = so.object_id ORDER BY s.display_name COLLATE latin1_general_ci ASC ) as b

1 Like

if you remove that part in the first line you get all services regardless of handled or not

Maybe also take a look at the Reporting module, if that offers what you seek :slight_smile: