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

BIGTOP-4258: Support prometheus on openeuler22 aarch64 #98

Merged
merged 7 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,20 @@
</package>
</packages>
</package-specific>
<package-specific>
<operating-systems>
<os>openeuler22</os>
</operating-systems>
<architectures>
<arch>aarch64</arch>
</architectures>
<packages>
<package>
<name>prometheus-2.54.0.linux-arm64.tar.gz</name>
<checksum>SHA-256:ed50b67cb833a225ec2a53b487c6e20372b20e56dce226423fa8611c8aa50392</checksum>
</package>
</packages>
</package-specific>
</package-specifics>
</service>
</metainfo>
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public RepoInfo repo() {
.filter(r -> OSDetection.getArch().equals(r.getArch()))
.findFirst()
.orElseThrow(() -> new StackException(
"Cannot find repo for os: [{}] and arch: [{}]", OSDetection.getOS(), OSDetection.getArch()));
"Cannot find repo for os: [{0}] and arch: [{1}]", OSDetection.getOS(), OSDetection.getArch()));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,19 @@ public ShellResult start(Params params) {
"nohup {0}/prometheus --config.file={0}/prometheus.yml --storage.tsdb.path={0}/data > {0}/nohup.out 2>&1 &",
prometheusParams.serviceHome());
try {
return LinuxOSUtils.sudoExecCmd(cmd, prometheusParams.user());
LinuxOSUtils.sudoExecCmd(cmd, prometheusParams.user());
long startTime = System.currentTimeMillis();
long maxWaitTime = 5000;
long pollInterval = 500;

while (System.currentTimeMillis() - startTime < maxWaitTime) {
ShellResult statusResult = status(params);
if (statusResult.getExitCode() == 0) {
return statusResult;
}
Thread.sleep(pollInterval);
}
return status(params);
} catch (Exception e) {
throw new StackException(e);
}
Expand All @@ -63,7 +75,7 @@ public ShellResult start(Params params) {
@Override
public ShellResult stop(Params params) {
PrometheusParams prometheusParams = (PrometheusParams) params;
String cmd = "pkill -f prometheus";
String cmd = MessageFormat.format("pkill -f {0}/prometheus", prometheusParams.serviceHome());
try {
return LinuxOSUtils.sudoExecCmd(cmd, prometheusParams.user());
} catch (Exception e) {
Expand All @@ -73,7 +85,8 @@ public ShellResult stop(Params params) {

@Override
public ShellResult status(Params params) {
String cmd = "pgrep -f prometheus";
PrometheusParams prometheusParams = (PrometheusParams) params;
String cmd = MessageFormat.format("pgrep -f {0}/prometheus", prometheusParams.serviceHome());
try {
ShellResult result = LinuxOSUtils.execCmd(cmd);
if (result.getExitCode() == 0) {
Expand Down
Loading