c75370fe |
1 | #!/bin/bash |
2 | |
3 | LASTDBUPDATE=`cat /var/www/lastdbupdate.txt` |
4 | |
21648955 |
5 | TS2=`date '+%s' --utc "--date=$LASTDBUPDATE"` |
c75370fe |
6 | TS1=`date '+%s'` |
7 | |
8 | if [ "$1" = "autoconf" ]; then |
11748e65 |
9 | echo No |
c75370fe |
10 | exit 0 |
11 | fi |
12 | |
13 | if [ "$1" = "config" ]; then |
14 | echo 'graph_title databaselag' |
15 | echo 'graph_args --lower-limit 0 ' |
16 | echo 'graph_vlabel Seconds our DB copy is lagging behind the official DB' |
17 | echo 'graph_category postgresql' |
11748e65 |
18 | echo 'dblag.label databaselag' |
19 | echo 'dblag.type GAUGE' |
20 | echo 'dblag.warning 3600' |
21 | echo 'dblag.critical 86400' |
22 | exit 0 |
c75370fe |
23 | fi |
24 | |
c75370fe |
25 | let "DELAY=TS1-TS2" |
26 | echo "dblag.value $DELAY" |
27 | |