---
# System prepended metadata

title: '安裝 NeuVector Monitor '
tags: [工具]

---

# 安裝 NeuVector Monitor 


## 實作
* 在 Rancher 需先安裝好 Neuvector & Monitoring 工具。
* NeuVector Monitor 預設要更改 svc 名稱，參考 https://www.suse.com/support/kb/doc/?id=000021217
* `CTRL_PASSWORD`，`CTRL_PASSWORD` 需要輸入 NV 帳號密碼
* 如果要監控 enforcer，enforcerStats.enabled 可以開啟
![image](https://hackmd.io/_uploads/B1fiDcikye.png)
* 開啟 serviceMonitor
![image](https://hackmd.io/_uploads/H1abRAoQ1x.png)
* 保存等待部屬完後檢查，檢查已創建 pod & servicemonitor 
```
$ kubectl -n cattle-neuvector-system get po -l app=neuvector-prometheus-exporter-pod
NAME                                                 READY   STATUS    RESTARTS      AGE
neuvector-prometheus-exporter-pod-64bf756454-xnmn8   1/1     Running   7 (12d ago)   20d


$ kubectl -n cattle-neuvector-system get servicemonitor
NAME                            AGE
neuvector-prometheus-exporter   50s
```

* 透過 Rancher UI 進到 Prometheus Targets，搜尋 ServiceMonitor 名稱 `neuvector-prometheus-exporter`

![image](https://hackmd.io/_uploads/BJEx1yh7ke.png)

* 在 Metrics Explorer 可以抓到 `nv_` 開頭的所有指標

![image](https://hackmd.io/_uploads/ryB4JknQyl.png)

* 下載 nv_dashboard.json，並將其匯入到 grafana
* 登入 grafana
> 帳號: admin
> 密碼: prom-operator
```
$ wget https://raw.githubusercontent.com/neuvector/prometheus-exporter/refs/heads/master/nv_dashboard.json
```
* 選擇 import dashboard，將剛剛下載的 nv_dashboard.json 匯入

![image](https://hackmd.io/_uploads/HyiasCi7yx.png)

* 在 NV-dashboard 可以看到 Neuvector 相關指標

![image](https://hackmd.io/_uploads/B1Aw1e3QJe.png)


## 參考

https://github.com/neuvector/prometheus-exporter

https://github.com/rancher/charts/blob/dev-v2.10/charts/neuvector-monitor/104.0.0%2Bup2.7.7/values.yaml