Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
icinga-checks
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
IML Open Source
icinga-checks
Commits
0e7feb95
Commit
0e7feb95
authored
2 years ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
update psql output
parent
74250085
Branches
Branches containing commit
No related tags found
1 merge request
!112
update psql output
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
check_psqlserver
+29
-8
29 additions, 8 deletions
check_psqlserver
with
29 additions
and
8 deletions
check_psqlserver
+
29
−
8
View file @
0e7feb95
...
...
@@ -233,6 +233,9 @@ case "${sMode}" in
typeset
-i
iQOther
;
iQOther
=
$iQTotal
-
$iQActive
-
$iQIdle
-
$iQFastpath
descr
=
"Running total:
$iQTotal
... active:
$iQActive
idle:
$iQIdle
fastpath:
$iQFastpath
other:
$iQOther
"
out+
=
"
${
NL
}
"
out+
=
"Hint: Query for details:
${
NL
}
"
out+
=
"select * from pg_stat_activity.
${
NL
}
"
# typeset -i iMax; iMax=20
# out=$( grep "^.[a-z]" <<< "${_out}" | cut -c 1-150 | tr '|' ':' | head -${iMax} )
# if [ ${iQTotal} -gt ${iMax} ]; then
...
...
@@ -247,7 +250,7 @@ case "${sMode}" in
"conflicts"
)
deltaunit
=
min
descr
=
"
(from pg_stat_database_conflicts)
"
descr
=
""
renderCounters
"select
\
sum(confl_tablespace) as confl_tablespace,
\
sum(confl_lock) as confl_lock,
\
...
...
@@ -260,15 +263,17 @@ case "${sMode}" in
typeset
-i
iTotal
;
iTotal
=
$(
echo
"
$out
"
|
awk
'{ sum+=$7} END { print sum;}'
)
if
[
$iTotal
-gt
0
]
;
then
ph.setStatus
"critical"
descr+
=
" ...
$iTotal
conflicts detected"
descr+
=
" ...
$iTotal
per min
conflicts detected"
else
descr+
=
" ... OK, nothing was found"
fi
descr+
=
" - currently
$iTotal
per
${
deltaunit
}
"
out+
=
"
${
NL
}
"
out+
=
"Hint: Query for details per database:
${
NL
}
"
out+
=
"select * from pg_stat_database_conflicts.
${
NL
}
"
;;
"dbrows"
)
descr
=
"Count of database row actions
(from pg_stat_database)
"
descr
=
"Count of database row actions"
renderCounters
"select
\
sum(tup_returned) as tup_returned,
\
sum(tup_fetched) as tup_fetched,
\
...
...
@@ -276,6 +281,9 @@ case "${sMode}" in
sum(tup_updated) as tup_updated,
\
sum(tup_deleted) as tup_deleted
\
from pg_stat_database "
out+
=
"
${
NL
}
"
out+
=
"Hint: Query for details per database:
${
NL
}
"
out+
=
"select * from pg_stat_database.
${
NL
}
"
;;
"diskblock"
)
...
...
@@ -284,6 +292,9 @@ case "${sMode}" in
sum(blks_read) as blks_read,
\
sum(blks_hit) as blks_hit
\
from pg_stat_database "
out+
=
"
${
NL
}
"
out+
=
"Hint: Query for details per database:
${
NL
}
"
out+
=
"select * from pg_stat_database.
${
NL
}
"
;;
"problems"
)
...
...
@@ -301,11 +312,13 @@ case "${sMode}" in
typeset
-i
iTotal
;
iTotal
=
$(
echo
"
$out
"
|
awk
'{ sum+=$7} END { print sum;}'
)
if
[
$iTotal
-gt
0
]
;
then
ph.setStatus
"critical"
descr+
=
"...
$iTotal
Problems and troublemakers were found"
descr+
=
"...
$iTotal
(per min)
Problems and troublemakers were found"
else
descr+
=
" ... OK, nothing was found"
fi
descr+
=
" - currently
$iTotal
per
${
deltaunit
}
"
out+
=
"
${
NL
}
"
out+
=
"Hint: Query for details per database:
${
NL
}
"
out+
=
"select * from pg_stat_database.
${
NL
}
"
;;
"replication"
)
...
...
@@ -359,16 +372,24 @@ case "${sMode}" in
out+
=
$(
echo
"
${
_out
}${
NL
}
"
|
tr
'|'
':'
)
out+
=
"
${
NL
}
"
out+
=
"Hint: Query for details per replication:
${
NL
}
"
out+
=
"select * from pg_stat_replication.
${
NL
}
"
fi
;;
"transactions"
)
descr
=
"Count of transactions over all databases
(from pg_stat_database)
"
descr
=
"Count of transactions over all databases"
renderCounters
"select
\
sum(xact_commit) as commit,
\
sum(xact_rollback) as rollback
\
from pg_stat_database "
;;
out+
=
"
${
NL
}
"
out+
=
"Hint: Query for details per database:
${
NL
}
"
out+
=
"select * from pg_stat_database.
${
NL
}
"
;;
*
)
echo
ERRROR:
[
${
sMode
}
]
is an INVALID mode
...
...
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