Agents disconnected query

Hi,

I setup some TeamCity linux agents. However, I had an issue with my underlying host and had to force reboot stuff and the agents now show:

 

Disconnected — Unregistered because of inactivity Last communication on 23 Aug 09:54

Authorized on 4 Aug 02:37 by abc

Enabled on 23 Aug 18:33

I am wondering, how can I get these servers to be connected again?

Also, how can I setup the agents so that some builds go to some agents and others to other agents? For example, .NET builds go to an agent with .NET core sdk installed, etc.

0
10 comments
Hi Gurdip,

Could you please share the teamcity-agent.log(https://www.jetbrains.com/help/teamcity/viewing-build-agent-logs.html#Generic+Debug+Logging) with us for further investigation?

Agent requirements are special conditions that define whether a build configuration (https://www.jetbrains.com/help/teamcity/managing-builds.html) can run on a particular build agent (https://www.jetbrains.com/help/teamcity/build-agent.html).

For more detailed information, please refer to https://www.jetbrains.com/help/teamcity/agent-requirements.html.

Best Regards,
Tom
0

Yeah sure I can get the logs. The agent requirements makes sense, but one thing I am wondering is I read that for the agent requirements, I can and should write a script that can check for something and then append to the build agent conf file.

For example, I can check if npm exists on an agent and write a script to append the agent config file (e..g npm = true), and then a build agent requirement with this value. Would this still be a valid approach?

0

Hi Gurdip,

>can check if npm exists on an agent and write a script to append the agent config file (e..g npm = true), and then a build agent requirement with this value. Would this still be a valid approach?

Yes, you can add an agent requirement based on the custom parameter.

As mentioned in the document, you also can Set the environment variable (https://www.jetbrains.com/help/teamcity/predefined-build-parameters.html#Java-Related+Environment+Variables) on the agent and specify the value on the Parameters page of a build configuration (or in the Project Settings)

However, if you want to check whether npm exists on the agent, it is enough to add node.js.npm exists agent requirements.
 

>Yeah sure I can get the logs
Files can be uploaded via https://uploads.jetbrains.com/. Please let us know the exact id after the upload.

0

Ok I got the agent to attempt to start but there's no log file? This is the output:

0
Hi Gurdip,

The screenshot you shared shows that the TeamCity build agent is failing to start due to missing log files or directories. Could you please verify that the buildAgent directory and its subdirectories have the correct permissions so that the agent can read/write files?

Best Regards,
Tom
0

So I granted rights, as per the screenshot. Still no luck?

 

0

To put it another way. I have extracted the agent zip again. What would you suggest I do next to ensure I can configure this correctl? As in Ubuntu commands.

0
Hi Gurdip,

How to install the TeamCity agent from zip file, please refer to https://www.jetbrains.com/help/teamcity/install-teamcity-agent.html#How+to+Install+Agents+from+ZIP+Files. 

Make sure that you give the correct permissions to build agent directory and its subdirectories so that the agent can read/write/execute files?

On Linux, you need to give execution permissions to the `bin/agent.sh` shell script.

You also could follow the document to install the agent with "Agent push" way.

Please do not hesitate to reach out to me if you have any further inquiries regarding this matter.

Best Regards,
Tom
0

I ran this:

sudo chown -R root:root /teamcityAgent

And also:

sudo chmod +x agent.sh

 

Still no luck. The service is set to run as root too.

0
Hi Gurdip,

Could you please share the latest teamcity-agent.log(https://www.jetbrains.com/help/teamcity/viewing-build-agent-logs.html#Generic+Debug+Logging) with us for further investigation?

Files can be uploaded via https://uploads.jetbrains.com/. Please let us know the exact id after the upload.
0

Please sign in to leave a comment.