Weather Monitoring in Grafana

    In this article, we will talk about how to derive for monitoring the necessary system indicators on graphs, without writing a single line of code. The software used is distributed freely except for the database server - it is an MS SQL server deployed in the MS Azure cloud service, which you can easily replace with any other.

    The weather station takes temperature and humidity indicators and sends them in real time to the MS Azure server, which puts this data in the database. Thus, a certain time series is generated, which is proposed to be monitored using Grafana and displayed on the administrator’s dashboard.



    The task of the weather station is not considered in this article, we will analyze the received data, for this we will use FastReport.




    This is how it is stored in the database.



    Download from grafana.com and install the Grafana server, then connect to the database with the data.



    Next, we build a query to reflect the temperature time series:

    SELECT 
      regdate as time, 
      Temperature as value, 
      'Temperature' as metric 
    FROM weather 
    WHERE $__timeFilter(regdate) 
    ORDER BY regdate ASC 
    

    At the beginning of the article it was said that there was no need to program, this is really so because the proposed sample request is generated by the system itself. On the one hand, you don’t need to program anything, and on the other hand, to quickly build complex queries, it’s easy to modify the query and “explain” to the system what language it needs to build.



    A similar query is built for humidity and saved as a dashboard:



    In live it looks like this


    The observant reader will immediately notice the unnatural behavior of the humidity sensor in the upper graph:



    This makes it easy to determine the moment at which the sensor malfunctioned or completely broke. The Grafana system allows you to track such situations using alerts, while finding the moment in the database table is much more labor-intensive.



    The considered approach allows you to quickly build monitoring of various indicators, the system allows you to connect various plug-ins with predefined metrics and graph forms that can satisfy any needs.

    Also popular now: