Bellow is how I resolve my problem with TeamCity – Build agent disconnected.

- ssh to my centos agent machine.
- Go to agent folder, in this case it is
BuildAgent - I tried to stop the agent by
bin/agent.sh stopbut got no luck. When I started the agent it said thatBuild agent is already running with PID 1795, so that I could not restart it. - KILL the process by
sudo kill 1795 - Restart again
bin/agent.sh start
=> It should work now.