Difference between revisions of "Public.getmanagedoutagefornodeinwindow (function)"

From dbscript Online Help
Jump to: navigation, search
Line 1: Line 1:
 
== wikibot ==
 
== wikibot ==
 +
 +
{| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse"
 +
|-
 +
| '''Function
 +
| public.getmanagedoutagefornodeinwindow
 +
|-
 +
|}
 +
 +
 +
=== Source ===
 +
<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)
 
  RETURNS double precision
 
  RETURNS double precision
Line 20: Line 31:
 
   END;
 
   END;
 
$function$
 
$function$
 +
</pre>
 +
 +
=== References ===
 +
{| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse"
 +
|- style="background:silver"
 +
| '''Dependency Type
 +
| '''Object Type
 +
| '''Referenced Object
 +
 
|-
 
|-
 
| Select
 
| Select
Line 39: Line 59:
 
| Function
 
| Function
 
| [[public.getoutagetimeinwindow_(function)|public.getoutagetimeinwindow]]
 
| [[public.getoutagetimeinwindow_(function)|public.getoutagetimeinwindow]]
 +
 +
|}
 +
 +
=== Dependencies ===
 +
{| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse"
 +
|- style="background:silver"
 +
| '''Reference Type
 +
| '''Object Type
 +
| '''Referencing Object
  
 
|-
 
|-
Line 44: Line 73:
 
| Function
 
| Function
 
| [[public.getmanagepercentavailnodewindow_(function)|public.getmanagepercentavailnodewindow]]
 
| [[public.getmanagepercentavailnodewindow_(function)|public.getmanagepercentavailnodewindow]]
 +
 +
|}

Revision as of 09:37, 11 February 2010

wikibot

Function public.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 Type Object Type Referenced Object
Select Table public.ifservices
Select Table public.ipinterface
Select Table public.node
Execute Function public.getoutagetimeinwindow

Dependencies

Reference Type Object Type Referencing Object
Execute Function public.getmanagepercentavailnodewindow