The PICOS Monitor process is a daemon service managed by systemd, it starts before PICOS, and is responsible for the following functions.
- Monitor PICOS Process
Restart PICOS if any key process crashs. If restart cannot recover the system, the system will be rebooted.
When a system failure happens, the system LED will enter the warning state.
- Backup and Restore the Monitored Files
Backup and restore the monitored files when the system starts up again from a power down. Monitored files are mainly the configurations that could have under updation when a power cycle happened. User application files can be protected as well.
- Monitor CPU Usage Rate
Generate a log message if the CPU rate is higher than maximum threshold and stays there for some time period. A log message will be recorded when the CPU usage recovers to the normal rate.
- Monitor the Memory Usage of PICOS and User Applications
The memory usage monitored is the physical memory used, not including any system cache of file system.
- Monitor Disk Usage
Monitor disk usage, including free space of rootfs, tmpfs, ramdisk and user data partition.
- Take Care of Watchdog
PICOS Monitor initializes and feeds the watchdog register to make sure monitor itself is alive. If monitor process fails, the watchdog will trigger to reset the whole system and load the system again.
View Monitor Log
Log messages generated during Monitor process can be found at any of the following two paths. The log entries will have the keyword [PICOS_MONITOR].
admin@Xorplus:~$ sudo journalctl /pica/bin/system/tools/picos_monitor/monitor -- Journal begins at Thu 2022-06-09 14:56:49 UTC, ends at Thu 2022-06-09 16:00:06 UTC. -- admin@Xorplus:~$ tail -f /tmp/log/messages Jan 17 2022 14:17:44 57switch local0.info : [PICA_LIB_COMMON]Card batch set port state(2) successfully. Jan 17 2022 14:17:48 57switch ntpd daemon.info : kernel reports TIME_ERROR: 0x41: Clock Unsynchronized Jan 17 2022 14:25:01 57switch su auth.notice : (to www-data) root on none
Monitor Process Management
We can use systemctl status picos-monitor command to check the status of monitor process, where ”Active: ” could be active or inactive, indicating the status of monitor process.
admin@Xorplus:~$ sudo systemctl status picos-monitor * picos-monitor.service - Picos Monitor Loaded: loaded (/lib/systemd/system/picos-monitor.service; enabled) Active: active (exited) since Mon 2001-01-08 18:43:02 UTC; 4h 40min ago Process: 648 ExecStart=/etc/init.d/picos_monitor start (code=exited, status=0/SUCCESS) Main PID: 648 (code=exited, status=0/SUCCESS) CGroup: /system.slice/picos-monitor.service
The following commands can be used to start/stop picos-monitor process.
admin@Xorplus:~$ sudo systemctl stop picos-monitor admin@Xorplus:~$ sudo systemctl start picos-monito