Welcome Guest, you are in: Login

devio dbscript ScrewTurn Wiki

RSS RSS

Navigation





Search the wiki
»

PoweredBy

Page History: public getmanagedoutagefornodeinwindow (function)

Compare Page Revisions



« Older Revision - Back to Page History - Current Revision


Page Revision: 2010/06/25 22:47


wikibot

Functionpublic.getmanagedoutagefornodeinwindow

Source

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$

References

Dependency TypeObject TypeReferenced Object
SelectTablepublic.ifservices
SelectTablepublic.ipinterface
SelectTablepublic.node
ExecuteFunctionpublic.getoutagetimeinwindow

Dependencies

Reference TypeObject TypeReferencing Object
ExecuteFunctionpublic.getmanagepercentavailnodewindow

ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam.