Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix metric creation when node is offline in jenkins input #6627

Merged
merged 2 commits into from
Nov 12, 2019

Conversation

danielnelson
Copy link
Contributor

closes #6578

Required for all PRs:

  • Signed CLA.
  • Associated README.md updated.
  • Has appropriate unit tests.

@danielnelson danielnelson added the fix pr to fix corresponding bug label Nov 6, 2019
@danielnelson danielnelson added this to the 1.12.5 milestone Nov 6, 2019
@danielnelson
Copy link
Contributor Author

@ctNb Would you be able to test out this fix with your offline node? My Jenkins setup only has a single node right now. Here are some builds, let me know if you need a different one:

@ctNb
Copy link

ctNb commented Nov 11, 2019

i just tested the telegraf client on ubuntu and it seems not to work as expected. The offline node still doesn't show up.
I don't know how the accumulator exactly works, but is it possible that a metric is not getting listed when no fields are added? Because "status" is a tag and all other fields are in my case null (the API snippet in the issue shows this).
I am still testing some cases to be sure there is no error on my side

@danielnelson
Copy link
Contributor Author

This is true, metrics without any fields are completely removed as they pass through Telegraf. I was expecting that the response_time field would still remain though. Let me know if you figure anything out and in the meantime I'll work on getting a better Jenkins test environment together.

@ctNb
Copy link

ctNb commented Nov 11, 2019

i am also setting up a clean test environment. I've installed the latest jenkins docker image and just added a node, which is not even existing. Jenkins shows this node in the GUI and API also as offline. When running now telegraf, the node is also not shown.
Maybe the solution is to add something like in the "http_response" plugin, which contains a "result" tag and a "result_code" as a field.

@danielnelson
Copy link
Contributor Author

Here is my output from an offline slave, so it seems that the response time monitor doesn't stick around for long, or maybe it stays only after some failures.

{
	"_class": "hudson.slaves.SlaveComputer",
	"absoluteRemotePath": null,
	"actions": [
		{}
	],
	"assignedLabels": [
		{
			"name": "slave"
		}
	],
	"description": "",
	"displayName": "slave",
	"executors": [
		{}
	],
	"icon": "computer-x.png",
	"iconClassName": "icon-computer-x",
	"idle": true,
	"jnlpAgent": false,
	"launchSupported": true,
	"loadStatistics": {
		"_class": "hudson.model.Label$1"
	},
	"manualLaunchAllowed": true,
	"monitorData": {
		"hudson.node_monitors.ArchitectureMonitor": null,
		"hudson.node_monitors.ClockMonitor": null,
		"hudson.node_monitors.DiskSpaceMonitor": null,
		"hudson.node_monitors.ResponseTimeMonitor": null,
		"hudson.node_monitors.SwapSpaceMonitor": null,
		"hudson.node_monitors.TemporarySpaceMonitor": null
	},
	"numExecutors": 1,
	"offline": true,
	"offlineCause": {
		"_class": "hudson.slaves.OfflineCause$LaunchFailed"
	},
	"offlineCauseReason": "This agent is offline because Jenkins failed to launch the agent process on it.",
	"oneOffExecutors": [],
	"temporarilyOffline": true
}

Adding another field will do the trick. I think for now the safest change, just to address the issue, is to add the numExecutors field. We could think about other fields in the context of a feature request.

@danielnelson
Copy link
Contributor Author

Example output:

> jenkins_node,arch=Linux\ (amd64),disk_path=/var/lib/jenkins,node_name=master,status=online,temp_path=/tmp disk_available=517427200,memory_available=1216356352,memory_total=2101669888,num_executors=2i,response_time=0i,swap_available=0,swap_total=0,temp_available=517427200 1573546293000000000
> jenkins_node,node_name=slave,status=offline num_executors=1i 1573546293000000000

Updated builds:

@danielnelson danielnelson merged commit bcf1bcf into master Nov 12, 2019
@danielnelson danielnelson deleted the jenkins-offline-node branch November 12, 2019 19:59
danielnelson added a commit that referenced this pull request Nov 12, 2019
athoune pushed a commit to bearstech/telegraf that referenced this pull request Apr 17, 2020
idohalevi pushed a commit to idohalevi/telegraf that referenced this pull request Sep 29, 2020
arstercz pushed a commit to arstercz/telegraf that referenced this pull request Mar 5, 2023
arstercz pushed a commit to arstercz/telegraf that referenced this pull request Mar 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix pr to fix corresponding bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

jenkins node doesnt appear as offline
2 participants