Fogflow system health can be monitored by system monitoring tools Metricbeat, Elasticsearch and Grafana in short EMG. With these tools edges and Fogflow Docker service health can be monitored. Metricbeat deployed on Edge node. Elasticsearch and Grafana on Cloud node.
As illustrated in following picture, set up System Monitoring tools to monitor system resource usage.
9.1. Set up Monitoring components on Cloud node¶
9.1.1. Fetch all required scripts¶
Download the docker-compose file and the configuration files as below.
# the docker-compose file to start all Monitoring components on the cloud node wget https://raw.githubusercontent.com/smartfog/fogflow/master/docker/core/http/grafana/docker-compose.yml # the configuration file used by Grafana wget https://raw.githubusercontent.com/smartfog/fogflow/master/docker/core/http/grafana/grafana.yaml # the configuration file used by metric beat wget https://raw.githubusercontent.com/smartfog/fogflow/master/docker/core/http/grafana/metricbeat.docker.yml # JSON files to configure grafana dashboard wget https://raw.githubusercontent.com/smartfog/fogflow/master/docker/core/http/grafana/dashboards.zip
install unzip tool on system to extract JSON files from dashboards.zip
#command to install unzip in ubuntu apt-get install unzip #command to unzip the file dashboards.zip unzip dashboards.zip
It is supposed that FogFlow cloud components are in running state before setting up system monitoring.
9.1.2. Start all Monitoring components¶
docker-compose up -d #Check all the containers are Up and Running using "docker ps -a" docker ps -a
9.2. Configure Elasticsearch on Grafana Dashboard¶
Grafana dashboard can be accessible on web browser via the URL: http://<Cloud_Public_IP>:3003/. The default username and password for Grafana login are admin and admin respectively.
- After successful login to grafana, click on “Add data source” in Home Dashboard to setup the source of data.
- Select Elasticsearch from Add Data Source page. Now the new page is Data Sources/Elasticsearch same as below figure.
- Put a name for the Data Source i.e. “Elasticsearch”.
- In HTTP detail ,mention URL of your elasticsearch and Port. URL shall include HTTP for eg: “http://192.168.100.112:9200”
- In Access select “Server(default)”. URL needs to be accessible from the Grafana backend/server.
- In Elasticsearch details, put “@timestamp” for Time field name.
- Select Elasticsearch Version i.e. “7.0+”.
Then click on “Save & Test” button.
On successful configuration the dashboard will return “Index OK. Time field name OK.”
9.3. Grafana-based monitoring¶
Grafana based system metrics can be seen on grafana dashboard. Follow the steps:
- In the sidebar, take the cursor over Dashboards (squares) icon.
- click Manage.
- The dashboard appears in a Services folder.
Select particular dashboard to see the corresponding monitoring metrics.
- Below dashboard diagram for containers list with maximum memory usage.
- Below dashboard diagram to show system memory used in bytes on cloud node.
- Below dashboard diagram to show system metric data rate in packet per second on cloud node.
- Below dashboard diagram to show FogFlow Cloud node that are live.
Before proceeding please clear the browser cache, browser might saves some information from websites in its cache and cookies. Clearing them fixes certain problems, like loading or formatting issues on sites.
9.3.1. Set up Metricbeat on Edge node¶
Download the metricbeat yml file for edge node.
# the configuration file used by metric beat wget https://raw.githubusercontent.com/smartfog/fogflow/master/docker/core/http/grafana/metricbeat.docker.yml
Optional Edit “name” in metricbeat.docker.yml file to add particular name for better identification of edge node.
Copy below Docker run command, edit and replace <Cloud_Public_IP> with IP/URL of elasticsearch in output.elasticsearch.hosts=[“<Cloud_Public_IP>:9200”]>. This command will deploy metric beat on edge node.
docker run -d --name=metricbeat --user=root --volume="$(pwd)/metricbeat.docker.yml:/usr/share/metricbeat/metricbeat.yml:ro" --volume="/var/run/docker.sock:/var/run/docker.sock:ro" --volume="/sys/fs/cgroup:/hostfs/sys/fs/cgroup:ro" --volume="/proc:/hostfs/proc:ro" --volume="/:/hostfs:ro" docker.elastic.co/beats/metricbeat:7.6.0 metricbeat -e -E output.elasticsearch.hosts=["<Cloud_Public_IP>:9200"]
Metrices for Edge node can be seen on same Grafana dashboard with cloud node metrics via URL: http://<Cloud_Public_IP>:3003/.
- Below dashboard diagram to show system memory used in bytes on cloud as well as on edge node.
- Below dashboard diagram to show system metric data rate in packet per second on cloud as well as on edge node.
- Below dashboard diagram to show FogFlow Cloud and Edge nodes that are live.