-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
c016772
commit d3b3fbe
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
def print() { | ||
try { | ||
def startTime = sh(script: "date -d '-3 minutes' -Iseconds | sed s/+/%2B/", returnStdout: true).trim() | ||
def endTime = sh(script: "date -d '+1 hour 30 minutes' -Iseconds | sed s/+/%2B/", returnStdout: true).trim() | ||
|
||
def resourcesUrl = | ||
( | ||
"https://infra-stats.elastic.co/app/kibana#/visualize/edit/8bd92360-1b92-11ea-b719-aba04518cc34" + | ||
"?_g=(time:(from:'${startTime}',to:'${endTime}'))" + | ||
"&_a=(query:'host.name:${env.NODE_NAME}')" | ||
) | ||
.replaceAll("'", '%27') // Need to escape ' because of the shell echo below, but can't really replace "'" with "\'" because of groovy sandbox | ||
.replaceAll(/\)$/, '%29') // This is just here because the URL parsing in the Jenkins console doesn't work right | ||
|
||
def logsStartTime = sh(script: "date -d '-3 minutes' +%s", returnStdout: true).trim() | ||
def logsUrl = | ||
( | ||
"https://infra-stats.elastic.co/app/infra#/logs" + | ||
"?_g=()&flyoutOptions=(flyoutId:!n,flyoutVisibility:hidden,surroundingLogsId:!n)" + | ||
"&logFilter=(expression:'host.name:${env.NODE_NAME}',kind:kuery)" + | ||
"&logPosition=(position:(time:${logsStartTime}000),streamLive:!f)" | ||
) | ||
.replaceAll("'", '%27') | ||
.replaceAll('\\)', '%29') | ||
|
||
sh script: """ | ||
set +x | ||
echo 'Resource Graph:' | ||
echo '${resourcesUrl}' | ||
echo '' | ||
echo 'Agent Logs:' | ||
echo '${logsUrl}' | ||
echo '' | ||
echo 'SSH Command:' | ||
echo "ssh -F ssh_config \$(hostname --ip-address)" | ||
""", label: "Worker/Agent/Node debug links" | ||
} catch(ex) { | ||
print ex.toString() | ||
} | ||
} | ||
|
||
return this |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters