Added systemd config
This commit is contained in:
@@ -154,6 +154,44 @@ Run the monitoring loop to continuously push data:
|
||||
./monitor_loop.sh "London" 60 "http://10.0.0.5:8428"
|
||||
```
|
||||
|
||||
### Systemd Service (Autostart on Boot)
|
||||
|
||||
To run the monitor automatically as a system service:
|
||||
|
||||
1. **Install the service:**
|
||||
```bash
|
||||
sudo cp nationalgrid-monitor.service /etc/systemd/system/
|
||||
sudo systemctl daemon-reload
|
||||
```
|
||||
|
||||
2. **Customize settings (optional):**
|
||||
Edit `/etc/systemd/system/nationalgrid-monitor.service` and modify the `ExecStart` line to change:
|
||||
- GSP name (default: "Bishops Wood")
|
||||
- Update interval in seconds (default: 60)
|
||||
- VictoriaMetrics URL (default: http://localhost:8428)
|
||||
|
||||
3. **Enable and start the service:**
|
||||
```bash
|
||||
sudo systemctl enable nationalgrid-monitor.service
|
||||
sudo systemctl start nationalgrid-monitor.service
|
||||
```
|
||||
|
||||
4. **Check service status:**
|
||||
```bash
|
||||
sudo systemctl status nationalgrid-monitor.service
|
||||
```
|
||||
|
||||
5. **View logs:**
|
||||
```bash
|
||||
sudo journalctl -u nationalgrid-monitor.service -f
|
||||
```
|
||||
|
||||
6. **Stop or disable:**
|
||||
```bash
|
||||
sudo systemctl stop nationalgrid-monitor.service
|
||||
sudo systemctl disable nationalgrid-monitor.service
|
||||
```
|
||||
|
||||
## Grafana Integration
|
||||
|
||||
Once metrics are in VictoriaMetrics:
|
||||
|
||||
Reference in New Issue
Block a user