Show HN: pg_netstat, a Postgres extension to monitor database network traffic
github.com
Show HN: pg_netstat, a Postgres extension to monitor database network traffic
1–10 of 26 posts
Re: Show HN: pg_netstat, a Postgres extension to monitor database network traffic
#2At that point you have root and can use any of the dozen estabilished ways to do the same thing tho ?
Re: Show HN: pg_netstat, a Postgres extension to monitor database network traffic
#3I have spent some time to search for a tool that can ingest realtime network traffic data to Postgres but have no luck, so I developed this extension and used it internally in our team. Thanks Rust, pgx and libpcap, the development journey is easy and enjoyable.
Would like to hear more feedbacks. Any contributions, feature requests, bug report or ideas are welcomed.
Thanks.
Re: Show HN: pg_netstat, a Postgres extension to monitor database network traffic
#4> Before install this extension, you need to give network packet capture permission to Postgres binary. At that point you have root and can use any of the dozen estabilished ways to do the same thing tho ?
Re: Show HN: pg_netstat, a Postgres extension to monitor database network traffic
#5> Before install this extension, you need to give network packet capture permission to Postgres binary. At that point you have root and can use any of the dozen estabilished ways to do the same thing tho ?
Re: Show HN: pg_netstat, a Postgres extension to monitor database network traffic
#6 table inet raw {
...
counter postgre_tcp_traffic_out {
packets 0 bytes 0
}
...
chain output {
...
meta l4proto tcp skuid postgres counter name "postgre_tcp_traffic_out" notrack
...
}
}
and then view it like this: nft -j list counters | jq '.'
...
"counter": {
"family": "inet",
"name": "postgre_tcp_traffic_out",
"table": "raw",
"handle": 20,
"packets": 255,
"bytes": 17694
}
...
Since nft -j outputs JSON it can easily then be ingested back into Postgres and indexed. I personally use it together with zabbix to count per second differences in values. It needs some more work because netfilter can match packets by UID/GID only for output, input then has to be matched by destination port, 5432 in case of postgres.Re: Show HN: pg_netstat, a Postgres extension to monitor database network traffic
#7could achieve something similar a bit different way - by using Linux nftables ( new iptables ) netfilter interface. I have setup like this for measuring used traffic by certain daemons running under specific user: table inet raw { ... counter postgre_tcp_traffic_out { packets 0 bytes 0 } ... chain output { ... meta l4proto tcp skuid postgres counter name "postgre_tcp_traffic_out" notrack ... } } and then view it like…
Re: Show HN: pg_netstat, a Postgres extension to monitor database network traffic
#8> Before install this extension, you need to give network packet capture permission to Postgres binary. At that point you have root and can use any of the dozen estabilished ways to do the same thing tho ?
Do you come to this site looking for old established tech to talk about?
Re: Show HN: pg_netstat, a Postgres extension to monitor database network traffic
#9Hey HN, I have spent some time to search for a tool that can ingest realtime network traffic data to Postgres but have no luck, so I developed this extension and used it internally in our team. Thanks Rust, pgx and libpcap, the development journey is easy and enjoyable. Would like to hear more feedbacks. Any contributions, feature requests, bug report or ideas are welcomed. Thanks.
Re: Show HN: pg_netstat, a Postgres extension to monitor database network traffic
#10Hey HN, I have spent some time to search for a tool that can ingest realtime network traffic data to Postgres but have no luck, so I developed this extension and used it internally in our team. Thanks Rust, pgx and libpcap, the development journey is easy and enjoyable. Would like to hear more feedbacks. Any contributions, feature requests, bug report or ideas are welcomed. Thanks.
I'm curious as to how you're using these stats for monitoring. What kind of insights are you gaining with this, and in what context is it used?