i couldn't login to the hq server so i restarted the hq server and after that all hq agents were down and when i try to use the start command,the agent restarts but on the availablility window it is still red showing that its down.
Try stopping all of the agents and server again. Restart the server, wait until it's finished, log in. Then start the agents again and see if they show up.