Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
fd0fc4b
Added initial support other OS
Jul 2, 2025
51cb1c8
Modernize fix
Jul 2, 2025
f8ee4d7
Fixed filesystem test
Jul 2, 2025
a89d573
Update README
Jul 2, 2025
7561dcb
Added netdev stats
Jul 2, 2025
3b19bf2
Merge branch 'master' into dev-support-other-os
Jul 7, 2025
114f60b
Merge branch 'master' into dev-support-other-os
Jul 11, 2025
d63f813
Update golang
Jul 11, 2025
851a9dc
Merge branch 'master' into dev-support-other-os
Jul 31, 2025
5dfa096
Merge branch 'master' into dev-support-other-os
Aug 1, 2025
bbe6c7c
Update go module
Aug 1, 2025
3393f93
Merge branch 'master' into dev-support-other-os
Aug 27, 2025
128cb87
Merge branch 'master' into dev-support-other-os
Sep 1, 2025
ad9e0e8
Fixed memory stat
Sep 1, 2025
e4ec806
Fixed uptime metrics
Sep 1, 2025
729e048
Merge branch 'master' into dev-support-other-os
Sep 16, 2025
27a5d61
Update go module
Sep 16, 2025
b71bd0a
Merge branch 'master' into dev-support-other-os
Sep 30, 2025
9da0100
Fixed get log path from Windows
Sep 30, 2025
af0e721
Merge branch 'master' into dev-support-other-os
Sep 30, 2025
d808d81
Merge branch 'master' into dev-support-other-os
Sep 30, 2025
b81d0a5
Merge branch 'master' into dev-support-other-os
Nov 1, 2025
0d48e4c
Update go module
Nov 1, 2025
840f3b9
Merge branch 'master' into dev-support-other-os
Nov 20, 2025
7d0f262
Update go modules
Nov 20, 2025
5068628
Merge branch 'master' into dev-support-other-os
Nov 20, 2025
ccfc134
Update go module
Nov 21, 2025
d8c2db3
Merge branch 'master' into dev-support-other-os
Nov 21, 2025
93e79f3
Update go modules
Dec 19, 2025
2870906
Merge branch 'master' into dev-support-other-os
Dec 19, 2025
7d9cd58
Update go modules
Dec 19, 2025
9df44ec
Merge branch 'master' into dev-support-other-os
Dec 30, 2025
207a111
Merge branch 'master' into dev-support-other-os
Dec 30, 2025
4b40423
Implemented cross-platform getMountpoints/parseMounts
Dec 30, 2025
853150e
Fixed tests
Dec 30, 2025
00097ed
Merge branch 'master' into dev-support-other-os
Jan 13, 2026
903baba
Merge branch 'master' into dev-support-other-os
Jan 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ builds:
- arm
goos:
- linux
# - windows
# - freebsd
# - darwin
#ignore:
- windows
- freebsd
- darwin
ignore:
- goarch: '386'
goos: windows
# - goarch: arm
# goos: windows
# - goarch: arm64
Expand Down
15 changes: 11 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
DOCKER_ACCOUNT = cherts
APPNAME = pgscv
APPOS = linux
#APPOS = ${GOOS}
APPOS=${GOOS}

OS_NAME := $(shell uname -s | tr A-Z a-z)

ifneq (,$(findstring msys,$(OS_NAME)))
APPEXT=.exe
else
APPEXT=
endif

TAG_COMMIT := $(shell git rev-list --abbrev-commit --tags --max-count=1)
TAG := $(shell git describe --abbrev=0 --tags ${TAG_COMMIT} 2>/dev/null || true)
Expand Down Expand Up @@ -43,7 +50,7 @@ help: ## Display this help screen
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " * \033[36m%-25s\033[0m %s\n", $$1, $$2}'

clean: ## Clean
rm -f ./bin/${APPNAME} ./bin/${APPNAME}.tar.gz ./bin/${APPNAME}.version ./bin/${APPNAME}.sha256
rm -f ./bin/${APPNAME}${APPEXT} ./bin/${APPNAME}.tar.gz ./bin/${APPNAME}.version ./bin/${APPNAME}.sha256
rm -rf ./bin

