The service logs all system information to application using a classic file-based interface, it can be configured to log system information to:
* Regular text file (such as log file)
* Name pipe (FIFO), the name pipe file should be previously created by application
* STDOUT
* UNIX socket domain, as with name pipe, the socket file must be previously created by application
Additionally, if configured correctly, the service can monitor the system battery and automatically shutdown the system when the battery is below a configured threshold
## Build and install
The build process is done using autotool
```sh
libtoolize
aclocal
autoconf
automake --add-missing
# build
make
#install
make install
```
## Configuration
The default configuration file can be found in `/etc/sysmond.conf`.
Specific configuration file can be passed to the service using the `-f` option.
```sh
sysmond -f /path/to/your/sysmond.conf
```
### Battery monitoring configuration
The battery monitoring feature is helpful for battery-powered systems such as robotic systems.
On these systems, battery voltage reading is performed with the help of an ADC sensor (such as ADS1115).
As the service communicate with the system hardware via the **sysfs interface**, in order to provide input
to `sysmond`, these ADCs sensor should accessible in user space via this interface. Usually, this is handled
by the device dirver.
For example, an `ADS1115` linux driver will expose its ADC channel inputs in user space at
`/sys/class/hwmon/hwmon0/device/*`, if the battery is connected to the chanel 3 of the ADC sensor,
the battery voltage can be easily read with a simple `cat` command:
```sh
cat sys/class/hwmon/hwmon0/device/in3_input
# value in mV, example 4.1V
4120
```
This kind of file need to be passed to `sysmond` configuration. The following configuration availabe
```ini
# Max usable battery voltage
battery_max_voltage = 12600
# Min usable battery votage
battery_min_voltage = 10000
# Below this voltage, the battery is unusable and is damaged
battery_cutoff_votalge = 9000
# if voltage divider is used, the R1+R2/ R2 ratio shoud be set to `battery_divide_ratio`, otherwise `1.0`
battery_divide_ratio = 3.36
# Battery input file. If this configuration is empty, the battery monitoring feature is disabled