sonic-buildimage/platform
Hua Liu 51b60613f7 [S6100] Improve S6100 serial-getty monitor, wait and re-check when getty not running to avoid false alert. (#14402)
[S6100] Improve S6100 serial-getty monitor, wait and re-check when getty not running to avoid false alert. 

#### Why I did it
On S6100, the serial-getty service some time can't auto-restart by systemd. So there is a monit unit to check serial-getty service status and restart it.

However, this monit will report false alert, because in most case when serial-getty not running, systemd can restart it successfully.

To avoid the false alert, improve the monitor to wait and re-check.

Steps to reproduce this issue:
1. User login to device via console, and keep the connection.
2. User login to device via SSH, check the serial-getty@ttyS1.service service, it's running.
3. Run 'monit reload' from SSH connection.
4. Check syslog 1 minutes later, there will be false alert: ' 'serial-getty' process is not running'

#### How I did it
Add check-getty.sh script to recheck again later when getty service not running.
And update monit unit to check serial-getty service status with this script to avoid false alert.

#### How to verify it
Pass all UT.
Manually check fixed code work correctly:


```
admin@***:~$ sudo systemctl stop  serial-getty@ttyS1.service
admin@***:~$ sudo /usr/local/bin/check-getty.sh 
admin@***:~$ echo $?
1
admin@***:~$ sudo systemctl status serial-getty@ttyS1.serviceserial-getty@ttyS1.service - Serial Getty on ttyS1
     Loaded: loaded (/lib/systemd/system/serial-getty@.service; enabled-runtime; vendor preset: enabled)
     Active: inactive (dead) since Tue 2023-03-28 07:15:21 UTC; 1min 13s ago

admin@***:~$ sudo /usr/local/bin/check-getty.sh 
admin@***:~$ echo $?
0
admin@***:~$ sudo systemctl status serial-getty@ttyS1.serviceserial-getty@ttyS1.service - Serial Getty on ttyS1
     Loaded: loaded (/lib/systemd/system/serial-getty@.service; enabled-runtime; vendor preset: enabled)
```

syslog:
```
Mar 28 07:10:37.597458 *** INFO systemd[1]: serial-getty@ttyS1.service: Succeeded.
Mar 28 07:12:43.010550 *** ERR monit[593]: 'serial-getty' status failed (1) -- no output
Mar 28 07:12:43.010744 *** INFO monit[593]: 'serial-getty' trying to restart
Mar 28 07:12:43.010846 *** INFO monit[593]: 'serial-getty' stop: '/bin/systemctl stop serial-getty@ttyS1.service'
Mar 28 07:12:43.132172 *** INFO monit[593]: 'serial-getty' start: '/bin/systemctl start serial-getty@ttyS1.service'
Mar 28 07:13:43.286276 *** INFO monit[593]: 'serial-getty' status succeeded (0) -- no output
```

#### Description for the changelog
[S6100] Improve S6100 serial-getty monitor.

#### Ensure to add label/tag for the feature raised. example - PR#2174 under sonic-utilities repo. where, Generic Config and Update feature has been labelled as GCU.
2023-04-21 02:32:56 +08:00
..
barefoot [202211][Arista] Update platform library submodules (#13872) 2023-02-17 13:51:42 -08:00
broadcom [S6100] Improve S6100 serial-getty monitor, wait and re-check when getty not running to avoid false alert. (#14402) 2023-04-21 02:32:56 +08:00
cavium [infra] Support syslog rate limit configuration (#12490) (#13535) 2023-01-30 20:11:44 +02:00
centec [centec]: reference to v1.11.0-1 sai debian package for master (#13206) 2023-02-04 02:36:38 +08:00
centec-arm64 [centec]: reference to v1.11.0-1 sai debian package for master (#13206) 2023-02-04 02:36:38 +08:00
checkout Platform/cisco-8000 module for sonic-buildimage (#8172) 2021-08-06 09:11:54 +08:00
components [gearbox] use credo sai v0.9.0 (#14149) 2023-03-19 20:50:53 +08:00
generic [dockers] Rename 'docker-snmp-sv2' to 'docker-snmp' (#4699) 2020-06-11 16:04:23 -07:00
innovium [infra] Support syslog rate limit configuration (#12490) (#13535) 2023-01-30 20:11:44 +02:00
marvell [infra] Support syslog rate limit configuration (#12490) (#13535) 2023-01-30 20:11:44 +02:00
marvell-arm64 [infra] Support syslog rate limit configuration (#12490) (#13535) 2023-01-30 20:11:44 +02:00
marvell-armhf add sfp get error description (#13275) 2023-02-22 18:36:56 +08:00
mellanox Made non-upstream patch design order aware (#14434) (#14650) 2023-04-14 03:29:35 +08:00
nephos [infra] Support syslog rate limit configuration (#12490) (#13535) 2023-01-30 20:11:44 +02:00
p4 [infra] Support syslog rate limit configuration (#12490) (#13535) 2023-01-30 20:11:44 +02:00
pddf Adding support for get/set low power mode for QSFPs in PDDF common APIs (#11786) 2022-09-09 14:33:12 -07:00
s3ip-sysfs The FAN driver framework module complies with s3ip sysfs specification (#12888) (#13212) 2023-01-09 14:24:41 +08:00
template Mount directory warmboot in docker gbsyncd (#11852) 2022-08-26 22:00:45 +08:00
vs Support to add SONiC OS Version in device info (#14601) (#14623) 2023-04-13 19:28:03 +08:00