Changeset dfd06d8bc70524168b54bb26477b5f0a3f3a38fe
- Timestamp:
- 10/20/09 15:34:46
(4 years ago)
- Author:
- Theo Schlossnagle <jesus@omniti.com>
- git-committer:
- Theo Schlossnagle <jesus@omniti.com> 1256052886 +0000
- git-parent:
[bcfd3007c0f115d339be6889e5a1fc27333d0b43]
- git-author:
- Theo Schlossnagle <jesus@omniti.com> 1256052886 +0000
- Message:
fix up things to work
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rfe61445 |
rdfd06d8 |
|
| 4 | 4 | alter user stratcon set search_path to noit,public; |
|---|
| 5 | 5 | create user prism with unencrypted password 'prism'; |
|---|
| | 6 | alter user prism set search_path to noit,public; |
|---|
| 6 | 7 | \c reconnoiter reconnoiter; |
|---|
| 7 | 8 | begin; |
|---|
| … | … | |
| 34 | 35 | \i tables/stratcon.storage_node.sql |
|---|
| 35 | 36 | \i tables/stratcon.map_uuid_to_sid.sql |
|---|
| | 37 | \i tables/prism.graph_templates.sql |
|---|
| 36 | 38 | |
|---|
| 37 | 39 | \i sprocs/noit.check_archive_log_changes.sql |
|---|
| … | … | |
| 52 | 54 | \i sprocs/stratcon.window_robust_derive.sql |
|---|
| 53 | 55 | \i sprocs/stratcon.update_config.sql |
|---|
| | 56 | \i sprocs/prism.add_graph_tags.sql |
|---|
| | 57 | \i sprocs/prism.add_tags.sql |
|---|
| | 58 | \i sprocs/prism.check_name_saved_graphs.sql |
|---|
| | 59 | \i sprocs/prism.remove_graph_tags.sql |
|---|
| | 60 | \i sprocs/prism.remove_tags.sql |
|---|
| | 61 | \i sprocs/prism.saved_graphs_tsvector.sql |
|---|
| | 62 | \i sprocs/prism.trig_update_tsvector_saved_graphs.sql |
|---|
| 54 | 63 | |
|---|
| 55 | 64 | \i tables/noit.check_archive.sql |
|---|
| … | … | |
| 61 | 70 | \i tables/noit.metric_tag.sql |
|---|
| 62 | 71 | \i tables/noit.metric_text_archive.sql |
|---|
| | 72 | \i tables/prism.saved_graphs.sql |
|---|
| | 73 | \i tables/prism.saved_graphs_dep.sql |
|---|
| | 74 | \i tables/prism.saved_worksheets.sql |
|---|
| | 75 | \i tables/prism.saved_worksheets_dep.sql |
|---|
| 63 | 76 | |
|---|
| 64 | 77 | commit; |
|---|
| r161a5c5 |
rdfd06d8 |
|
| 19 | 19 | ) i, |
|---|
| 20 | 20 | ( select 5*60 as isec, '5 minutes'::interval as aperiod, |
|---|
| 21 | | 'noit.metric_numeric_rollup_5m' as atablename |
|---|
| | 21 | 'metric_numeric_rollup_5m' as atablename |
|---|
| 22 | 22 | union all |
|---|
| 23 | 23 | select 20*60 as isec, '20 minutes'::interval as aperiod, |
|---|
| 24 | | 'noit.metric_numeric_rollup_20m' as atablename |
|---|
| | 24 | 'metric_numeric_rollup_20m' as atablename |
|---|
| 25 | 25 | union all |
|---|
| 26 | 26 | select 60*60 as isec, '1 hour'::interval as aperiod, |
|---|
| 27 | | 'noit.metric_numeric_rollup_60m' as atablename |
|---|
| | 27 | 'metric_numeric_rollup_60m' as atablename |
|---|
| 28 | 28 | union all |
|---|
| 29 | 29 | select 6*60*60 as isec, '6 hours'::interval as aaperiod, |
|---|
| 30 | | 'noit.metric_numeric_rollup_6hours' as atablename |
|---|
| | 30 | 'metric_numeric_rollup_6hours' as atablename |
|---|
| 31 | 31 | union all |
|---|
| 32 | 32 | select 12*60*60 as isec, '12 hours'::interval as aperiod, |
|---|
| 33 | | 'noit.metric_numeric_rollup_12hours' as atablename |
|---|
| | 33 | 'metric_numeric_rollup_12hours' as atablename |
|---|
| 34 | 34 | ) ivs |
|---|
| 35 | 35 | ) b |
|---|
| r161a5c5 |
rdfd06d8 |
|
| 12 | 12 | end if; |
|---|
| 13 | 13 | |
|---|
| 14 | | for v_record in select sid, name, rollup_time, count_rows, avg_value, counter_dev from stratcon._fetch_dataset(v_sid::integer, in_name, in_start_time, in_end_time, in_hopeful_nperiods, derive) loop |
|---|
| | 14 | for v_record in select sid, name, rollup_time, count_rows, avg_value, counter_dev from stratcon.fetch_dataset(v_sid::integer, in_name, in_start_time, in_end_time, in_hopeful_nperiods, derive) loop |
|---|
| 15 | 15 | return next v_record; |
|---|
| 16 | 16 | end loop; |
|---|
| 17 | 17 | |
|---|
| 18 | | -- return query select sid, name, rollup_time, count_rows, avg_value from stratcon._fetch_dataset(v_sid::integer, in_name, in_start_time, in_end_time, in_hopeful_nperiods, derive); |
|---|
| | 18 | -- return query select sid, name, rollup_time, count_rows, avg_value from stratcon.fetch_dataset(v_sid::integer, in_name, in_start_time, in_end_time, in_hopeful_nperiods, derive); |
|---|
| 19 | 19 | return; |
|---|
| 20 | 20 | end |
|---|
| … | … | |
| 24 | 24 | GRANT EXECUTE ON FUNCTION stratcon.fetch_dataset(uuid, text, timestamp with time zone, timestamp with time zone, integer, boolean) TO stratcon; |
|---|
| 25 | 25 | |
|---|
| 26 | | CREATE OR REPLACE FUNCTION stratcon._fetch_dataset(in_sid integer, in_name text, in_start_time timestamp with time zone, in_end_time timestamp with time zone, in_hopeful_nperiods integer, derive boolean) |
|---|
| | 26 | CREATE OR REPLACE FUNCTION stratcon.fetch_dataset(in_sid integer, in_name text, in_start_time timestamp with time zone, in_end_time timestamp with time zone, in_hopeful_nperiods integer, derive boolean) |
|---|
| 27 | 27 | RETURNS SETOF noit.metric_numeric_rollup_5m AS |
|---|
| 28 | 28 | $BODY$declare |
|---|
| … | … | |
| 68 | 68 | ' from generate_series(1,' || v_target.nperiods || ') t) s ' || |
|---|
| 69 | 69 | 'left join ' || |
|---|
| 70 | | '(select * from noit.' || v_target.tablename || |
|---|
| | 70 | '(select * from ' || v_target.tablename || |
|---|
| 71 | 71 | ' where sid = ' || v_sid || |
|---|
| 72 | 72 | ' and name = ' || quote_literal(in_name) || |
|---|
| … | … | |
| 99 | 99 | $BODY$ |
|---|
| 100 | 100 | LANGUAGE 'plpgsql' SECURITY DEFINER; |
|---|
| 101 | | GRANT EXECUTE ON FUNCTION stratcon._fetch_dataset(integer, text, timestamp with time zone, timestamp with time zone, integer, boolean) TO stratcon; |
|---|
| | 101 | GRANT EXECUTE ON FUNCTION stratcon.fetch_dataset(integer, text, timestamp with time zone, timestamp with time zone, integer, boolean) TO stratcon; |
|---|
| 102 | 102 | |
|---|
| rb9af758 |
rdfd06d8 |
|
| 56 | 56 | extract('epoch' from v_target.period)) || ' seconds') ::interval as whence, |
|---|
| 57 | 57 | name, value |
|---|
| 58 | | from noit.metric_text_changelog |
|---|
| | 58 | from metric_text_changelog |
|---|
| 59 | 59 | where sid = v_sid |
|---|
| 60 | 60 | and name = in_name |
|---|
| … | … | |
| 79 | 79 | extract('epoch' from v_target.period)) || ' seconds') ::interval as whence, |
|---|
| 80 | 80 | coalesce(value, '[unset]') as value |
|---|
| 81 | | from noit.metric_text_changelog |
|---|
| | 81 | from metric_text_changelog |
|---|
| 82 | 82 | where sid = v_sid |
|---|
| 83 | 83 | and name = in_name |
|---|
| refff2d9 |
rdfd06d8 |
|
| 23 | 23 | (whence > in_start_time - '5 minutes'::interval) as in_window, |
|---|
| 24 | 24 | value |
|---|
| 25 | | FROM noit.metric_numeric_archive |
|---|
| | 25 | FROM metric_numeric_archive |
|---|
| 26 | 26 | WHERE whence <= in_start_time |
|---|
| 27 | 27 | AND whence > in_start_time - ('5 minutes'::interval * 2) |
|---|