Lm-sensors tool installation and use Abstract: Host Sensor Information Monitoring recently in the cloud computing project, there is a need to monitor the hardware information of the physical machine, for example, the main board temperature, CPU voltage, fan speed, etc. Previous experience was to query through I2C channel commands and develop based on customized hardware devices. However, you cannot query the hardware information that supports pc debugging machines. A Brief Introduction of sensor classification: temperature, speed, and pressure. I accidentally read the private dish of laruence and found that the lm-sensors tool can meet the requirements. Let's introduce it from installation and use. There are two installation methods: 1) Direct installation of rpm/yum; 2) source code compilation and installation. The former is not much said, the latter is a little wordy, download from the www.lm-sensors.org to the source code, unzip, the main directory, see the install file, need to rely on gcc, bison, flex, rrd (Optional). gcc knows that bison and flex can be considered as a powerful tool for parsing text data in linux, mainly for parsing the content of its configuration file, such as/etc/sensors3.conf by default. After installing these dependencies, run make all and make install. In addition, use/prog/detect/sensors-detect to detect monitored sensors and write the results to modules in/etc/lm-sensors/sensors. Then let's use it. In the terminal, enter sensors to check whether it is supported. If the command cmd is not supported, the installation may fail. Repeat the result. If no modules is displayed, the monitor chip lm-sensors is not supported, or the driver is not installed. If the output contains temperature, voltage, and so on, OK. (The simplest way is to directly check whether subdirectories exist under/sys/class/hwmon .) Let's talk about the principle. what lm-sensors tool does is actually a translation job. What actually monitors is the hwmon module in the kernel, hwmon is a class that exists in the kernel (you can view/sys/class/hwmon). During kernel initialization, all devices, such as monitoring chips and sensors, are registered with the hwmon module, drivers of each device are responsible for monitoring and reporting information at regular intervals. hwmon is responsible for updating the information in the corresponding files under/sys/class/hwmon/hwmonN, for example, the input file of temperature sensor 1 is temp1_input. The sensors command is customized based on the user's configuration file (-c specified, see man libsensors syntax). If this parameter is not specified, use the default configuration file/etc/sensors3.conf to replace the corresponding fields, for example, temp1 can be identified as M/B Temp.