Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Commit

Permalink
Merge pull request #43 from nanliu/GH-42
Browse files Browse the repository at this point in the history
GH-42 fix plugin build on MacOS
  • Loading branch information
nanliu authored Oct 14, 2016
2 parents 372b839 + c5bf8a2 commit 61a9a09
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
2 changes: 0 additions & 2 deletions .sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
matrix:
- GOOS: linux
GOARCH: amd64
- GOOS: darwin
GOARCH: amd64
.travis.yml:
env:
global:
Expand Down
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ deploy:
secure: r6hwOMU7YUxuWLoBFjZJ/LeNr469XmpCmcUVh8dHYYjLK4XrAQZej+kiaqhJh289ZeCdlwDTKZN/pcd+miiOBS50c/wjmSQKyhCY29U6olkQf2dPbpvn3ICoSgfD09BumXmaGWEc9jo+VVYJBp/m7Nb1bpka4zwj7XlSn7k0z820kKHlokH4Fe3jKZWoWNSRrJfU5fiOqzq6B1rXa+Upjt8QButZd68BUuSL/1PONtUoF691+ao6+cqBYDsWl5cViEFsaX/wGNuBVWHF4unJl4dPaJhaTv3STAPbGZdaxfm28WCJ9ERllTCEnHdU2nSaXNLMeba4XVp1kXsy63nyKSq3WVu/+uD6qPaTqYXIxGhqkkb1Htxnz6y+bxgniYU9wGAQdHbyjC1/Dhj+++w+MOHNlSOcxfZyTKLdozXa96jXOwIE4XU1NXN3OvYiIaCW0Tb1n9kAaTn92jMycrlnAXTPLVE+QwJ/WXV5ureqmzO9llr/fjoxHGo878o2oz3yn+LT5Kg3hmkZBn60JlhuM72CRN9D5zEhIL/5C+rDFlMIESdppT3g/9nH/MsQSKZW/Yx06TZnxlhQprvQE4EmOX36bGfdKodpX4XZh59U7YPjsvmT0AEb+rs2zbTjEVbbkq98ECLWbGvQ+dpw3hPwrI97vj/fXG7sjf5N99ogb+Y=
file:
- release/snap-plugin-collector-psutil_linux_x86_64
- release/snap-plugin-collector-psutil_darwin_x86_64
skip_cleanup: true
on:
repo: intelsdi-x/snap-plugin-collector-psutil
Expand Down
4 changes: 1 addition & 3 deletions psutil/cpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,9 @@ func getCPUTimeValue(stat *cpu.TimesStat, name string) (float64, error) {

func getCPUTimesMetricTypes() ([]plugin.MetricType, error) {
//passing true to CPUTimes indicates per CPU
//CPUTimes does not currently work on OSX https://github.com/shirou/gopsutil/issues/31
mts := []plugin.MetricType{}
switch runtime.GOOS {
case "linux":
case "linux", "darwin":
for k, label := range cpuLabels {
mts = append(mts, plugin.MetricType{
Namespace_: core.NewNamespace("intel", "psutil", "cpu").AddDynamicElement("cpu_id", "physical cpu id").AddStaticElement(k),
Expand All @@ -195,7 +194,6 @@ func getCPUTimesMetricTypes() ([]plugin.MetricType, error) {
Unit_: label.unit,
})
}

default:
return nil, fmt.Errorf("%s not supported by plugin", runtime.GOOS)
}
Expand Down
2 changes: 1 addition & 1 deletion psutil/psutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const (
// Name of plugin
name = "psutil"
// Version of plugin
version = 7
version = 8
// Type of plugin
pluginType = plugin.CollectorPluginType
)
Expand Down
13 changes: 9 additions & 4 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@ export GOOS=linux
export GOARCH=amd64
mkdir -p "${build_dir}/${GOOS}/x86_64"
"${go_build[@]}" -o "${build_dir}/${GOOS}/x86_64/${plugin_name}" . || exit 1
export GOOS=darwin
export GOARCH=amd64
mkdir -p "${build_dir}/${GOOS}/x86_64"
"${go_build[@]}" -o "${build_dir}/${GOOS}/x86_64/${plugin_name}" . || exit 1

if [[ "$(uname -s)" == "Darwin" ]]; then
export CGO_ENABLED=1

export GOOS=darwin
export GOARCH=amd64
mkdir -p "${build_dir}/${GOOS}/x86_64"
"${go_build[@]}" -o "${build_dir}/${GOOS}/x86_64/${plugin_name}" . || exit 1
fi

0 comments on commit 61a9a09

Please sign in to comment.