What Can I Do If the SSH Tunnel Process Is Abnormal?
In the hybrid cloud scenario, if the SSH tunnel process becomes abnormal when monitoring data is forwarded to Application Performance Management (APM) through a jump server, do as follows:
- Log in to the jump server using a remote login tool.
- Run the following command to configure interaction-free login:
ssh-keygen cd /root/.ssh/ cat id_rsa.pub > authorized_keys vi /etc/ssh/sshd_config
Set the value of PubkeyAuthentication to yes.service sshd restart
- Obtain the checkSsh.sh script, modify the configuration, and set the permission.
- Obtain the script.
Download address: https://icagent-{region}.obs.{region}.myhuaweicloud.com/ICAgent_linux/checkSsh.sh
The download address varies according to region. Replace {region} in the download address with the actual region. Example: For the CN North-Beijing4 region, the download address is:
https://icagent-cn-north-4.obs.cn-north-4.myhuaweicloud.com/ICAgent_linux/checkSsh.sh
- Set the permission.
chmod +x checkSsh.sh
- Execute the checkSsh.sh script.
- In the following commands, replace {Jump server IP address}, {ELB IP address}, and {region} with the actual values.
- If the jump server runs Ubuntu or Debian, run the sudo dpkg-reconfigure dash command and select NO before running the checkSsh.sh script.
sh checkSsh.sh "ssh -f -N -L {Jump server IP address}:8149:{ELB IP address}:8149 -L {Jump server IP address}:8102:{ELB IP address}:8102 -L {Jump server IP address}:8923:{ELB IP address}:8923 -L {Jump server IP address}:30200:{ELB IP address}:30200 -L {Jump server IP address}:30201:{ELB IP address}:30201 -L {Jump server IP address}:80:icagent-{region}.obs.{region}.myhuaweicloud.com:80 {Jump server IP address}"
- Obtain the script.
- Configure the crontab command and run it periodically.
crontab -e */10 * * * * /home/tools/checkSsh.sh ssh -f -N -L {Jump server IP address}:8149:{ELB IP address}:8149 -L {Jump server IP address}:8102:{ELB IP address}:8102 -L {Jump server IP address}:8923:{ELB IP address}:8923 -L {Jump server IP address}:30200:{ELB IP address}:30200 -L {Jump server IP address}:30201:{ELB IP address}:30201 -L {Jump server IP address}:80:icagent-{region}.obs.{region}.myhuaweicloud.com:80 {Jump server IP address} crond restart
- In the preceding command, the /home/tools/checkSsh.sh directory is used as an example. Replace it with an actual directory.
- 10 indicates that the command is run every 10 minutes. You can change the value as required.
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.