IntroductionĪs read above, Raspberry Pi is a very low-cost computer that comes along with the advantage of portability. It can cost as less as 5$ to a maximum price of 100$ (which is rare). It was first released in 2012 by the Raspberry Pi foundation with the aim to provide easy access to computing education to everyone. It is about the size of an ATM Card and can work as a fully functional computer in certain normal use cases, like working with simple applications, playing low-end games, etc. Loaded: loaded (/home/chris/sensor-metrics.Raspberry Pi is a low-cost pocket computer that is very economical to own. You should see something like this (if everything is working): To find out if everything is running, check the service status with systemctl: sudo systemctl status rvice Now the service is running and set to start on boot. Now you can enable the sensor-metrics service to start on boot and check the status: # Enable and start the rvice Sudo ln -s $(pwd)/rvice /etc/systemd/system/ Link the rvice file to /etc/systemd/system: # Link the rvice file into the Systemd directory Sudo ln -s $(pwd)/sensor-metrics.py /opt/sensor-metrics/ Link (or move, if you prefer) the sensor-metrics.py script to /opt/sensor-metrics/sensor-metrics.py: # Create /opt/sensor-metrics and link the sensor-metrics.py script from the current directory into it This will become the sensor-metrics service. This merely tells systemd to look for a script in /opt/sensor-metrics/sensor-metrics.py, start it, and keep it running. With the script updated to log to the systemd journal, create a systemd service for the sensor-metrics.py script: # /etc/systemd/system/rviceĮxecStart=python3 /opt/sensor-metrics/sensor-metrics.py The format of the data exposed for Prometheus to gather consists of a key (a metric name-that which is being measured) and a value separated by a space: dht22_temperature".format(metrics_port)) So, the application will need to update the target metrics as new sensor data is received. Prometheus will check these text pages, or "targets," at a specified interval, looking for updates to the data. In a nutshell, instrumenting the application for Prometheus requires taking the data from the sensor, labeling it, and serving it as text over HTTP so that Prometheus can find and store the data. This is where Prometheus shines as a time-series database with its own query language and graph capabilities. That is good for checking the data manually for each moment, but it would be far more useful for me to gather and store the data to examine it historically. In my previous article about using a Raspberry Pi Zero and DHT22 to collect temperature and humidity data, I showed how to write a Python script to gather the data and print it to the screen. It is used at huge scale by large enterprise organizations, but it is equally at home, well, at home, collecting data for hobbyist projects. In my job as a site reliability engineer running OpenShift Dedicated clusters for Red Hat, Prometheus is the core of a robust monitoring and alerting system for all of our clusters, operators, and applications. Prometheus is frequently used to gather data from container orchestration clusters such as Kubernetes and OpenShift. I've written about setting up Prometheus locally at home. Prometheus is an open source monitoring and alerting system that gathers metrics and provides a powerful query language for exploring data. Whitepaper: Data-intensive intelligent applications in a hybrid cloud blueprint.eBook: Running Kubernetes on your Raspberry Pi.Getting started with Raspberry Pi cheat sheet.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |