Difference between revisions of "Public.getmanagedoutageforintfinwindow (function)"
Line 1: | Line 1: | ||
== wikibot == | == wikibot == | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
CREATE OR REPLACE FUNCTION public.getmanagedoutageforintfinwindow(integer, character varying, timestamp without time zone, timestamp without time zone) | CREATE OR REPLACE FUNCTION public.getmanagedoutageforintfinwindow(integer, character varying, timestamp without time zone, timestamp without time zone) | ||
RETURNS double precision | RETURNS double precision | ||
Line 31: | Line 21: | ||
END; | END; | ||
$function$ | $function$ | ||
− | + | |- | |
+ | | Select | ||
+ | | Table | ||
+ | | [[public.ifservices_(table)|public.ifservices]] | ||
+ | |||
+ | |- | ||
+ | | Select | ||
+ | | Table | ||
+ | | [[public.ipinterface_(table)|public.ipinterface]] | ||
+ | |||
+ | |- | ||
+ | | Execute | ||
+ | | Function | ||
+ | | [[public.getoutagetimeinwindow_(function)|public.getoutagetimeinwindow]] | ||
+ | |||
+ | |- | ||
+ | | Execute | ||
+ | | Function | ||
+ | | [[public.getmanagepercentavailintfwindow_(function)|public.getmanagepercentavailintfwindow]] |
Revision as of 08:31, 11 February 2010
wikibot
CREATE OR REPLACE FUNCTION public.getmanagedoutageforintfinwindow(integer, character varying, timestamp without time zone, timestamp without time zone)
RETURNS double precision LANGUAGE plpgsql
AS $function$
DECLARE
nid ALIAS FOR $1; ipid ALIAS FOR $2; xtime ALIAS FOR $3; ytime ALIAS FOR $4; downtime float8 := 0.0; orec RECORD;
BEGIN
FOR orec IN SELECT distinct ifservices.nodeid, ifservices.ipaddr, ifservices.serviceid FROM ipinterface, ifservices where ifservices.nodeid = nid AND ifservices.ipaddr = ipid AND ipinterface.nodeid = nid AND ipinterface.ipaddr = ipid AND ipinterface.ismanaged = 'M' AND ifservices.status = 'A' LOOP BEGIN downtime := downtime + getOutageTimeInWindow( orec.nodeid, orec.ipaddr, orec.serviceid, xtime, ytime); END; END LOOP; RETURN downtime;
END;
$function$ |- | Select | Table | public.ifservices
|- | Select | Table | public.ipinterface
|- | Execute | Function | public.getoutagetimeinwindow
|- | Execute | Function | public.getmanagepercentavailintfwindow