go-update: ## Update go mod
Expand Down Expand Up @@ -71,7 +78,7 @@ race: dep ## Run data race detector

build: dep ## Build
mkdir -p ./bin
CGO_ENABLED=0 GOOS=${APPOS} GOARCH=${GOARCH} go build ${LDFLAGS} -o bin/${APPNAME} ./cmd
CGO_ENABLED=0 GOOS=${APPOS} GOARCH=${GOARCH} go build ${LDFLAGS} -o bin/${APPNAME}${APPEXT} ./cmd

build-beta: dep ## Build beta
mkdir -p ./bin
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ This project is a continuation of the development of the original pgSCV by [Alex

### Features
- **Supported services:** support collecting metrics of PostgreSQL, Pgbouncer and Patroni.
- **OS metrics:** support collecting metrics of operating system (only Linux).
- **OS metrics:** support collecting metrics of operating system (Linux, Windows, MacOS, FreeBSD).
- **Discovery and monitoring Cloud Managed Databases:** Yandex Managed Service for PostgreSQL ([see documentation](https://github.com/cherts/pgscv/wiki/Monitoring-Cloud-Managed-Databases)).
- **Support Prometheus service discovery.** `/targets` endpoint is used to discover all monitoring services ([see documentation](https://github.com/cherts/pgscv/wiki/Service-discovery))
- **Concurrency limitting support** It is possible to limit the parallel collection of monitoring data from the database to control the load created by the exporter. ([see documentatio](https://github.com/cherts/pgscv/wiki/Concurrency)).
Expand All @@ -30,7 +30,8 @@ This project is a continuation of the development of the original pgSCV by [Alex
block devices, network interfaces, filesystems, users, databases, etc.

### Requirements
- Can run on Linux only; can connect to remote services running on other OS/PaaS.
- Can run on Linux, Windows, MacOS, FreeBSD only.
- Can connect to remote services running on other OS/PaaS.
- Requisites for connecting to the services, such as login and password.
- Database user should have privileges for executing stats functions and reading views.
For more details see [security considerations](https://github.com/cherts/pgscv/wiki/Security-considerations).
Expand All @@ -39,7 +40,7 @@ This project is a continuation of the development of the original pgSCV by [Alex
Download the archive from [releases](https://github.com/cherts/pgscv/releases). Unpack the archive. Create minimum config file. Start pgSCV systemd service under `postgres` user.

```bash
curl -s -L https://github.com/cherts/pgscv/releases/download/v1.0.0/pgscv_1.0.0_linux_$(uname -m).tar.gz -o - | tar xzf - -C /tmp && \
curl -s -L https://github.com/cherts/pgscv/releases/download/v1.0.0/pgscv_1.0.0_$(uname -s | tr A-Z a-z)_$(uname -m).tar.gz -o - | tar xzf - -C /tmp && \
mv /tmp/pgscv.yaml /etc && \
mv /tmp/pgscv.service /etc/systemd/system && \
mv /tmp/pgscv.default /etc/default/pgscv && \
Expand Down
6 changes: 3 additions & 3 deletions README.ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

### Основные возможности
- **Поддерживаемые сервисы**: поддержка сбора показателей работы PostgreSQL, Pgbouncer и Patroni;
- **Метрики ОС:** поддержка сбора показателей работы операционной системы (только Linux);
- **Метрики ОС:** поддержка сбора показателей работы операционной системы (Linux, Windows, MacOS, FreeBSD);
- **Обнаружение и мониторинг Облачных управляемых баз данных** Yandex Managed Service for PostgreSQL ([смотри документацию](https://github.com/cherts/pgscv/wiki/Monitoring-Cloud-Managed-Databases));
- **Поддержка обнаружения сервисов мониторинга** Через специальный эндпойнт `/targets` можно производить обнаружение всех сервисов мониторинга ([смотри документацию](https://github.com/cherts/pgscv/wiki/Service-discovery))
- **Поддержка контроля параллелизма** Можно ограничить возможности параллельного сбора данных мониторинга из базы данных для контроля нагрузки создаваемой экспортером ([смотри документацию](https://github.com/cherts/pgscv/wiki/Concurrency)).
Expand All @@ -22,7 +22,7 @@
- **Коллекторные фильтры**: Коллекторы можно настроить так, чтобы они пропускали сбор метрик на основе значений меток, например блочные устройства, сетевые интерфейсы, файловые системы, пользователи, базы данных и т.д.;

### Системные требования:
- Может работать только в ОС Linux;
- Может работать только в ОС Linux, Windows, MacOS, FreeBSD;
- Может подключаться к удаленным сервисам, работающим на другой ОС/PaaS;
- Необходимы данные для подключения к сервисам/базам, такие как адрес, логин и пароль;
- Пользователь базы данных должен иметь права на выполнение статистических функций и чтение представлений.
Expand All @@ -32,7 +32,7 @@
Загрузите архив со страницы [releases](https://github.com/cherts/pgscv/releases). Распакуйте архив. Создайте минимальный файл конфигураации. Запустите pgSCV под пользователем postgres.

```bash
curl -s -L https://github.com/cherts/pgscv/releases/download/v1.0.0/pgscv_1.0.0_linux_$(uname -m).tar.gz -o - | tar xzf - -C /tmp && \
curl -s -L https://github.com/cherts/pgscv/releases/download/v1.0.0/pgscv_1.0.0_$(uname -s | tr A-Z a-z)_$(uname -m).tar.gz -o - | tar xzf - -C /tmp && \
mv /tmp/pgscv.yaml /etc && \
mv /tmp/pgscv.service /etc/systemd/system && \
mv /tmp/pgscv.default /etc/default/pgscv && \
Expand Down
12 changes: 6 additions & 6 deletions deploy/demo-lab/grafana/dashboards/pgSCV_System.json
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@
"uid": "DS_VM_01"
},
"exemplar": false,
"expr": "node_memory_MemFree{instance=\"$instance\"} + node_memory_Cached{instance=\"$instance\"} + node_memory_Buffers{instance=\"$instance\"}",
"expr": "node_memory_available{instance=\"$instance\"}",
"instant": false,
"interval": "",
"legendFormat": "",
Expand Down Expand Up @@ -707,7 +707,7 @@
"uid": "DS_VM_01"
},
"editorMode": "code",
"expr": "sum by (device) (rate(node_disk_io_time_seconds_total{instance=\"$instance\"}[1m])) / on() group_left() rate(node_uptime_up_seconds_total{instance=\"$instance\"}[1m]) * 100",
"expr": "sum by (device) (rate(node_disk_io_time_seconds_total{instance=\"$instance\"}[1m])) / on() group_left() rate(node_uptime_seconds{instance=\"$instance\"}[1m]) * 100",
"instant": false,
"legendFormat": "__auto",
"range": true,
Expand Down Expand Up @@ -874,7 +874,7 @@
"uid": "DS_VM_01"
},
"exemplar": true,
"expr": "avg_over_time(node_memory_MemFree{instance=\"$instance\"}[1m])",
"expr": "avg_over_time(node_memory_free{instance=\"$instance\"}[1m])",
"interval": "",
"legendFormat": "free",
"refId": "A"
Expand All @@ -885,7 +885,7 @@
"uid": "${ds}"
},
"exemplar": true,
"expr": "avg_over_time(node_memory_Buffers{instance=\"$instance\"}[1m])",
"expr": "avg_over_time(node_memory_buffers{instance=\"$instance\"}[1m])",
"hide": false,
"interval": "",
"legendFormat": "buffers",
Expand All @@ -897,7 +897,7 @@
"uid": "DS_VM_01"
},
"exemplar": true,
"expr": "avg_over_time(node_memory_Cached{instance=\"$instance\"}[1m])",
"expr": "avg_over_time(node_memory_cached{instance=\"$instance\"}[1m])",
"hide": false,
"interval": "",
"legendFormat": "cached",
Expand All @@ -910,7 +910,7 @@
},
"editorMode": "code",
"exemplar": true,
"expr": "avg_over_time(node_memory_MemUsed{instance=\"$instance\"}[1m])",
"expr": "avg_over_time(node_memory_used{instance=\"$instance\"}[1m])",
"hide": false,
"interval": "",
"legendFormat": "used",
Expand Down
12 changes: 6 additions & 6 deletions deploy/grafana/pgSCV_System.json
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@
"uid": "${DS_VICTORIAMETRICS-PGSCV}"
},
"exemplar": false,
"expr": "node_memory_MemFree{instance=\"$instance\"} + node_memory_Cached{instance=\"$instance\"} + node_memory_Buffers{instance=\"$instance\"}",
"expr": "node_memory_available{instance=\"$instance\"}",
"instant": false,
"interval": "",
"legendFormat": "",
Expand Down Expand Up @@ -750,7 +750,7 @@
"uid": "${DS_VICTORIAMETRICS-PGSCV}"
},
"editorMode": "code",
"expr": "sum by (device) (rate(node_disk_io_time_seconds_total{instance=\"$instance\"}[1m])) / on() group_left() rate(node_uptime_up_seconds_total{instance=\"$instance\"}[1m]) * 100",
"expr": "sum by (device) (rate(node_disk_io_time_seconds_total{instance=\"$instance\"}[1m])) / on() group_left() rate(node_uptime_seconds{instance=\"$instance\"}[1m]) * 100",
"instant": false,
"legendFormat": "__auto",
"range": true,
Expand Down Expand Up @@ -917,7 +917,7 @@
"uid": "${DS_VICTORIAMETRICS-PGSCV}"
},
"exemplar": true,
"expr": "avg_over_time(node_memory_MemFree{instance=\"$instance\"}[1m])",
"expr": "avg_over_time(node_memory_free{instance=\"$instance\"}[1m])",
"interval": "",
"legendFormat": "free",
"refId": "A"
Expand All @@ -928,7 +928,7 @@
"uid": "${ds}"
},
"exemplar": true,
"expr": "avg_over_time(node_memory_Buffers{instance=\"$instance\"}[1m])",
"expr": "avg_over_time(node_memory_buffers{instance=\"$instance\"}[1m])",
"hide": false,
"interval": "",
"legendFormat": "buffers",
Expand All @@ -940,7 +940,7 @@
"uid": "${DS_VICTORIAMETRICS-PGSCV}"
},
"exemplar": true,
"expr": "avg_over_time(node_memory_Cached{instance=\"$instance\"}[1m])",
"expr": "avg_over_time(node_memory_cached{instance=\"$instance\"}[1m])",
"hide": false,
"interval": "",
"legendFormat": "cached",
Expand All @@ -953,7 +953,7 @@
},
"editorMode": "code",
"exemplar": true,
"expr": "avg_over_time(node_memory_MemUsed{instance=\"$instance\"}[1m])",
"expr": "avg_over_time(node_memory_used{instance=\"$instance\"}[1m])",
"hide": false,
"interval": "",
"legendFormat": "used",
Expand Down
9 changes: 9 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ require (
gopkg.in/yaml.v2 v2.4.0
)

