public.vwrealtimemonitorservicehealth

public.vwrealtimemonitorservicehealth

Description

Table Definition
CREATE VIEW vwrealtimemonitorservicehealth AS (
 WITH service_rows AS (
         SELECT realtimeadaptermonitordata.keyid,
            realtimeadaptermonitordata.servicename,
            realtimeadaptermonitordata.status,
            realtimeadaptermonitordata.isrunning,
            realtimeadaptermonitordata.eventsprocessed,
            realtimeadaptermonitordata.errorcount,
            realtimeadaptermonitordata.activeconnections,
            realtimeadaptermonitordata.totalwebsockets,
            realtimeadaptermonitordata.activeconversations,
            realtimeadaptermonitordata.staleconversationcount,
            realtimeadaptermonitordata.oldeststaleconversationageseconds,
            realtimeadaptermonitordata.healthpercentage,
            realtimeadaptermonitordata.acwpendingcount,
            realtimeadaptermonitordata.staleacwcount,
            realtimeadaptermonitordata.lastactivityutc,
            realtimeadaptermonitordata.lastconversationnotificationutc,
            realtimeadaptermonitordata.lastconversationhealthcheckutc,
            realtimeadaptermonitordata.lastconversationverifiedactiveutc,
            realtimeadaptermonitordata.updated,
            realtimeadaptermonitordata.notes
           FROM realtimeadaptermonitordata
          WHERE ((realtimeadaptermonitordata.servicename IS NOT NULL) AND ((realtimeadaptermonitordata.keyid)::text = (realtimeadaptermonitordata.servicename)::text))
        ), health_rows AS (
         SELECT replace((realtimeadaptermonitordata.keyid)::text, 'RealtimeMonitorService:service:'::text, ''::text) AS servicename,
            realtimeadaptermonitordata.healthpercentage,
            realtimeadaptermonitordata.updated AS healthupdated,
            realtimeadaptermonitordata.notes AS healthnotes
           FROM realtimeadaptermonitordata
          WHERE ((realtimeadaptermonitordata.keyid)::text ~~ 'RealtimeMonitorService:service:%'::text)
        )
 SELECT hr.servicename,
    sr.status,
    sr.isrunning,
    hr.healthpercentage,
        CASE
            WHEN (hr.healthpercentage IS NULL) THEN 'Unknown'::text
            WHEN (hr.healthpercentage >= (90)::numeric) THEN 'Healthy'::text
            WHEN (hr.healthpercentage >= (75)::numeric) THEN 'Degraded'::text
            WHEN (hr.healthpercentage >= (60)::numeric) THEN 'Warning'::text
            ELSE 'Critical'::text
        END AS healthstatus,
    ((hr.healthpercentage IS NOT NULL) AND (hr.healthpercentage < (60)::numeric) AND ((COALESCE(hr.healthnotes, ''::character varying))::text !~~ '%restart_suppressed=true%'::text)) AS restartrecommended,
    ((COALESCE(hr.healthnotes, ''::character varying))::text ~~ '%restart_suppressed=true%'::text) AS restartsuppressed,
        CASE
            WHEN ((COALESCE(hr.healthnotes, ''::character varying))::text ~~ '%restart_suppression_reason=outside_business_hours%'::text) THEN 'outside_business_hours'::text
            ELSE NULL::text
        END AS restartpolicyreason,
    sr.eventsprocessed,
    sr.errorcount,
    sr.activeconnections,
    sr.totalwebsockets,
    sr.activeconversations,
    sr.staleconversationcount,
    sr.oldeststaleconversationageseconds,
    ((sr.oldeststaleconversationageseconds)::numeric / 60.0) AS oldeststaleconversationageminutes,
    sr.acwpendingcount,
    sr.staleacwcount,
    sr.lastactivityutc,
    sr.lastconversationnotificationutc,
    sr.lastconversationhealthcheckutc,
    sr.lastconversationverifiedactiveutc,
    hr.healthupdated AS updated,
        CASE
            WHEN (hr.healthupdated IS NULL) THEN NULL::integer
            ELSE GREATEST(0, (floor(EXTRACT(epoch FROM (timezone('utc'::text, now()) - hr.healthupdated))))::integer)
        END AS healthrowageseconds,
    hr.healthnotes AS notes
   FROM (health_rows hr
     JOIN service_rows sr ON (((sr.servicename)::text = hr.servicename)))
)

Columns

Name Type Default Nullable Children Parents Comment
servicename text true
status varchar(50) true
isrunning boolean true
healthpercentage numeric(5,2) true
healthstatus text true
restartrecommended boolean true
restartsuppressed boolean true
restartpolicyreason text true
eventsprocessed bigint true
errorcount bigint true
activeconnections integer true
totalwebsockets integer true
activeconversations integer true
staleconversationcount integer true
oldeststaleconversationageseconds integer true
oldeststaleconversationageminutes numeric true
acwpendingcount integer true
staleacwcount integer true
lastactivityutc timestamp without time zone true
lastconversationnotificationutc timestamp without time zone true
lastconversationhealthcheckutc timestamp without time zone true
lastconversationverifiedactiveutc timestamp without time zone true
updated timestamp without time zone true
healthrowageseconds integer true
notes varchar(400) true

Referenced Tables

Name Columns Comment Type
public.realtimeadaptermonitordata 20 BASE TABLE
timezone 0
health_rows 0