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

From dbscript Online Help
Jump to: navigation, search
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
 
| '''Function
 
| public.getmanagedoutagefornodeinwindow
 
| public.getmanagedoutagefornodeinwindow
|-
 
 
|}
 
|}
 
  
 
=== Source ===
 
=== Source ===
Line 40: Line 38:
 
| '''Referenced Object
 
| '''Referenced Object
  
|-
+
|- valign="top"
 
| Select
 
| Select
 
| Table
 
| Table
 
| [[public.ifservices_(table)|public.ifservices]]
 
| [[public.ifservices_(table)|public.ifservices]]
  
|-
+
|- valign="top"
 
| Select
 
| Select
 
| Table
 
| Table
 
| [[public.ipinterface_(table)|public.ipinterface]]
 
| [[public.ipinterface_(table)|public.ipinterface]]
  
|-
+
|- valign="top"
 
| Select
 
| Select
 
| Table
 
| Table
 
| [[public.node_(table)|public.node]]
 
| [[public.node_(table)|public.node]]
  
|-
+
|- valign="top"
 
| Execute
 
| Execute
 
| Function
 
| Function
Line 69: Line 67:
 
| '''Referencing Object
 
| '''Referencing Object
  
|-
+
|- valign="top"
 
| Execute
 
| Execute
 
| Function
 
| Function

Revision as of 23:38, 24 June 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