require github.com/shirou/gopsutil/v4 v4.25.11

require (
github.com/bradfitz/gomemcache v0.0.0-20250403215159-8d39553ac7cf
github.com/go-playground/validator/v10 v10.30.1
Expand All @@ -28,9 +30,11 @@ require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/ebitengine/purego v0.9.1 // indirect
github.com/fsnotify/fsnotify v1.9.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.12 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/golang-jwt/jwt/v4 v4.5.2 // indirect
Expand All @@ -41,14 +45,19 @@ require (
github.com/jackc/puddle/v2 v2.2.2 // indirect
github.com/kr/text v0.1.0 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/lufia/plan9stats v0.0.0-20251013123823-9fd1530e3ec3 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
github.com/prometheus/client_model v0.6.2 // indirect
github.com/prometheus/common v0.67.5 // indirect
github.com/prometheus/procfs v0.19.2 // indirect
github.com/tklauser/go-sysconf v0.3.16 // indirect
github.com/tklauser/numcpus v0.11.0 // indirect
github.com/xhit/go-str2duration/v2 v2.1.0 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
go.yaml.in/yaml/v2 v2.4.3 // indirect
golang.org/x/sync v0.19.0 // indirect
golang.org/x/text v0.33.0 // indirect
Expand Down
Loading
Loading