Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
zabbix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
infra
ansible-shared
zabbix
Commits
45b7010f
Commit
45b7010f
authored
8 years ago
by
Robin Sonnabend
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of git.fsmpi.rwth-aachen.de:infra/ansible
parents
6ad6bf5c
af165749
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
zabbix-server/files/commentcounts.sql
+20
-0
20 additions, 0 deletions
zabbix-server/files/commentcounts.sql
zabbix-server/tasks/main.yml
+19
-1
19 additions, 1 deletion
zabbix-server/tasks/main.yml
with
39 additions
and
1 deletion
zabbix-server/files/commentcounts.sql
0 → 100644
+
20
−
0
View file @
45b7010f
CREATE
OR
REPLACE
FUNCTION
zbx_update_partition_table_comments
(
schema_arg
TEXT
DEFAULT
'partitions'
)
RETURNS
INT
AS
$$
DECLARE
r
RECORD
;
c
BIGINT
;
t
TEXT
;
BEGIN
RAISE
NOTICE
'Updating table comments in schema %'
,
schema_arg
;
FOR
r
IN
SELECT
tablename
FROM
pg_tables
WHERE
schemaname
=
schema_arg
-- AND tablename like 'history_str%'
LOOP
RAISE
NOTICE
'. updating comment for %.%'
,
schema_arg
,
r
.
tablename
;
EXECUTE
'SELECT count(1) FROM '
||
quote_ident
(
schema_arg
)
||
'.'
||
quote_ident
(
r
.
tablename
)
||
''
INTO
c
;
t
:
=
quote_literal
(
date_trunc
(
'second'
,
CURRENT_TIMESTAMP
)::
TEXT
||
' => '
||
to_char
(
c
,
'999G999G999G999'
)
||
' Rows'
);
RAISE
NOTICE
'.. got count % for %.%'
,
t
,
schema_arg
,
r
.
tablename
;
EXECUTE
'COMMENT ON TABLE '
||
quote_ident
(
schema_arg
)
||
'.'
||
quote_ident
(
r
.
tablename
)
||
' IS '
||
t
||
''
;
END
LOOP
;
RETURN
1
;
END
$$
LANGUAGE
plpgsql
;
This diff is collapsed.
Click to expand it.
zabbix-server/tasks/main.yml
+
19
−
1
View file @
45b7010f
...
...
@@ -36,6 +36,12 @@
-
database
-
zabbix
-
name
:
ensure there is the commentcounts sql file
copy
:
src=commentcounts.sql dest=/usr/share/doc/zabbix-server-pgsql/commentcounts.sql
tags
:
-
database
-
zabbix
-
name
:
ensure we have a user on the database server
postgresql_user
:
name="{{ zabbix_db_user }}" password="{{ zabbix_db_password }}" state=present role_attr_flags=NOSUPERUSER,NOCREATEDB
become
:
yes
...
...
@@ -98,7 +104,19 @@
-
name
:
apply database schema optimization
shell
:
psql -h {{ zabbix_db_host }} -U {{ zabbix_db_user }} -w -d {{ zabbix_db_name }} -f /usr/share/doc/zabbix-server-pgsql/zabbix-partition.sql && touch /var/lib/zabbix/.db_schema_optimized
args
:
creates
:
/var/lib/zabbix/.db_schema_created
creates
:
/var/lib/zabbix/.db_schema_optimized
become
:
yes
become_user
:
zabbix
notify
:
-
restart zabbix server
tags
:
-
database
-
zabbix
-
name
:
apply database commentcounts function
shell
:
psql -h {{ zabbix_db_host }} -U {{ zabbix_db_user }} -w -d {{ zabbix_db_name }} -f /usr/share/doc/zabbix-server-pgsql/commentcounts.sql && touch /var/lib/zabbix/.db_schema_countfunc
args
:
creates
:
/var/lib/zabbix/.db_schema_countfunc
become
:
yes
become_user
:
zabbix
notify
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment