Skip to content

Commit 41af389

Browse files
Add README
Co-authored-by: prabhu43 <j.prabhu91@gmail.com>
1 parent b00685e commit 41af389

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# pg-ping
2+
3+
`pg-ping` is a command line utility to continously ping your postgres. This is useful to check if there is downtime when doing changes to your postgres instance.
4+
5+
## Configuration
6+
7+
```bash
8+
export PGPING_USERNAME=your-username
9+
export PGPING_PASSWORD=your-password
10+
export PGPING_HOST=your-host
11+
export PGPING_DBNAME=your-dbname
12+
export PGPING_QUERY=your-query # default is select 1
13+
export PGPING_FREQUENCYINMS=300 # default is 1 second
14+
```
15+
16+
## Usage
17+
18+
```bash
19+
$ pg-ping
20+
{"Value":"1","TimeTakenInMS":0.408563,"Failed":false,"FailureMessage":""}
21+
{"Value":"1","TimeTakenInMS":0.46392500000000003,"Failed":false,"FailureMessage":""}
22+
{"Value":"","TimeTakenInMS":0.634099,"Failed":true,"FailureMessage":"dial tcp 10.134.125.111:5432: connect: connection refused"} # Downtime
23+
{"Value":"","TimeTakenInMS":0.402107,"Failed":true,"FailureMessage":"dial tcp 10.134.125.111:5432: connect: connection refused"}
24+
{"Value":"1","TimeTakenInMS":10.726904000000001,"Failed":false,"FailureMessage":""}
25+
{"Value":"1","TimeTakenInMS":0.372709,"Failed":false,"FailureMessage":""}
26+
{"Value":"1","TimeTakenInMS":0.429533,"Failed":false,"FailureMessage":""}
27+
```
28+
29+
## Build
30+
31+
```
32+
go build -o pg-ping main.go
33+
```

0 commit comments

Comments
 (0)