postgresql_replication_monitor
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
postgresql_replication_monitor [2011/07/12 16:22] – k2patel | postgresql_replication_monitor [2020/08/10 02:35] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 3: | Line 3: | ||
<code bash> | <code bash> | ||
#!/bin/bash | #!/bin/bash | ||
+ | # --------------- | ||
+ | #< By k2patel > | ||
+ | # ---------------- | ||
+ | # \ ^__^ | ||
+ | # | ||
+ | # (__)\ )\/\ | ||
+ | # ||----w | | ||
+ | # || || | ||
+ | # | ||
############################# | ############################# | ||
# Requirement Specification | # Requirement Specification | ||
Line 34: | Line 43: | ||
## Psql / bc Location | ## Psql / bc Location | ||
- | export psql=/usr/local/pg-9.0.3/bin/psql | + | export psql=/usr/pgsql-9.0/ |
export bc=/ | export bc=/ | ||
## Delay Limit | ## Delay Limit | ||
- | export dlylmt=100000 | + | export dlylmt=1000000 |
+ | export wrnlmt=100000 | ||
+ | |||
+ | |||
+ | ########################### | ||
+ | ## Customization End here | ||
+ | ########################### | ||
## Results in codes | ## Results in codes | ||
- | prime_num=$($psql -t -c " | + | prime_num=$($psql |
- | sec_num=$($psql -t -c " | + | sec_num=$($psql |
- | thr_num=$($psql -t -c " | + | thr_num=$($psql |
pr_num=$(echo $prime_num | awk -F / ' | pr_num=$(echo $prime_num | awk -F / ' | ||
sr_num=$(echo $sec_num | awk -F / ' | sr_num=$(echo $sec_num | awk -F / ' | ||
tr_num=$(echo $thr_num | awk -F / ' | tr_num=$(echo $thr_num | awk -F / ' | ||
+ | # | ||
pr_int_num=$(echo " | pr_int_num=$(echo " | ||
Line 54: | Line 70: | ||
tr_int_num=$(echo " | tr_int_num=$(echo " | ||
- | echo "Prime $pr_int_num" | ||
- | echo "Secon $sr_int_num" | ||
- | echo "thrir $tr_int_num" | ||
- | ########################### | + | #echo "Prime $pr_int_num" |
- | ## Customization End here | + | #echo "Secon $sr_int_num" |
- | ########################### | + | #echo "thrir $tr_int_num" |
+ | if [[ $pr_int_num -eq '' | ||
+ | echo " | ||
+ | exit $STATE_CRITICAL | ||
+ | else | ||
if [[ $pr_int_num -eq $sr_int_num && $pr_int_num -eq $tr_int_num && $sr_int_num -eq $tr_int_num ]] ; then | if [[ $pr_int_num -eq $sr_int_num && $pr_int_num -eq $tr_int_num && $sr_int_num -eq $tr_int_num ]] ; then | ||
echo " | echo " | ||
Line 69: | Line 86: | ||
if [[ $pr_int_num -eq $sr_int_num ]] ; then | if [[ $pr_int_num -eq $sr_int_num ]] ; then | ||
if [[ $pr_int_num -ne $tr_int_num ]] ; then | if [[ $pr_int_num -ne $tr_int_num ]] ; then | ||
+ | if [ $(bc <<< | ||
+ | echo " | ||
+ | exit $STATE_OK | ||
+ | else | ||
echo " | echo " | ||
exit $STATE_WARNING | exit $STATE_WARNING | ||
+ | fi | ||
fi | fi | ||
else | else | ||
- | | + | # echo $(bc <<< |
+ | | ||
echo " | echo " | ||
exit $STATE_CRITICAL | exit $STATE_CRITICAL | ||
+ | else | ||
+ | if [ $(bc <<< | ||
+ | echo " | ||
+ | exit $STATE_OK | ||
else | else | ||
echo " | echo " | ||
+ | #echo " | ||
+ | #echo " | ||
exit $STATE_WARNING | exit $STATE_WARNING | ||
+ | fi | ||
fi | fi | ||
fi | fi | ||
Line 84: | Line 114: | ||
exit $STATE_UNKNOWN | exit $STATE_UNKNOWN | ||
fi | fi | ||
+ | |||
+ | fi | ||
+ | |||
</ | </ |
postgresql_replication_monitor.1310487741.txt.gz · Last modified: 2020/08/10 02:29 (external edit)