[Reconnoiter-devel] [reconnoiter commit] r982 - branches/skeksis/sql/sprocs

svn-commit at lists.omniti.com svn-commit at lists.omniti.com
Tue Oct 20 15:48:57 EDT 2009


Author: robert
Date: 2009-10-20 15:48:56 -0400 (Tue, 20 Oct 2009)
New Revision: 982

Added:
   branches/skeksis/sql/sprocs/stratcon.metric_name_summary_compile_fts_data.sql
Removed:
   branches/skeksis/sql/sprocs/stratcon.metric_name_summary_tsvector.sql
Log:
and yes, renaming this

Copied: branches/skeksis/sql/sprocs/stratcon.metric_name_summary_compile_fts_data.sql (from rev 981, branches/skeksis/sql/sprocs/stratcon.metric_name_summary_tsvector.sql)
===================================================================
--- branches/skeksis/sql/sprocs/stratcon.metric_name_summary_compile_fts_data.sql	                        (rev 0)
+++ branches/skeksis/sql/sprocs/stratcon.metric_name_summary_compile_fts_data.sql	2009-10-20 19:48:56 UTC (rev 982)
@@ -0,0 +1,57 @@
+set search_path = noit,pg_catalog;
+
+CREATE OR REPLACE FUNCTION stratcon.metric_name_summary_compile_fts_data
+(in_sid integer, in_metric_name text, in_metric_type text)
+RETURNS tsvector AS
+$BODY$
+DECLARE
+    ref_sid integer;
+    ref_module text;
+    ref_name text;
+    ref_target text;
+    ref_tags text;
+    ref_ctags text;
+    ref_hostname text;
+    ref_metric_name text;
+    ref_alias text;
+    v_fts_data tsvector;
+BEGIN
+    SELECT sid, module, name, target FROM check_archive WHERE sid=in_sid INTO ref_sid,ref_module,ref_name,ref_target;
+    IF NOT FOUND THEN
+        RETURN NULL;
+    END IF;
+
+    SELECT COALESCE(array_to_string(tags_array, ' '), ' ') FROM metric_tag WHERE sid=in_sid and metric_name=in_metric_name INTO ref_tags;
+    IF NOT FOUND THEN
+        ref_tags := ' ';
+    END IF;
+
+    SELECT COALESCE(array_to_string(tags_array, ' '), ' ') FROM check_tag WHERE sid=in_sid INTO ref_ctags;
+    IF NOT FOUND THEN
+        ref_ctags := ' ';
+    END IF;
+
+    SELECT value FROM metric_text_currently mt JOIN check_archive s USING(sid) 
+        WHERE module='dns' AND s.name='in-addr.arpa' AND target = ref_target INTO ref_hostname;
+      
+    SELECT mt.value FROM metric_text_currently mt JOIN check_archive s USING(sid)
+        WHERE s.module='snmp' AND mt.name='alias' AND s.sid=in_sid INTO ref_alias;
+
+    ref_hostname := coalesce(replace(ref_hostname, '.', ' '), ' ');
+    ref_metric_name := regexp_replace(in_metric_name, E'[_\`/.\\134]', ' ', 'g');
+    ref_alias := coalesce(regexp_replace(ref_alias, E'[_\`/.\\134]', ' ', 'g'), ' ');
+
+    v_fts_data := to_tsvector(ref_metric_name || ' ' ||
+                                ref_module || ' ' ||
+                                ref_name || ' ' ||
+                                ref_target || ' ' ||
+                                ref_hostname || ' ' ||
+                                ref_alias || ' ' ||
+                                ref_tags || ' ' ||
+                                ref_ctags);
+    RETURN v_fts_data;
+END
+$BODY$
+LANGUAGE 'plpgsql' 
+SECURITY DEFINER;
+ 

Deleted: branches/skeksis/sql/sprocs/stratcon.metric_name_summary_tsvector.sql
===================================================================
--- branches/skeksis/sql/sprocs/stratcon.metric_name_summary_tsvector.sql	2009-10-20 19:47:29 UTC (rev 981)
+++ branches/skeksis/sql/sprocs/stratcon.metric_name_summary_tsvector.sql	2009-10-20 19:48:56 UTC (rev 982)
@@ -1,57 +0,0 @@
-set search_path = noit,pg_catalog;
-
-CREATE OR REPLACE FUNCTION stratcon.metric_name_summary_compile_fts_data
-(in_sid integer, in_metric_name text, in_metric_type text)
-RETURNS tsvector AS
-$BODY$
-DECLARE
-    ref_sid integer;
-    ref_module text;
-    ref_name text;
-    ref_target text;
-    ref_tags text;
-    ref_ctags text;
-    ref_hostname text;
-    ref_metric_name text;
-    ref_alias text;
-    v_fts_data tsvector;
-BEGIN
-    SELECT sid, module, name, target FROM check_archive WHERE sid=in_sid INTO ref_sid,ref_module,ref_name,ref_target;
-    IF NOT FOUND THEN
-        RETURN NULL;
-    END IF;
-
-    SELECT COALESCE(array_to_string(tags_array, ' '), ' ') FROM metric_tag WHERE sid=in_sid and metric_name=in_metric_name INTO ref_tags;
-    IF NOT FOUND THEN
-        ref_tags := ' ';
-    END IF;
-
-    SELECT COALESCE(array_to_string(tags_array, ' '), ' ') FROM check_tag WHERE sid=in_sid INTO ref_ctags;
-    IF NOT FOUND THEN
-        ref_ctags := ' ';
-    END IF;
-
-    SELECT value FROM metric_text_currently mt JOIN check_archive s USING(sid) 
-        WHERE module='dns' AND s.name='in-addr.arpa' AND target = ref_target INTO ref_hostname;
-      
-    SELECT mt.value FROM metric_text_currently mt JOIN check_archive s USING(sid)
-        WHERE s.module='snmp' AND mt.name='alias' AND s.sid=in_sid INTO ref_alias;
-
-    ref_hostname := coalesce(replace(ref_hostname, '.', ' '), ' ');
-    ref_metric_name := regexp_replace(in_metric_name, E'[_\`/.\\134]', ' ', 'g');
-    ref_alias := coalesce(regexp_replace(ref_alias, E'[_\`/.\\134]', ' ', 'g'), ' ');
-
-    v_fts_data := to_tsvector(ref_metric_name || ' ' ||
-                                ref_module || ' ' ||
-                                ref_name || ' ' ||
-                                ref_target || ' ' ||
-                                ref_hostname || ' ' ||
-                                ref_alias || ' ' ||
-                                ref_tags || ' ' ||
-                                ref_ctags);
-    RETURN v_fts_data;
-END
-$BODY$
-LANGUAGE 'plpgsql' 
-SECURITY DEFINER;
- 



More information about the Reconnoiter-devel mailing list