Prometheus exporter for Hikvision NVR devices.
- HDD SMART health, temperature, and power-on days
- Camera status and camera information
- CPU, memory, and uptime metrics
- Support for multiple NVRs in one exporter
- Configuration via YAML files or CLI flags
- Go 1.26+
- Access to a Hikvision NVR API
git clone https://github.com/KatowProject/nvrhikvision-exporter.git
cd nvrhikvision-exportermake buildOn Windows, the same command works as well:
make buildLinux/macOS:
bash ./scripts/build.sh 1.0.0 allWindows PowerShell:
.\scripts\build.ps1 -Version "1.0.0" -Target "all"Windows CMD:
scripts\build.bat 1.0.0 allbash ./scripts/build.sh 1.0.0 linux/amd64
bash ./scripts/build.sh 1.0.0 linux/arm64
bash ./scripts/build.sh 1.0.0 darwin/arm64Create a config.yaml file:
nvrs:
- ip: "192.168.1.2"
username: "admin1"
password: "cctv12345"
name: "NVR-1"
- ip: "192.168.1.3"
username: "admin2"
password: "cctv123"
name: "NVR-2"
server:
port: "9102"Run the exporter:
make runLegacy single-NVR mode is still supported:
./dist/nvrhikvision-exporter -ip=192.168.1.3 -user=your-user -pass=your-pass -port=9102hikvision_hdd_health_percenthikvision_hdd_temperature_celsiushikvision_hdd_power_on_dayshikvision_hdd_statushikvision_hdd_smart_attributehikvision_hdd_smart_normalized
hikvision_camera_statushikvision_camera_info
hikvision_cpu_usage_percenthikvision_memory_usage_percenthikvision_uptime_seconds
make build
make build-all
make build-linux
make build-windows
make build-darwin
make run
make test
make fmt
make cleanmake docker-build
make docker-run
docker-compose -f deploy/docker-compose.yml upIf you want the exporter to start automatically and keep running in the background, you can install it as a service.
NSSM (Non-Sucking Service Manager) is a simple way to run the exporter as a Windows service.
- Build the Windows binary:
make build-windows- Prepare a
config.yamlfile, for example:
nvrs:
- ip: "192.168.1.2"
username: "admin1"
password: "cctv12345"
name: "NVR-1"
- ip: "192.168.1.3"
username: "admin2"
password: "cctv123"
name: "NVR-2"
server:
port: "9102"- Install the service with NSSM:
nssm install HikvisionExporter C:\path\to\nvrhikvision-exporter.exe
nssm set HikvisionExporter AppDirectory C:\path\to
nssm set HikvisionExporter AppParameters -config=config.yaml
nssm start HikvisionExporterIf you want to manage the service from Windows Services, run NSSM as Administrator. You can also configure stdout/stderr logs from the NSSM GUI if needed.
On Linux, systemd is the recommended way to run the exporter as a daemon.
-
Build or copy the Linux binary to a fixed location, for example
/usr/local/bin/nvrhikvision-exporter. -
Put your
config.yamlin a stable directory such as/etc/nvrhikvision-exporter/config.yaml. -
Create a service file, for example
/etc/systemd/system/nvrhikvision-exporter.service:
[Unit]
Description=Hikvision NVR Exporter
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
ExecStart=/usr/local/bin/nvrhikvision-exporter -config=/etc/nvrhikvision-exporter/config.yaml
WorkingDirectory=/etc/nvrhikvision-exporter
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target- Reload
systemd, enable the service, and start it:
sudo systemctl daemon-reload
sudo systemctl enable --now nvrhikvision-exporter
sudo systemctl status nvrhikvision-exporter- View logs if needed:
journalctl -u nvrhikvision-exporter -f- Make sure the NVR is reachable from the exporter host
- Verify the username and password
- Check the logs if metrics do not appear
MIT