Skip to content

Commit c28ae2d

Browse files
Merge pull request #230032 from DhruvSehgal/dhruvsehgal/update-os-provider-documentation
update OS provider documentation for setting up cron job to start nod…
2 parents 5a0dd6a + 7682ef0 commit c28ae2d

File tree

1 file changed

+43
-2
lines changed

1 file changed

+43
-2
lines changed

articles/sap/monitor/provider-linux.md

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ author: MightySuz
55
ms.service: sap-on-azure
66
ms.subservice: sap-monitor
77
ms.topic: how-to
8-
ms.date: 01/05/2023
8+
ms.date: 03/09/2023
99
ms.author: sujaj
1010
#Customer intent: As a developer, I want to configure a Linux provider so that I can use Azure Monitor for SAP solutions for monitoring.
1111
---
@@ -21,7 +21,7 @@ This content applies to both versions of the service, *Azure Monitor for SAP sol
2121

2222
- An Azure subscription.
2323
- An existing Azure Monitor for SAP solutions resource. To create an Azure Monitor for SAP solutions resource, see the [quickstart for the Azure portal](quickstart-portal.md) or the [quickstart for PowerShell](quickstart-powershell.md).
24-
- Install the [node exporter version 1.3.0](https://prometheus.io/download/#node_exporter) in each SAP host that you want to monitor, either BareMetal or Azure virtual machine (Azure VM). For more information, see [the node exporter GitHub repository](https://github.com/prometheus/node_exporter).
24+
- Install the [node exporter latest version](https://prometheus.io/download/#node_exporter) in each SAP host that you want to monitor, either BareMetal or Azure virtual machine (Azure VM). For more information, see [the node exporter GitHub repository](https://github.com/prometheus/node_exporter).
2525

2626
To install the node exporter on Linux:
2727

@@ -35,6 +35,26 @@ To install the node exporter on Linux:
3535

3636
1. The node exporter now starts collecting data. You can export the data at `http://IP:9100/metrics`.
3737

38+
## Script to setup Node Exporter
39+
40+
```shell
41+
# To get the latest node exporter version from: https://prometheus.io/download/#node_exporter
42+
wget https://github.com/prometheus/node_exporter/releases/download/v*/node_exporter-*.*-amd64.tar.gz
43+
tar xvfz node_exporter-*.*-amd64.tar.gz
44+
if [[ "$(grep '^ID=' /etc/*-release)" == *"rhel"* ]]; then
45+
echo "Open firewall port 9100 on the Linux host"
46+
sudo apt install firewalld -y
47+
systemctl start firewalld
48+
firewall-cmd --zone=public --permanent --add-port 9100/tcp
49+
else
50+
sudo ufw allow 9100/tcp
51+
sudo ufw reload
52+
fi
53+
54+
cd node_exporter-*.*-amd64
55+
nohup ./node_expoprter --web.listen-address=":9100" &
56+
```
57+
3858
## Prerequisites to enable secure communication
3959

4060
To [enable TLS 1.2 or higher](enable-tls-azure-monitor-sap-solutions.md), follow the steps [mentioned here](https://prometheus.io/docs/guides/tls-encryption/)
@@ -74,8 +94,29 @@ When the provider settings validation operation fails with the code ‘Prometheu
7494
1. Try to restart the node exporter agent:
7595
1. Go to the folder where you installed the node exporter (the file name resembles `node_exporter-*.*-amd64`).
7696
1. Run `./node_exporter`.
97+
1. Adding nohup and & to aboe command decouples the node_exporter from linux machine commandline. If not included node_exporter would stop when the commandline is closed.
7798
1. Verify that the Prometheus endpoint is reachable from the subnet that you provided while creating the Azure Monitor for SAP solutions resource.
7899

100+
## Suggestions
101+
102+
### Enabling Node Exporter
103+
104+
1. Run `nohup ./node_exporter &` command to enable node_exporter.
105+
1. Adding nohup and & to aboe command decouples the node_exporter from linux machine commandline. If not included node_exporter would stop when the commandline is closed.
106+
107+
### Setting up cron job to start Node exporter on VM restart
108+
109+
1. If the target virtual machine is restarted/stopped, node exporter is also stopped, and needs to be manually started again to continue monitoring.
110+
1. Run `sudo crontab -e` command to open cron file.
111+
1. Add the command `@reboot cd /path/to/node/exporter && nohup ./node_exporter &` at the end of cron file. This will start node exporter on VM reboot.
112+
113+
```shell
114+
sudo crontab -l > crontab_new
115+
echo "@reboot cd /path/to/node/exporter && nohup ./node_exporter &" >> crontab_new
116+
sudo crontab crontab_new
117+
sudo rm crontab_new
118+
```
119+
79120
## Next steps
80121

81122
> [!div class="nextstepaction"]

0 commit comments

Comments
 (0)