Difference between revisions of "Public.getmanagedoutagefornodeinwindow (function)"
(New page: == wikibot == {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" |- | '''function | public.getmanagedoutagefornodeinwindow |- |} <pre> CREATE OR REPLACE FUNCT...) |
|||
(4 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
{| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" | {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" | ||
− | |- | + | |- valign="top" |
− | | ''' | + | | '''Function |
| public.getmanagedoutagefornodeinwindow | | public.getmanagedoutagefornodeinwindow | ||
− | |||
|} | |} | ||
+ | === Source === | ||
<pre> | <pre> | ||
CREATE OR REPLACE FUNCTION public.getmanagedoutagefornodeinwindow(integer, timestamp without time zone, timestamp without time zone) | CREATE OR REPLACE FUNCTION public.getmanagedoutagefornodeinwindow(integer, timestamp without time zone, timestamp without time zone) |
Latest revision as of 10:19, 27 August 2011
wikibot[edit]
Function | public.getmanagedoutagefornodeinwindow |
Source[edit]
CREATE OR REPLACE FUNCTION public.getmanagedoutagefornodeinwindow(integer, timestamp without time zone, timestamp without time zone) RETURNS double precision LANGUAGE plpgsql AS $function$ DECLARE nid ALIAS FOR $1; xtime ALIAS FOR $2; ytime ALIAS FOR $3; downtime float8 := 0.0; orec RECORD; BEGIN FOR orec IN SELECT distinct ifservices.nodeid, ifservices.ipaddr, ifservices.serviceid FROM ipinterface, ifservices, node where ifservices.nodeid = nid AND ipinterface.nodeid = nid AND ipinterface.ismanaged = 'M' AND ifservices.ipaddr = ipinterface.ipaddr AND ifservices.status = 'A' AND node.nodeid = nid and node.nodetype = 'A' LOOP BEGIN downtime := downtime + getOutageTimeInWindow( orec.nodeid, orec.ipaddr, orec.serviceid, xtime, ytime); END; END LOOP; RETURN downtime; END; $function$