mirror of
https://github.com/netdata/netdata.git
synced 2025-04-12 16:58:10 +00:00
Integrate Go plugin with build system. (#17005)
* Integrate Go plugin with build system. * Fix Debian packaging rules. * Add FreeBSD support to Go toolchain handling. * Add Go ldflags handling. * Fix version detection when GCCGO is used. * Fix Go ldflags handling. * Correctly fix Go toolchain version detection. * Properly mark Go as a required dependency in CMake. * Disable VCS stamping as it does not work correctly on some platforms. * Autodetect minimum required Go version from go.mod files. This allows us to avoid needing to update the CMakeLists.txt file when the required version changes in a Go component’s go.mod file. * Prefix GoTools module name with Netdata to ensure we get our local module. * Update integrations code to use new Go plugin location. * Remove old go packaging files. * keep old logic for initial cleanup that is working * Re-sync Go plugin sources. * Fix search order for finding Go toolchain. * update module name * fix /usr/local/go overwrite condition --------- Co-authored-by: Fotis Voutsas <fotis@netdata.cloud> Co-authored-by: ilyam8 <ilya@netdata.cloud>
This commit is contained in:
parent
0e7cde465c
commit
4b7d920b44
854 changed files with 1991 additions and 2041 deletions
.github/workflows
CMakeLists.txtcontrib/debian
integrations
netdata-installer.shnetdata.spec.inpackaging
src/go/collectors/go.d.plugin
Dockerfile.devMakefileREADME.md
agent
agent.goagent_test.go
confgroup
discovery
cache.goconfig.gosim_test.go
dummy
dyncfg
file
manager.gomanager_test.gosd
hostsocket
kubernetes
pipeline
accumulator.goclassify.goclassify_test.gocompose.gocompose_test.goconfig.gopipeline.gopipeline_test.goselector.goselector_test.gosim_test.go
sd.gosd_test.gosim_test.goexecutable
filestatus
functions
jobmgr
module
setup.gosetup_test.govnodes
cmd/godplugin
examples/simple
go.modgo.sumhack
logger
modules
activemq
apache
13
.github/workflows/generate-integrations.yml
vendored
13
.github/workflows/generate-integrations.yml
vendored
|
@ -7,6 +7,7 @@ on:
|
||||||
- master
|
- master
|
||||||
paths: # If any of these files change, we need to regenerate integrations.js.
|
paths: # If any of these files change, we need to regenerate integrations.js.
|
||||||
- 'src/collectors/**/metadata.yaml'
|
- 'src/collectors/**/metadata.yaml'
|
||||||
|
- 'src/go/collectors/**/metadata.yaml'
|
||||||
- 'src/exporting/**/metadata.yaml'
|
- 'src/exporting/**/metadata.yaml'
|
||||||
- 'src/health/notifications/**/metadata.yaml'
|
- 'src/health/notifications/**/metadata.yaml'
|
||||||
- 'integrations/templates/**'
|
- 'integrations/templates/**'
|
||||||
|
@ -14,7 +15,6 @@ on:
|
||||||
- 'integrations/deploy.yaml'
|
- 'integrations/deploy.yaml'
|
||||||
- 'integrations/cloud-notifications/metadata.yaml'
|
- 'integrations/cloud-notifications/metadata.yaml'
|
||||||
- 'integrations/gen_integrations.py'
|
- 'integrations/gen_integrations.py'
|
||||||
- 'packaging/go.d.version'
|
|
||||||
workflow_dispatch: null
|
workflow_dispatch: null
|
||||||
concurrency: # This keeps multiple instances of the job from running concurrently for the same ref.
|
concurrency: # This keeps multiple instances of the job from running concurrently for the same ref.
|
||||||
group: integrations-${{ github.ref }}
|
group: integrations-${{ github.ref }}
|
||||||
|
@ -31,17 +31,6 @@ jobs:
|
||||||
with:
|
with:
|
||||||
fetch-depth: 1
|
fetch-depth: 1
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
- name: Get Go Ref
|
|
||||||
id: get-go-ref
|
|
||||||
run: echo "go_ref=$(cat packaging/go.d.version)" >> "${GITHUB_ENV}"
|
|
||||||
- name: Checkout Go
|
|
||||||
id: checkout-go
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 1
|
|
||||||
path: go.d.plugin
|
|
||||||
repository: netdata/go.d.plugin
|
|
||||||
ref: ${{ env.go_ref }}
|
|
||||||
- name: Prepare Dependencies
|
- name: Prepare Dependencies
|
||||||
id: prep-deps
|
id: prep-deps
|
||||||
run: |
|
run: |
|
||||||
|
|
|
@ -47,12 +47,14 @@ else()
|
||||||
message(FATAL_ERROR "Wrong version regex match count ${CMAKE_MATCH_COUNT} (should be in 3, 4 or 5)")
|
message(FATAL_ERROR "Wrong version regex match count ${CMAKE_MATCH_COUNT} (should be in 3, 4 or 5)")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set(NETDATA_VERSION ${FIELD_MAJOR}.${FIELD_MINOR}.${FIELD_PATCH}.${FIELD_TWEAK})
|
||||||
|
|
||||||
#
|
#
|
||||||
# project
|
# project
|
||||||
#
|
#
|
||||||
|
|
||||||
project(netdata
|
project(netdata
|
||||||
VERSION ${FIELD_MAJOR}.${FIELD_MINOR}.${FIELD_PATCH}.${FIELD_TWEAK}
|
VERSION ${NETDATA_VERSION}
|
||||||
DESCRIPTION "Netdata real-time monitoring"
|
DESCRIPTION "Netdata real-time monitoring"
|
||||||
HOMEPAGE_URL "https://www.netdata.cloud"
|
HOMEPAGE_URL "https://www.netdata.cloud"
|
||||||
LANGUAGES C CXX)
|
LANGUAGES C CXX)
|
||||||
|
@ -98,20 +100,21 @@ option(ENABLE_ML "enable machine learning" True)
|
||||||
option(ENABLE_H2O "enable h2o" True)
|
option(ENABLE_H2O "enable h2o" True)
|
||||||
option(ENABLE_DBENGINE "enable dbengine" True)
|
option(ENABLE_DBENGINE "enable dbengine" True)
|
||||||
|
|
||||||
option(ENABLE_PLUGIN_DEBUGFS "enable debugfs.plugin" True)
|
|
||||||
option(ENABLE_PLUGIN_APPS "enable apps.plugin" True)
|
option(ENABLE_PLUGIN_APPS "enable apps.plugin" True)
|
||||||
|
option(ENABLE_PLUGIN_CGROUP_NETWORK "enable cgroup-network plugin" True)
|
||||||
|
option(ENABLE_PLUGIN_CUPS "enable cups.plugin" True)
|
||||||
|
option(ENABLE_PLUGIN_DEBUGFS "enable debugfs.plugin" True)
|
||||||
|
option(ENABLE_PLUGIN_EBPF "enable ebpf.plugin" True)
|
||||||
option(ENABLE_PLUGIN_FREEIPMI "enable freeipmi.plugin" True)
|
option(ENABLE_PLUGIN_FREEIPMI "enable freeipmi.plugin" True)
|
||||||
|
option(ENABLE_PLUGIN_GO "enable go.d.plugin" True)
|
||||||
|
option(ENABLE_PLUGIN_LOCAL_LISTENERS "enable local-listeners" True)
|
||||||
|
option(ENABLE_PLUGIN_LOGS_MANAGEMENT "enable logs-management.plugin" True)
|
||||||
|
option(ENABLE_PLUGIN_NETWORK_VIEWER "enable network-viewer" True)
|
||||||
option(ENABLE_PLUGIN_NFACCT "enable nfacct.plugin" True)
|
option(ENABLE_PLUGIN_NFACCT "enable nfacct.plugin" True)
|
||||||
option(ENABLE_PLUGIN_XENSTAT "enable xenstat.plugin" True)
|
|
||||||
option(ENABLE_PLUGIN_PERF "enable perf.plugin" True)
|
option(ENABLE_PLUGIN_PERF "enable perf.plugin" True)
|
||||||
option(ENABLE_PLUGIN_SLABINFO "enable slabinfo.plugin" True)
|
option(ENABLE_PLUGIN_SLABINFO "enable slabinfo.plugin" True)
|
||||||
option(ENABLE_PLUGIN_CUPS "enable cups.plugin" True)
|
|
||||||
option(ENABLE_PLUGIN_CGROUP_NETWORK "enable cgroup-network plugin" True)
|
|
||||||
option(ENABLE_PLUGIN_EBPF "enable ebpf.plugin" True)
|
|
||||||
option(ENABLE_PLUGIN_LOCAL_LISTENERS "enable local-listeners" True)
|
|
||||||
option(ENABLE_PLUGIN_NETWORK_VIEWER "enable network-viewer" True)
|
|
||||||
option(ENABLE_PLUGIN_SYSTEMD_JOURNAL "enable systemd-journal.plugin" True)
|
option(ENABLE_PLUGIN_SYSTEMD_JOURNAL "enable systemd-journal.plugin" True)
|
||||||
option(ENABLE_PLUGIN_LOGS_MANAGEMENT "enable logs-management.plugin" True)
|
option(ENABLE_PLUGIN_XENSTAT "enable xenstat.plugin" True)
|
||||||
|
|
||||||
option(ENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE "enable prometheus remote write exporter" True)
|
option(ENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE "enable prometheus remote write exporter" True)
|
||||||
option(ENABLE_EXPORTER_MONGODB "enable mongodb exporter" True)
|
option(ENABLE_EXPORTER_MONGODB "enable mongodb exporter" True)
|
||||||
|
@ -125,6 +128,14 @@ option(ENABLE_LOGS_MANAGEMENT_TESTS "enable logs management tests" True)
|
||||||
option(ENABLE_SENTRY "enable sentry" False)
|
option(ENABLE_SENTRY "enable sentry" False)
|
||||||
option(ENABLE_WEBRTC "enable webrtc" False)
|
option(ENABLE_WEBRTC "enable webrtc" False)
|
||||||
|
|
||||||
|
if(ENABLE_PLUGIN_GO)
|
||||||
|
include(NetdataGoTools)
|
||||||
|
|
||||||
|
find_min_go_version("${CMAKE_SOURCE_DIR}/src/go")
|
||||||
|
|
||||||
|
find_package(Go "${MIN_GO_VERSION}" REQUIRED)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(ENABLE_SENTRY)
|
if(ENABLE_SENTRY)
|
||||||
include(FetchContent)
|
include(FetchContent)
|
||||||
|
|
||||||
|
@ -2134,6 +2145,18 @@ install(TARGETS netdatacli
|
||||||
COMPONENT netdatacli
|
COMPONENT netdatacli
|
||||||
DESTINATION usr/sbin)
|
DESTINATION usr/sbin)
|
||||||
|
|
||||||
|
#
|
||||||
|
# Build go.d.plugin
|
||||||
|
#
|
||||||
|
|
||||||
|
if(ENABLE_PLUGIN_GO)
|
||||||
|
add_go_target(go-plugin go.d.plugin src/go/collectors/go.d.plugin cmd/godplugin)
|
||||||
|
|
||||||
|
install(PROGRAMS ${CMAKE_BINARY_DIR}/go.d.plugin
|
||||||
|
COMPONENT go.d.plugin
|
||||||
|
DESTINATION usr/libexec/netdata/plugins.d)
|
||||||
|
endif()
|
||||||
|
|
||||||
#
|
#
|
||||||
# Generate config file
|
# Generate config file
|
||||||
#
|
#
|
||||||
|
@ -2641,6 +2664,23 @@ if (ENABLE_PLUGIN_LOGS_MANAGEMENT)
|
||||||
DESTINATION usr/lib/netdata/conf.d)
|
DESTINATION usr/lib/netdata/conf.d)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
#
|
||||||
|
# go.d.plugin
|
||||||
|
#
|
||||||
|
if(ENABLE_PLUGIN_GO)
|
||||||
|
install(FILES src/go/collectors/go.d.plugin/config/go.d.conf
|
||||||
|
COMPONENT go.d.plugin
|
||||||
|
DESTINATION usr/lib/netdata/conf.d)
|
||||||
|
install(DIRECTORY
|
||||||
|
COMPONENT go.d.plugin
|
||||||
|
DESTINATION usr/lib/netdata/conf.d/go.d)
|
||||||
|
|
||||||
|
file(GLOB GO_CONF_FILES src/go/collectors/go.d.plugin/config/go.d/*.conf)
|
||||||
|
install(FILES ${GO_CONF_FILES}
|
||||||
|
COMPONENT go.d.plugin
|
||||||
|
DESTINATION usr/lib/netdata/conf.d/go.d)
|
||||||
|
endif()
|
||||||
|
|
||||||
#
|
#
|
||||||
# dashboard
|
# dashboard
|
||||||
#
|
#
|
||||||
|
|
|
@ -5,6 +5,7 @@ Build-Depends: debhelper (>= 10),
|
||||||
cmake,
|
cmake,
|
||||||
curl,
|
curl,
|
||||||
flex,
|
flex,
|
||||||
|
golang (>= 1.21),
|
||||||
libcups2-dev,
|
libcups2-dev,
|
||||||
libcurl4-openssl-dev,
|
libcurl4-openssl-dev,
|
||||||
libelf-dev,
|
libelf-dev,
|
||||||
|
|
|
@ -83,12 +83,13 @@ override_dh_auto_configure:
|
||||||
-DENABLE_PLUGIN_DEBUGFS=On \
|
-DENABLE_PLUGIN_DEBUGFS=On \
|
||||||
$(EBPF_CONFIG) \
|
$(EBPF_CONFIG) \
|
||||||
-DENABLE_PLUGIN_FREEIPMI=On \
|
-DENABLE_PLUGIN_FREEIPMI=On \
|
||||||
|
-DENABLE_PLUGIN_GO=On \
|
||||||
-DENABLE_PLUGIN_LOCAL_LISTENERS=On \
|
-DENABLE_PLUGIN_LOCAL_LISTENERS=On \
|
||||||
|
-DENABLE_PLUGIN_LOGS_MANAGEMENT=On \
|
||||||
-DENABLE_PLUGIN_NFACCT=On \
|
-DENABLE_PLUGIN_NFACCT=On \
|
||||||
-DENABLE_PLUGIN_PERF=On \
|
-DENABLE_PLUGIN_PERF=On \
|
||||||
-DENABLE_PLUGIN_SLABINFO=On \
|
-DENABLE_PLUGIN_SLABINFO=On \
|
||||||
-DENABLE_PLUGIN_SYSTEMD_JOURNAL=On \
|
-DENABLE_PLUGIN_SYSTEMD_JOURNAL=On \
|
||||||
-DENABLE_PLUGIN_LOGS_MANAGEMENT=On \
|
|
||||||
$(XENSTAT_CONFIG) \
|
$(XENSTAT_CONFIG) \
|
||||||
-DENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE=On \
|
-DENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE=On \
|
||||||
-DENABLE_EXPORTER_MONGODB=On \
|
-DENABLE_EXPORTER_MONGODB=On \
|
||||||
|
@ -210,6 +211,17 @@ override_dh_install:
|
||||||
$(TOP)-plugin-xenstat/usr/libexec/netdata/plugins.d/xenstat.plugin; \
|
$(TOP)-plugin-xenstat/usr/libexec/netdata/plugins.d/xenstat.plugin; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Install go to it's own package directory
|
||||||
|
#
|
||||||
|
mkdir -p $(TOP)-plugin-go/usr/libexec/netdata/plugins.d
|
||||||
|
mv -f $(TEMPTOP)/usr/libexec/netdata/plugins.d/go.d.plugin \
|
||||||
|
$(TOP)-plugin-go/usr/libexec/netdata/plugins.d/go.d.plugin
|
||||||
|
mkdir -p $(TOP)-plugin-go/usr/lib/netdata/conf.d
|
||||||
|
mv -f $(TEMPTOP)/usr/lib/netdata/conf.d/go.d.conf \
|
||||||
|
$(TOP)-plugin-go/usr/lib/netdata/conf.d/go.d.conf
|
||||||
|
mv -f $(TEMPTOP)/usr/lib/netdata/conf.d/go.d \
|
||||||
|
$(TOP)-plugin-go/usr/lib/netdata/conf.d/go.d
|
||||||
|
|
||||||
# Set the rest of the software in the main package
|
# Set the rest of the software in the main package
|
||||||
#
|
#
|
||||||
cp -rp $(TEMPTOP)/usr $(TOP)
|
cp -rp $(TEMPTOP)/usr $(TOP)
|
||||||
|
@ -230,13 +242,6 @@ override_dh_install:
|
||||||
packaging/bundle-ebpf.sh . ${TOP}-ebpf-code-legacy/usr/libexec/netdata/plugins.d/ force; \
|
packaging/bundle-ebpf.sh . ${TOP}-ebpf-code-legacy/usr/libexec/netdata/plugins.d/ force; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Install go to it's own package directory
|
|
||||||
#
|
|
||||||
mkdir -p $(TOP)-plugin-go/usr/lib/netdata/conf.d
|
|
||||||
mkdir -p $(TOP)-plugin-go/usr/libexec/netdata/plugins.d
|
|
||||||
debian/install_go.sh $$(cat ${CURDIR}/packaging/go.d.version) \
|
|
||||||
$(TOP)-plugin-go/usr/lib/netdata \
|
|
||||||
$(TOP)-plugin-go/usr/libexec/netdata
|
|
||||||
|
|
||||||
override_dh_installdocs:
|
override_dh_installdocs:
|
||||||
dh_installdocs
|
dh_installdocs
|
||||||
|
|
|
@ -5,30 +5,26 @@ import re
|
||||||
|
|
||||||
# Dictionary responsible for making the symbolic links at the end of the script's run.
|
# Dictionary responsible for making the symbolic links at the end of the script's run.
|
||||||
symlink_dict = {}
|
symlink_dict = {}
|
||||||
am_i_inside_go = "go.d.plugin" in str(Path.cwd())
|
|
||||||
|
|
||||||
|
|
||||||
def cleanup():
|
def cleanup():
|
||||||
"""
|
"""
|
||||||
clean directories that are either data collection or exporting integrations
|
clean directories that are either data collection or exporting integrations
|
||||||
"""
|
"""
|
||||||
if am_i_inside_go:
|
for element in Path("src/go/collectors/go.d.plugin/modules").glob('**/*/'):
|
||||||
for element in Path("modules").glob('**/*/'):
|
if "integrations" in str(element):
|
||||||
if "integrations" in str(element):
|
shutil.rmtree(element)
|
||||||
shutil.rmtree(element)
|
for element in Path("src/collectors").glob('**/*/'):
|
||||||
else:
|
# print(element)
|
||||||
for element in Path("src/collectors").glob('**/*/'):
|
if "integrations" in str(element):
|
||||||
# print(element)
|
shutil.rmtree(element)
|
||||||
if "integrations" in str(element):
|
|
||||||
shutil.rmtree(element)
|
|
||||||
|
|
||||||
for element in Path("src/exporting").glob('**/*/'):
|
|
||||||
if "integrations" in str(element):
|
|
||||||
shutil.rmtree(element)
|
|
||||||
for element in Path("integrations/cloud-notifications").glob('**/*/'):
|
|
||||||
if "integrations" in str(element) and not "metadata.yaml" in str(element):
|
|
||||||
shutil.rmtree(element)
|
|
||||||
|
|
||||||
|
for element in Path("src/exporting").glob('**/*/'):
|
||||||
|
if "integrations" in str(element):
|
||||||
|
shutil.rmtree(element)
|
||||||
|
for element in Path("integrations/cloud-notifications").glob('**/*/'):
|
||||||
|
if "integrations" in str(element) and not "metadata.yaml" in str(element):
|
||||||
|
shutil.rmtree(element)
|
||||||
|
|
||||||
def generate_category_from_name(category_fragment, category_array):
|
def generate_category_from_name(category_fragment, category_array):
|
||||||
"""
|
"""
|
||||||
|
@ -368,7 +364,7 @@ for integration in integrations:
|
||||||
path = build_path(meta_yaml)
|
path = build_path(meta_yaml)
|
||||||
write_to_file(path, md, meta_yaml, sidebar_label, community)
|
write_to_file(path, md, meta_yaml, sidebar_label, community)
|
||||||
|
|
||||||
elif not am_i_inside_go:
|
else:
|
||||||
# kind of specific if clause, so we can avoid running excessive code in the go repo
|
# kind of specific if clause, so we can avoid running excessive code in the go repo
|
||||||
if integration['integration_type'] == "exporter":
|
if integration['integration_type'] == "exporter":
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@ from referencing.jsonschema import DRAFT7
|
||||||
from ruamel.yaml import YAML, YAMLError
|
from ruamel.yaml import YAML, YAMLError
|
||||||
|
|
||||||
AGENT_REPO = 'netdata/netdata'
|
AGENT_REPO = 'netdata/netdata'
|
||||||
GO_REPO = 'netdata/go.d.plugin'
|
|
||||||
|
|
||||||
INTEGRATIONS_PATH = Path(__file__).parent
|
INTEGRATIONS_PATH = Path(__file__).parent
|
||||||
TEMPLATE_PATH = INTEGRATIONS_PATH / 'templates'
|
TEMPLATE_PATH = INTEGRATIONS_PATH / 'templates'
|
||||||
|
@ -23,7 +22,6 @@ JSON_PATH = INTEGRATIONS_PATH / 'integrations.json'
|
||||||
CATEGORIES_FILE = INTEGRATIONS_PATH / 'categories.yaml'
|
CATEGORIES_FILE = INTEGRATIONS_PATH / 'categories.yaml'
|
||||||
REPO_PATH = INTEGRATIONS_PATH.parent
|
REPO_PATH = INTEGRATIONS_PATH.parent
|
||||||
SCHEMA_PATH = INTEGRATIONS_PATH / 'schemas'
|
SCHEMA_PATH = INTEGRATIONS_PATH / 'schemas'
|
||||||
GO_REPO_PATH = REPO_PATH / 'go.d.plugin'
|
|
||||||
DISTROS_FILE = REPO_PATH / '.github' / 'data' / 'distros.yml'
|
DISTROS_FILE = REPO_PATH / '.github' / 'data' / 'distros.yml'
|
||||||
METADATA_PATTERN = '*/metadata.yaml'
|
METADATA_PATTERN = '*/metadata.yaml'
|
||||||
|
|
||||||
|
@ -31,7 +29,7 @@ COLLECTOR_SOURCES = [
|
||||||
(AGENT_REPO, REPO_PATH / 'src' / 'collectors', True),
|
(AGENT_REPO, REPO_PATH / 'src' / 'collectors', True),
|
||||||
(AGENT_REPO, REPO_PATH / 'src' / 'collectors' / 'charts.d.plugin', True),
|
(AGENT_REPO, REPO_PATH / 'src' / 'collectors' / 'charts.d.plugin', True),
|
||||||
(AGENT_REPO, REPO_PATH / 'src' / 'collectors' / 'python.d.plugin', True),
|
(AGENT_REPO, REPO_PATH / 'src' / 'collectors' / 'python.d.plugin', True),
|
||||||
(GO_REPO, GO_REPO_PATH / 'modules', True),
|
(AGENT_REPO, REPO_PATH / 'src' / 'go' / 'collectors' / 'go.d.plugin' / 'modules', True),
|
||||||
]
|
]
|
||||||
|
|
||||||
DEPLOY_SOURCES = [
|
DEPLOY_SOURCES = [
|
||||||
|
@ -399,10 +397,7 @@ def make_id(meta):
|
||||||
|
|
||||||
|
|
||||||
def make_edit_link(item):
|
def make_edit_link(item):
|
||||||
if item['_repo'] == 'netdata/go.d.plugin':
|
item_path = item['_src_path'].relative_to(REPO_PATH)
|
||||||
item_path = item['_src_path'].relative_to(GO_REPO_PATH)
|
|
||||||
else:
|
|
||||||
item_path = item['_src_path'].relative_to(REPO_PATH)
|
|
||||||
|
|
||||||
return f'https://github.com/{ item["_repo"] }/blob/master/{ item_path }'
|
return f'https://github.com/{ item["_repo"] }/blob/master/{ item_path }'
|
||||||
|
|
||||||
|
|
|
@ -102,10 +102,6 @@ print_deferred_errors() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
download_go() {
|
|
||||||
download_file "${1}" "${2}" "go.d plugin" "go"
|
|
||||||
}
|
|
||||||
|
|
||||||
# make sure we save all commands we run
|
# make sure we save all commands we run
|
||||||
# Variable is used by code in the packaging/installer/functions.sh
|
# Variable is used by code in the packaging/installer/functions.sh
|
||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
|
@ -205,7 +201,6 @@ USAGE: ${PROGRAM} [options]
|
||||||
This results in less frequent updates.
|
This results in less frequent updates.
|
||||||
--nightly-channel Use most recent nightly updates instead of GitHub releases.
|
--nightly-channel Use most recent nightly updates instead of GitHub releases.
|
||||||
This results in more frequent updates.
|
This results in more frequent updates.
|
||||||
--disable-go Disable installation of go.d.plugin.
|
|
||||||
--disable-ebpf Disable eBPF Kernel plugin. Default: enabled.
|
--disable-ebpf Disable eBPF Kernel plugin. Default: enabled.
|
||||||
--disable-cloud Disable all Netdata Cloud functionality.
|
--disable-cloud Disable all Netdata Cloud functionality.
|
||||||
--require-cloud Fail the install if it can't build Netdata Cloud support.
|
--require-cloud Fail the install if it can't build Netdata Cloud support.
|
||||||
|
@ -214,6 +209,9 @@ USAGE: ${PROGRAM} [options]
|
||||||
--disable-plugin-freeipmi Explicitly disable the FreeIPMI plugin.
|
--disable-plugin-freeipmi Explicitly disable the FreeIPMI plugin.
|
||||||
--disable-https Explicitly disable TLS support.
|
--disable-https Explicitly disable TLS support.
|
||||||
--disable-dbengine Explicitly disable DB engine support.
|
--disable-dbengine Explicitly disable DB engine support.
|
||||||
|
--enable-plugin-go Enable the Go plugin. Default: Enabled when possible.
|
||||||
|
--disable-plugin-go Disable the Go plugin.
|
||||||
|
--disable-go Equivalent to --disable-go-plugin
|
||||||
--enable-plugin-nfacct Enable nfacct plugin. Default: enable it when libmnl and libnetfilter_acct are available.
|
--enable-plugin-nfacct Enable nfacct plugin. Default: enable it when libmnl and libnetfilter_acct are available.
|
||||||
--disable-plugin-nfacct Explicitly disable the nfacct plugin.
|
--disable-plugin-nfacct Explicitly disable the nfacct plugin.
|
||||||
--enable-plugin-xenstat Enable the xenstat plugin. Default: enable it when libxenstat and libyajl are available.
|
--enable-plugin-xenstat Enable the xenstat plugin. Default: enable it when libxenstat and libyajl are available.
|
||||||
|
@ -254,6 +252,7 @@ LIBS_ARE_HERE=0
|
||||||
NETDATA_ENABLE_ML=""
|
NETDATA_ENABLE_ML=""
|
||||||
ENABLE_DBENGINE=1
|
ENABLE_DBENGINE=1
|
||||||
ENABLE_EBPF=1
|
ENABLE_EBPF=1
|
||||||
|
ENABLE_GO=1
|
||||||
ENABLE_H2O=1
|
ENABLE_H2O=1
|
||||||
ENABLE_CLOUD=1
|
ENABLE_CLOUD=1
|
||||||
ENABLE_LOGS_MANAGEMENT=1
|
ENABLE_LOGS_MANAGEMENT=1
|
||||||
|
@ -284,6 +283,9 @@ while [ -n "${1}" ]; do
|
||||||
ENABLE_CLOUD=0
|
ENABLE_CLOUD=0
|
||||||
;;
|
;;
|
||||||
"--disable-dbengine") ENABLE_DBENGINE=0 ;;
|
"--disable-dbengine") ENABLE_DBENGINE=0 ;;
|
||||||
|
"--enable-plugin-go") ENABLE_GO=1 ;;
|
||||||
|
"--disable-plugin-go") ENABLE_GO=0 ;;
|
||||||
|
"--disable-go") ENABLE_GO=0 ;;
|
||||||
"--enable-plugin-nfacct") ENABLE_NFACCT=1 ;;
|
"--enable-plugin-nfacct") ENABLE_NFACCT=1 ;;
|
||||||
"--disable-plugin-nfacct") ENABLE_NFACCT=0 ;;
|
"--disable-plugin-nfacct") ENABLE_NFACCT=0 ;;
|
||||||
"--enable-plugin-xenstat") ENABLE_XENSTAT=1 ;;
|
"--enable-plugin-xenstat") ENABLE_XENSTAT=1 ;;
|
||||||
|
@ -321,7 +323,6 @@ while [ -n "${1}" ]; do
|
||||||
# XXX: No longer supported.
|
# XXX: No longer supported.
|
||||||
;;
|
;;
|
||||||
"--disable-telemetry") NETDATA_DISABLE_TELEMETRY=1 ;;
|
"--disable-telemetry") NETDATA_DISABLE_TELEMETRY=1 ;;
|
||||||
"--disable-go") NETDATA_DISABLE_GO=1 ;;
|
|
||||||
"--enable-ebpf")
|
"--enable-ebpf")
|
||||||
ENABLE_EBPF=1
|
ENABLE_EBPF=1
|
||||||
NETDATA_DISABLE_EBPF=0
|
NETDATA_DISABLE_EBPF=0
|
||||||
|
@ -1039,6 +1040,18 @@ bundle_fluentbit() {
|
||||||
|
|
||||||
bundle_fluentbit
|
bundle_fluentbit
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
# If we’re installing the Go plugin, ensure a working Go toolchain is installed.
|
||||||
|
if [ "${ENABLE_GO}" -eq 1 ]; then
|
||||||
|
progress "Checking for a usable Go toolchain and attempting to install one to /usr/local/go if needed."
|
||||||
|
. "${NETDATA_SOURCE_DIR}/packaging/check-for-go-toolchain.sh"
|
||||||
|
|
||||||
|
if ! ensure_go_toolchain; then
|
||||||
|
warning "Go ${GOLANG_MIN_VERSION} needed to build Go plugin, but could not find or install a usable toolchain: ${GOLANG_FAILURE_REASON}"
|
||||||
|
ENABLE_GO=0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# If we have the dashboard switching logic, make sure we're on the classic
|
# If we have the dashboard switching logic, make sure we're on the classic
|
||||||
# dashboard during the install (updates don't work correctly otherwise).
|
# dashboard during the install (updates don't work correctly otherwise).
|
||||||
|
@ -1429,6 +1442,22 @@ if [ "$(id -u)" -eq 0 ]; then
|
||||||
run chmod 4750 "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/ndsudo"
|
run chmod 4750 "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/ndsudo"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -f "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/go.d.plugin" ]; then
|
||||||
|
run chown "root:${NETDATA_GROUP}" "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/go.d.plugin"
|
||||||
|
capabilities=1
|
||||||
|
if ! iscontainer && command -v setcap 1> /dev/null 2>&1; then
|
||||||
|
run chmod 0750 "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/go.d.plugin"
|
||||||
|
if ! run setcap "cap_dac_read_search+epi cap_net_admin+epi cap_net_raw=eip" "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/go.d.plugin"; then
|
||||||
|
capabilities=0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $capabilities -eq 0 ]; then
|
||||||
|
# fix go.d.plugin to be setuid to root
|
||||||
|
run chmod 4750 "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/go.d.plugin"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
# non-privileged user installation
|
# non-privileged user installation
|
||||||
run chown "${NETDATA_USER}:${NETDATA_GROUP}" "${NETDATA_LOG_DIR}"
|
run chown "${NETDATA_USER}:${NETDATA_GROUP}" "${NETDATA_LOG_DIR}"
|
||||||
|
@ -1439,167 +1468,6 @@ fi
|
||||||
|
|
||||||
[ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
|
[ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# govercomp compares go.d.plugin versions. Exit codes:
|
|
||||||
# 0 - version1 == version2
|
|
||||||
# 1 - version1 > version2
|
|
||||||
# 2 - version2 > version1
|
|
||||||
# 3 - error
|
|
||||||
|
|
||||||
# shellcheck disable=SC2086
|
|
||||||
govercomp() {
|
|
||||||
# version in file:
|
|
||||||
# - v0.14.0
|
|
||||||
#
|
|
||||||
# 'go.d.plugin -v' output variants:
|
|
||||||
# - go.d.plugin, version: unknown
|
|
||||||
# - go.d.plugin, version: v0.14.1
|
|
||||||
# - go.d.plugin, version: v0.14.1-dirty
|
|
||||||
# - go.d.plugin, version: v0.14.1-1-g4c5f98c
|
|
||||||
# - go.d.plugin, version: v0.14.1-1-g4c5f98c-dirty
|
|
||||||
|
|
||||||
# we need to compare only MAJOR.MINOR.PATCH part
|
|
||||||
ver1=$(echo "$1" | grep -E -o "[0-9]+\.[0-9]+\.[0-9]+")
|
|
||||||
ver2=$(echo "$2" | grep -E -o "[0-9]+\.[0-9]+\.[0-9]+")
|
|
||||||
|
|
||||||
if [ ${#ver1} -eq 0 ] || [ ${#ver2} -eq 0 ]; then
|
|
||||||
return 3
|
|
||||||
fi
|
|
||||||
|
|
||||||
num1=$(echo $ver1 | grep -o -E '\.' | wc -l)
|
|
||||||
num2=$(echo $ver2 | grep -o -E '\.' | wc -l)
|
|
||||||
|
|
||||||
if [ ${num1} -ne ${num2} ]; then
|
|
||||||
return 3
|
|
||||||
fi
|
|
||||||
|
|
||||||
for i in $(seq 1 $((num1+1))); do
|
|
||||||
x=$(echo $ver1 | cut -d'.' -f$i)
|
|
||||||
y=$(echo $ver2 | cut -d'.' -f$i)
|
|
||||||
if [ "${x}" -gt "${y}" ]; then
|
|
||||||
return 1
|
|
||||||
elif [ "${y}" -gt "${x}" ]; then
|
|
||||||
return 2
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
should_install_go() {
|
|
||||||
if [ -n "${NETDATA_DISABLE_GO+x}" ]; then
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
version_in_file="$(cat packaging/go.d.version 2> /dev/null)"
|
|
||||||
binary_version=$("${NETDATA_PREFIX}"/usr/libexec/netdata/plugins.d/go.d.plugin -v 2> /dev/null)
|
|
||||||
|
|
||||||
govercomp "$version_in_file" "$binary_version"
|
|
||||||
case $? in
|
|
||||||
0) return 1 ;; # =
|
|
||||||
2) return 1 ;; # <
|
|
||||||
*) return 0 ;; # >, error
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
install_go() {
|
|
||||||
if ! should_install_go; then
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
[ -n "${GITHUB_ACTIONS}" ] && echo "::group::Installing go.d.plugin."
|
|
||||||
|
|
||||||
# When updating this value, ensure correct checksums in packaging/go.d.checksums
|
|
||||||
GO_PACKAGE_VERSION="$(cat packaging/go.d.version)"
|
|
||||||
ARCH_MAP='
|
|
||||||
i386::386
|
|
||||||
i686::386
|
|
||||||
x86_64::amd64
|
|
||||||
aarch64::arm64
|
|
||||||
armv64::arm64
|
|
||||||
armv6l::arm
|
|
||||||
armv7l::arm
|
|
||||||
armv5tel::arm
|
|
||||||
'
|
|
||||||
|
|
||||||
progress "Install go.d.plugin"
|
|
||||||
ARCH=$(uname -m)
|
|
||||||
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
|
|
||||||
|
|
||||||
for index in ${ARCH_MAP}; do
|
|
||||||
KEY="${index%%::*}"
|
|
||||||
VALUE="${index##*::}"
|
|
||||||
if [ "$KEY" = "$ARCH" ]; then
|
|
||||||
ARCH="${VALUE}"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
tmp="$(mktemp -d -t netdata-go-XXXXXX)"
|
|
||||||
GO_PACKAGE_BASENAME="go.d.plugin-${GO_PACKAGE_VERSION}.${OS}-${ARCH}.tar.gz"
|
|
||||||
|
|
||||||
if [ -z "${NETDATA_LOCAL_TARBALL_OVERRIDE_GO_PLUGIN}" ]; then
|
|
||||||
download_go "https://github.com/netdata/go.d.plugin/releases/download/${GO_PACKAGE_VERSION}/${GO_PACKAGE_BASENAME}" "${tmp}/${GO_PACKAGE_BASENAME}"
|
|
||||||
else
|
|
||||||
progress "Using provided go.d tarball ${NETDATA_LOCAL_TARBALL_OVERRIDE_GO_PLUGIN}"
|
|
||||||
run cp "${NETDATA_LOCAL_TARBALL_OVERRIDE_GO_PLUGIN}" "${tmp}/${GO_PACKAGE_BASENAME}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${NETDATA_LOCAL_TARBALL_OVERRIDE_GO_PLUGIN_CONFIG}" ]; then
|
|
||||||
download_go "https://github.com/netdata/go.d.plugin/releases/download/${GO_PACKAGE_VERSION}/config.tar.gz" "${tmp}/config.tar.gz"
|
|
||||||
else
|
|
||||||
progress "Using provided config file for go.d ${NETDATA_LOCAL_TARBALL_OVERRIDE_GO_PLUGIN_CONFIG}"
|
|
||||||
run cp "${NETDATA_LOCAL_TARBALL_OVERRIDE_GO_PLUGIN_CONFIG}" "${tmp}/config.tar.gz"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -f "${tmp}/${GO_PACKAGE_BASENAME}" ] || [ ! -f "${tmp}/config.tar.gz" ] || [ ! -s "${tmp}/config.tar.gz" ] || [ ! -s "${tmp}/${GO_PACKAGE_BASENAME}" ]; then
|
|
||||||
run_failed "go.d plugin download failed, go.d plugin will not be available"
|
|
||||||
echo >&2 "Either check the error or consider disabling it by issuing '--disable-go' in the installer"
|
|
||||||
echo >&2
|
|
||||||
[ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
grep "${GO_PACKAGE_BASENAME}\$" "${INSTALLER_DIR}/packaging/go.d.checksums" > "${tmp}/sha256sums.txt" 2> /dev/null
|
|
||||||
grep "config.tar.gz" "${INSTALLER_DIR}/packaging/go.d.checksums" >> "${tmp}/sha256sums.txt" 2> /dev/null
|
|
||||||
|
|
||||||
# Checksum validation
|
|
||||||
if ! (cd "${tmp}" && safe_sha256sum -c "sha256sums.txt"); then
|
|
||||||
|
|
||||||
echo >&2 "go.d plugin checksum validation failure."
|
|
||||||
echo >&2 "Either check the error or consider disabling it by issuing '--disable-go' in the installer"
|
|
||||||
echo >&2
|
|
||||||
|
|
||||||
run_failed "go.d.plugin package files checksum validation failed. go.d.plugin will not be available."
|
|
||||||
[ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Install new files
|
|
||||||
run rm -rf "${NETDATA_STOCK_CONFIG_DIR}/go.d"
|
|
||||||
run rm -rf "${NETDATA_STOCK_CONFIG_DIR}/go.d.conf"
|
|
||||||
run tar --no-same-owner -xf "${tmp}/config.tar.gz" -C "${NETDATA_STOCK_CONFIG_DIR}/"
|
|
||||||
run chown -R "${ROOT_USER}:${ROOT_GROUP}" "${NETDATA_STOCK_CONFIG_DIR}"
|
|
||||||
|
|
||||||
run tar --no-same-owner -xf "${tmp}/${GO_PACKAGE_BASENAME}"
|
|
||||||
run mv "${GO_PACKAGE_BASENAME%.tar.gz}" "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/go.d.plugin"
|
|
||||||
if [ "$(id -u)" -eq 0 ]; then
|
|
||||||
run chown "root:${NETDATA_GROUP}" "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/go.d.plugin"
|
|
||||||
fi
|
|
||||||
run chmod 0750 "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/go.d.plugin"
|
|
||||||
rm -rf "${tmp}"
|
|
||||||
|
|
||||||
[ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
|
|
||||||
}
|
|
||||||
|
|
||||||
install_go
|
|
||||||
|
|
||||||
if [ -f "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/go.d.plugin" ]; then
|
|
||||||
if command -v setcap 1>/dev/null 2>&1; then
|
|
||||||
run setcap "cap_dac_read_search+epi cap_net_admin+epi cap_net_raw=eip" "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/go.d.plugin"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
should_install_ebpf() {
|
should_install_ebpf() {
|
||||||
if [ "${NETDATA_DISABLE_EBPF:=0}" -eq 1 ]; then
|
if [ "${NETDATA_DISABLE_EBPF:=0}" -eq 1 ]; then
|
||||||
run_failed "eBPF has been explicitly disabled, it will not be available in this install."
|
run_failed "eBPF has been explicitly disabled, it will not be available in this install."
|
||||||
|
|
159
netdata.spec.in
159
netdata.spec.in
|
@ -1,8 +1,6 @@
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
%global contentdir %{_datadir}/netdata
|
%global contentdir %{_datadir}/netdata
|
||||||
%global version @PACKAGE_VERSION@
|
%global version @PACKAGE_VERSION@
|
||||||
%global go_version @GO_PACKAGE_VERSION@
|
|
||||||
%global go_name go.d.plugin
|
|
||||||
|
|
||||||
# XXX: We are using automatic `Requires:` generation for libraries
|
# XXX: We are using automatic `Requires:` generation for libraries
|
||||||
# whenever possible, DO NOT LIST LIBRARY DEPENDENCIES UNLESS THE RESULTANT
|
# whenever possible, DO NOT LIST LIBRARY DEPENDENCIES UNLESS THE RESULTANT
|
||||||
|
@ -14,6 +12,11 @@ AutoReqProv: yes
|
||||||
# error.
|
# error.
|
||||||
%global __os_install_post %{nil}
|
%global __os_install_post %{nil}
|
||||||
|
|
||||||
|
# This is needed to support proper handling of Go code without requiring
|
||||||
|
# external linking or GCCGO, because even recent versions of rpmbuild do
|
||||||
|
# not properly support the build IDs generated by the upstream Go toolchain.
|
||||||
|
%global _missing_build_ids_terminate_build 0
|
||||||
|
|
||||||
# Use our custom CMake version from our package builders if we can’t find cmake.
|
# Use our custom CMake version from our package builders if we can’t find cmake.
|
||||||
%if 0%{?centos_ver} == 7
|
%if 0%{?centos_ver} == 7
|
||||||
%global __cmake /cmake/bin/cmake
|
%global __cmake /cmake/bin/cmake
|
||||||
|
@ -39,18 +42,6 @@ AutoReqProv: yes
|
||||||
%global __cmake_builddir %{__builddir}
|
%global __cmake_builddir %{__builddir}
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
# Disable go.d.plugin build on outdated golang distros
|
|
||||||
%if 0
|
|
||||||
%if 0%{?centos_ver:1}
|
|
||||||
%if 0%{?centos_ver} >= 10 && 0%{?almalinux_ver:1} && 0%{?rocky_ver:1}
|
|
||||||
%global _golang_build 1
|
|
||||||
%else
|
|
||||||
%global _golang_build 0
|
|
||||||
%global _missing_build_ids_terminate_build 0
|
|
||||||
%endif
|
|
||||||
%endif
|
|
||||||
%endif
|
|
||||||
|
|
||||||
# Disable eBPF for architectures other than x86
|
# Disable eBPF for architectures other than x86
|
||||||
%ifarch x86_64 i386
|
%ifarch x86_64 i386
|
||||||
%global _have_ebpf 1
|
%global _have_ebpf 1
|
||||||
|
@ -125,8 +116,6 @@ Release: 1%{?dist}
|
||||||
License: GPLv3+
|
License: GPLv3+
|
||||||
Group: Applications/System
|
Group: Applications/System
|
||||||
Source0: https://github.com/%{name}/%{name}/releases/download/%{version}/%{name}-%{version}.tar.gz
|
Source0: https://github.com/%{name}/%{name}/releases/download/%{version}/%{name}-%{version}.tar.gz
|
||||||
Source1: https://github.com/%{name}/%{go_name}/releases/download/v%{go_version}/config.tar.gz
|
|
||||||
Source2: https://github.com/%{name}/%{go_name}/archive/refs/tags/v%{go_version}.tar.gz
|
|
||||||
URL: http://my-%{name}.io
|
URL: http://my-%{name}.io
|
||||||
|
|
||||||
# Remove conflicting EPEL packages
|
# Remove conflicting EPEL packages
|
||||||
|
@ -260,11 +249,17 @@ BuildRequires: cups-devel
|
||||||
# end - cups plugin dependencies
|
# end - cups plugin dependencies
|
||||||
|
|
||||||
# go.d.plugin dependencies
|
# go.d.plugin dependencies
|
||||||
%if 0%{?_golang_build}
|
#
|
||||||
|
# The conditional here is checking for a macro we define in our package
|
||||||
|
# builders. If it’s defined, then we’ve injected an upstream copy of
|
||||||
|
# the Go toolchain, so we don’t need the package installed (which
|
||||||
|
# is needed because Go’s development model is at odds with enterprise
|
||||||
|
# distro handling of versioning).
|
||||||
|
%if %{?_upstream_go_toolchain:0}%{!?_upstream_go_toolchain:1}
|
||||||
%if 0%{?suse_version}
|
%if 0%{?suse_version}
|
||||||
BuildRequires: go
|
BuildRequires: go >= 1.21
|
||||||
%else
|
%else
|
||||||
BuildRequires: golang
|
BuildRequires: golang >= 1.21
|
||||||
%endif
|
%endif
|
||||||
%endif
|
%endif
|
||||||
# end - go.d.plugin plugin dependencies
|
# end - go.d.plugin plugin dependencies
|
||||||
|
@ -339,15 +334,6 @@ export CFLAGS="${CFLAGS} -fPIC" && ${RPM_BUILD_DIR}/%{name}-%{version}/packaging
|
||||||
%endif
|
%endif
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
# go.d.plugin
|
|
||||||
%if 0%{?_golang_build}
|
|
||||||
mkdir -p "%{_builddir}/%{go_name}"
|
|
||||||
tar -xzf "%{SOURCE1}" -C "%{_builddir}/%{go_name}"
|
|
||||||
tar -xzf "%{SOURCE2}" -C "%{_builddir}/%{go_name}"
|
|
||||||
cd "%{_builddir}/%{go_name}/%{go_name}-%{go_version}"
|
|
||||||
make download
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
# Conf step
|
# Conf step
|
||||||
%cmake -G Ninja \
|
%cmake -G Ninja \
|
||||||
|
@ -408,6 +394,7 @@ make download
|
||||||
-DENABLE_PLUGIN_APPS=On \
|
-DENABLE_PLUGIN_APPS=On \
|
||||||
-DENABLE_PLUGIN_CGROUP_NETWORK=On \
|
-DENABLE_PLUGIN_CGROUP_NETWORK=On \
|
||||||
-DENABLE_PLUGIN_DEBUGFS=On \
|
-DENABLE_PLUGIN_DEBUGFS=On \
|
||||||
|
-DENABLE_PLUGIN_GO=On \
|
||||||
-DENABLE_PLUGIN_LOCAL_LISTENERS=On \
|
-DENABLE_PLUGIN_LOCAL_LISTENERS=On \
|
||||||
-DENABLE_PLUGIN_PERF=On \
|
-DENABLE_PLUGIN_PERF=On \
|
||||||
-DENABLE_PLUGIN_SLABINFO=On \
|
-DENABLE_PLUGIN_SLABINFO=On \
|
||||||
|
@ -420,13 +407,6 @@ make download
|
||||||
# Build step
|
# Build step
|
||||||
%{cmake_build}
|
%{cmake_build}
|
||||||
|
|
||||||
# Build go.d.plugin
|
|
||||||
%if 0%{?_golang_build}
|
|
||||||
cd "%{_builddir}/%{go_name}/%{go_name}-%{go_version}"
|
|
||||||
sed -i 's|CGO_ENABLED=0 ||' "hack/go-build.sh"
|
|
||||||
TRAVIS_TAG="%{go_version}" %{__make} build
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%install
|
%install
|
||||||
|
|
||||||
# ###########################################################
|
# ###########################################################
|
||||||
|
@ -471,111 +451,6 @@ install -m 644 -p "%{__cmake_builddir}/system/systemd/%{name}.service.v235" "${R
|
||||||
install -m 755 -d "${RPM_BUILD_ROOT}%{_presetdir}"
|
install -m 755 -d "${RPM_BUILD_ROOT}%{_presetdir}"
|
||||||
install -m 644 -p "system/systemd/50-%{name}.preset" "${RPM_BUILD_ROOT}%{_presetdir}/50-%{name}.preset"
|
install -m 644 -p "system/systemd/50-%{name}.preset" "${RPM_BUILD_ROOT}%{_presetdir}/50-%{name}.preset"
|
||||||
|
|
||||||
# ############################################################
|
|
||||||
# Package Go within netdata
|
|
||||||
|
|
||||||
# Install builded go.d.plugin
|
|
||||||
%if 0%{?_golang_build}
|
|
||||||
install -m 0640 "%{_builddir}/%{go_name}/%{go_name}-%{go_version}/bin/godplugin" \
|
|
||||||
"${RPM_BUILD_ROOT}%{_libexecdir}/%{name}/plugins.d/%{go_name}"
|
|
||||||
cp -r "%{_builddir}/%{go_name}/go.d.conf" "%{_builddir}/%{go_name}/go.d" \
|
|
||||||
"${RPM_BUILD_ROOT}%{_libdir}/%{name}/conf.d/"
|
|
||||||
%else
|
|
||||||
# Install binary go.d.plugin
|
|
||||||
safe_sha256sum() {
|
|
||||||
# Within the context of the installer, we only use -c option that is common between the two commands
|
|
||||||
# We will have to reconsider if we start non-common options
|
|
||||||
if command -v sha256sum >/dev/null 2>&1; then
|
|
||||||
sha256sum $@
|
|
||||||
elif command -v shasum >/dev/null 2>&1; then
|
|
||||||
shasum -a 256 $@
|
|
||||||
else
|
|
||||||
fatal "I could not find a suitable checksum binary to use"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
download_go() {
|
|
||||||
url="${1}"
|
|
||||||
dest="${2}"
|
|
||||||
|
|
||||||
if command -v curl >/dev/null 2>&1; then
|
|
||||||
curl -sSL --connect-timeout 10 --retry 3 "${url}" > "${dest}"
|
|
||||||
elif command -v wget >/dev/null 2>&1; then
|
|
||||||
wget -T 15 -O - "${url}" > "${dest}"
|
|
||||||
else
|
|
||||||
echo >&2
|
|
||||||
echo >&2 "Downloading go.d plugin from '${url}' failed because of missing mandatory packages."
|
|
||||||
echo >&2 "Either add packages or disable it by issuing '--disable-go' in the installer"
|
|
||||||
echo >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
install_go() {
|
|
||||||
# When updating this value, ensure correct checksums in packaging/go.d.checksums
|
|
||||||
GO_PACKAGE_VERSION="$(cat packaging/go.d.version)"
|
|
||||||
ARCH_MAP=(
|
|
||||||
'i386::386'
|
|
||||||
'i686::386'
|
|
||||||
'x86_64::amd64'
|
|
||||||
'aarch64::arm64'
|
|
||||||
'armv64::arm64'
|
|
||||||
'armv6l::arm'
|
|
||||||
'armv7l::arm'
|
|
||||||
'armv5tel::arm'
|
|
||||||
)
|
|
||||||
|
|
||||||
if [ -z "${NETDATA_DISABLE_GO+x}" ]; then
|
|
||||||
ARCH="%{_arch}"
|
|
||||||
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
|
|
||||||
|
|
||||||
echo >&2 "Install go.d.plugin (ARCH=${ARCH}, OS=${OS})"
|
|
||||||
|
|
||||||
for index in "${ARCH_MAP[@]}" ; do
|
|
||||||
KEY="${index%%::*}"
|
|
||||||
VALUE="${index##*::}"
|
|
||||||
if [ "$KEY" = "$ARCH" ]; then
|
|
||||||
ARCH="${VALUE}"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
tmp=$(mktemp -d /tmp/netdata-go-XXXXXX)
|
|
||||||
GO_PACKAGE_BASENAME="go.d.plugin-${GO_PACKAGE_VERSION}.${OS}-${ARCH}.tar.gz"
|
|
||||||
download_go "https://github.com/netdata/go.d.plugin/releases/download/${GO_PACKAGE_VERSION}/${GO_PACKAGE_BASENAME}" "${tmp}/${GO_PACKAGE_BASENAME}"
|
|
||||||
download_go "https://github.com/netdata/go.d.plugin/releases/download/${GO_PACKAGE_VERSION}/config.tar.gz" "${tmp}/config.tar.gz"
|
|
||||||
|
|
||||||
if [ ! -f "${tmp}/${GO_PACKAGE_BASENAME}" ] || [ ! -f "${tmp}/config.tar.gz" ] || [ ! -s "${tmp}/config.tar.gz" ] || [ ! -s "${tmp}/${GO_PACKAGE_BASENAME}" ]; then
|
|
||||||
echo >&2 "Either check the error or consider disabling it by issuing '--disable-go' in the installer"
|
|
||||||
echo >&2
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
grep "${GO_PACKAGE_BASENAME}\$" "packaging/go.d.checksums" > "${tmp}/sha256sums.txt" 2>/dev/null
|
|
||||||
grep "config.tar.gz" "packaging/go.d.checksums" >> "${tmp}/sha256sums.txt" 2>/dev/null
|
|
||||||
|
|
||||||
# Checksum validation
|
|
||||||
if ! (cd "${tmp}" && safe_sha256sum -c "sha256sums.txt"); then
|
|
||||||
|
|
||||||
echo >&2 "go.d plugin checksum validation failure."
|
|
||||||
echo >&2 "Either check the error or consider disabling it by issuing '--disable-go' in the installer"
|
|
||||||
echo >&2
|
|
||||||
|
|
||||||
echo "go.d.plugin package files checksum validation failed."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Install files
|
|
||||||
tar -xf "${tmp}/config.tar.gz" -C "${RPM_BUILD_ROOT}%{_libdir}/%{name}/conf.d/"
|
|
||||||
tar xf "${tmp}/${GO_PACKAGE_BASENAME}"
|
|
||||||
mv "${GO_PACKAGE_BASENAME/\.tar\.gz/}" "go.d.plugin"
|
|
||||||
rm -rf "${tmp}"
|
|
||||||
fi
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
install_go
|
|
||||||
install -m 0640 -p "%{go_name}" "${RPM_BUILD_ROOT}%{_libexecdir}/%{name}/plugins.d/%{go_name}"
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%if 0%{?_have_ebpf}
|
%if 0%{?_have_ebpf}
|
||||||
${RPM_BUILD_DIR}/%{name}-%{version}/packaging/bundle-ebpf.sh ${RPM_BUILD_DIR}/%{name}-%{version} \
|
${RPM_BUILD_DIR}/%{name}-%{version}/packaging/bundle-ebpf.sh ${RPM_BUILD_DIR}/%{name}-%{version} \
|
||||||
${RPM_BUILD_ROOT}%{_libexecdir}/%{name}/plugins.d
|
${RPM_BUILD_ROOT}%{_libexecdir}/%{name}/plugins.d
|
||||||
|
@ -729,7 +604,7 @@ rm -rf "${RPM_BUILD_ROOT}"
|
||||||
%exclude %{_libdir}/%{name}/conf.d/python.d
|
%exclude %{_libdir}/%{name}/conf.d/python.d
|
||||||
|
|
||||||
# Go.d belongs to a different sub-package
|
# Go.d belongs to a different sub-package
|
||||||
%exclude %{_libexecdir}/%{name}/plugins.d/%{go_name}
|
%exclude %{_libexecdir}/%{name}/plugins.d/go.d.plugin
|
||||||
%exclude %{_libdir}/%{name}/conf.d/go.d.conf
|
%exclude %{_libdir}/%{name}/conf.d/go.d.conf
|
||||||
%exclude %{_libdir}/%{name}/conf.d/go.d
|
%exclude %{_libdir}/%{name}/conf.d/go.d
|
||||||
|
|
||||||
|
@ -958,7 +833,7 @@ fi
|
||||||
%defattr(0750,root,netdata,0750)
|
%defattr(0750,root,netdata,0750)
|
||||||
# CAP_NET_ADMIN needed for WireGuard collector
|
# CAP_NET_ADMIN needed for WireGuard collector
|
||||||
# CAP_NET_RAW needed for ping collector
|
# CAP_NET_RAW needed for ping collector
|
||||||
%caps(cap_dac_read_search,cap_net_admin,cap_net_raw=eip) %{_libexecdir}/%{name}/plugins.d/%{go_name}
|
%caps(cap_dac_read_search,cap_net_admin,cap_net_raw=eip) %{_libexecdir}/%{name}/plugins.d/go.d.plugin
|
||||||
%defattr(0644,root,netdata,0755)
|
%defattr(0644,root,netdata,0755)
|
||||||
%{_libdir}/%{name}/conf.d/go.d.conf
|
%{_libdir}/%{name}/conf.d/go.d.conf
|
||||||
%{_libdir}/%{name}/conf.d/go.d
|
%{_libdir}/%{name}/conf.d/go.d
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
GOLANG_MIN_MAJOR_VERSION='1'
|
GOLANG_MIN_MAJOR_VERSION='1'
|
||||||
GOLANG_MIN_MINOR_VERSION='21'
|
GOLANG_MIN_MINOR_VERSION='21'
|
||||||
GOLANG_MIN_PATCH_VERSION='0'
|
GOLANG_MIN_PATCH_VERSION='0'
|
||||||
|
GOLANG_MIN_VERSION="${GOLANG_MIN_MAJOR_VERSION}.${GOLANG_MIN_MINOR_VERSION}.${GOLANG_MIN_PATCH_VERSION}"
|
||||||
|
|
||||||
GOLANG_TEMP_PATH="${TMPDIR}/go-toolchain"
|
GOLANG_TEMP_PATH="${TMPDIR}/go-toolchain"
|
||||||
|
|
||||||
|
@ -48,49 +49,84 @@ install_go_toolchain() {
|
||||||
GOLANG_ARCHIVE_NAME="${GOLANG_TEMP_PATH}/golang.tar.gz"
|
GOLANG_ARCHIVE_NAME="${GOLANG_TEMP_PATH}/golang.tar.gz"
|
||||||
GOLANG_CHECKSUM_FILE="${GOLANG_TEMP_PATH}/golang.sha256sums"
|
GOLANG_CHECKSUM_FILE="${GOLANG_TEMP_PATH}/golang.sha256sums"
|
||||||
|
|
||||||
if [ "$(uname -s)" != "Linux" ]; then
|
case "$(uname -s)" in
|
||||||
GOLANG_FAILURE_REASON="We do not support automatic handling of a Go toolchain on this system, you must install one manually."
|
Linux)
|
||||||
return 1
|
case "$(uname -m)" in
|
||||||
fi
|
i?86)
|
||||||
|
GOLANG_ARCHIVE_URL="https://go.dev/dl/go1.21.6.linux-386.tar.gz"
|
||||||
case "$(uname -m)" in
|
GOLANG_ARCHIVE_CHECKSUM="05d09041b5a1193c14e4b2db3f7fcc649b236c567f5eb93305c537851b72dd95"
|
||||||
i?86)
|
;;
|
||||||
GOLANG_ARCHIVE_URL="https://go.dev/dl/go1.21.6.linux-386.tar.gz"
|
x86_64)
|
||||||
GOLANG_ARCHIVE_CHECKSUM="05d09041b5a1193c14e4b2db3f7fcc649b236c567f5eb93305c537851b72dd95"
|
GOLANG_ARCHIVE_URL="https://go.dev/dl/go1.21.6.linux-amd64.tar.gz"
|
||||||
|
GOLANG_ARCHIVE_CHECKSUM="3f934f40ac360b9c01f616a9aa1796d227d8b0328bf64cb045c7b8c4ee9caea4"
|
||||||
|
;;
|
||||||
|
aarch64)
|
||||||
|
GOLANG_ARCHIVE_URL="https://go.dev/dl/go1.21.6.linux-arm64.tar.gz"
|
||||||
|
GOLANG_ARCHIVE_CHECKSUM="e2e8aa88e1b5170a0d495d7d9c766af2b2b6c6925a8f8956d834ad6b4cacbd9a"
|
||||||
|
;;
|
||||||
|
armv*)
|
||||||
|
GOLANG_ARCHIVE_URL="https://go.dev/dl/go1.21.6.linux-armv6l.tar.gz"
|
||||||
|
GOLANG_ARCHIVE_CHECKSUM="6a8eda6cc6a799ff25e74ce0c13fdc1a76c0983a0bb07c789a2a3454bf6ec9b2"
|
||||||
|
;;
|
||||||
|
ppc64le)
|
||||||
|
GOLANG_ARCHIVE_URL="https://go.dev/dl/go1.21.6.linux-ppc64le.tar.gz"
|
||||||
|
GOLANG_ARCHIVE_CHECKSUM="e872b1e9a3f2f08fd4554615a32ca9123a4ba877ab6d19d36abc3424f86bc07f"
|
||||||
|
;;
|
||||||
|
riscv64)
|
||||||
|
GOLANG_ARCHIVE_URL="https://go.dev/dl/go1.21.6.linux-riscv64.tar.gz"
|
||||||
|
GOLANG_ARCHIVE_CHECKSUM="86a2fe6597af4b37d98bca632f109034b624786a8d9c1504d340661355ed31f7"
|
||||||
|
;;
|
||||||
|
s390x)
|
||||||
|
GOLANG_ARCHIVE_URL="https://go.dev/dl/go1.21.6.linux-s390x.tar.gz"
|
||||||
|
GOLANG_ARCHIVE_CHECKSUM="92894d0f732d3379bc414ffdd617eaadad47e1d72610e10d69a1156db03fc052"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
GOLANG_FAILURE_REASON="Linux $(uname -m) platform is not supported out-of-box by Go, you must install a toolchain for it yourself."
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
;;
|
;;
|
||||||
x86_64)
|
FreeBSD)
|
||||||
GOLANG_ARCHIVE_URL="https://go.dev/dl/go1.21.6.linux-amd64.tar.gz"
|
case "$(uname -m)" in
|
||||||
GOLANG_ARCHIVE_CHECKSUM="3f934f40ac360b9c01f616a9aa1796d227d8b0328bf64cb045c7b8c4ee9caea4"
|
386)
|
||||||
;;
|
GOLANG_ARCHIVE_URL="https://go.dev/dl/go1.22.0.freebsd-386.tar.gz"
|
||||||
aarch64)
|
GOLANG_ARCHIVE_CHECKSUM="b8065da37783e8b9e7086365a54d74537e832c92311b61101a66989ab2458d8e"
|
||||||
GOLANG_ARCHIVE_URL="https://go.dev/dl/go1.21.6.linux-arm64.tar.gz"
|
;;
|
||||||
GOLANG_ARCHIVE_CHECKSUM="e2e8aa88e1b5170a0d495d7d9c766af2b2b6c6925a8f8956d834ad6b4cacbd9a"
|
amd64)
|
||||||
;;
|
GOLANG_ARCHIVE_URL="https://go.dev/dl/go1.22.0.freebsd-amd64.tar.gz"
|
||||||
armv*)
|
GOLANG_ARCHIVE_CHECKSUM="50f421c7f217083ac94aab1e09400cb9c2fea7d337679ec11f1638a11460da30"
|
||||||
GOLANG_ARCHIVE_URL="https://go.dev/dl/go1.21.6.linux-armv6l.tar.gz"
|
;;
|
||||||
GOLANG_ARCHIVE_CHECKSUM="6a8eda6cc6a799ff25e74ce0c13fdc1a76c0983a0bb07c789a2a3454bf6ec9b2"
|
arm)
|
||||||
;;
|
GOLANG_ARCHIVE_URL="https://go.dev/dl/go1.22.0.freebsd-arm.tar.gz"
|
||||||
ppc64le)
|
GOLANG_ARCHIVE_CHECKSUM="c9c8b305f90903536f4981bad9f029828c2483b3216ca1783777344fbe603f2d"
|
||||||
GOLANG_ARCHIVE_URL="https://go.dev/dl/go1.21.6.linux-ppc64le.tar.gz"
|
;;
|
||||||
GOLANG_ARCHIVE_CHECKSUM="e872b1e9a3f2f08fd4554615a32ca9123a4ba877ab6d19d36abc3424f86bc07f"
|
arm64)
|
||||||
;;
|
GOLANG_ARCHIVE_URL="https://go.dev/dl/go1.22.0.freebsd-arm64.tar.gz"
|
||||||
riscv64)
|
GOLANG_ARCHIVE_CHECKSUM="e23385e5c640787fa02cd58f2301ea09e162c4d99f8ca9fa6d52766f428a933d"
|
||||||
GOLANG_ARCHIVE_URL="https://go.dev/dl/go1.21.6.linux-riscv64.tar.gz"
|
;;
|
||||||
GOLANG_ARCHIVE_CHECKSUM="86a2fe6597af4b37d98bca632f109034b624786a8d9c1504d340661355ed31f7"
|
riscv64)
|
||||||
;;
|
GOLANG_ARCHIVE_URL="https://go.dev/dl/go1.22.0.freebsd-riscv64.tar.gz"
|
||||||
s390x)
|
GOLANG_ARCHIVE_CHECKSUM="c8f94d1de6024546194d58e7b9370dc7ea06176aad94a675b0062c25c40cb645"
|
||||||
GOLANG_ARCHIVE_URL="https://go.dev/dl/go1.21.6.linux-s390x.tar.gz"
|
;;
|
||||||
GOLANG_ARCHIVE_CHECKSUM="92894d0f732d3379bc414ffdd617eaadad47e1d72610e10d69a1156db03fc052"
|
*)
|
||||||
|
GOLANG_FAILURE_REASON="FreeBSD $(uname -m) platform is not supported out-of-box by Go, you must install a toolchain for it yourself."
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
GOLANG_FAILURE_REASON="Linux $(uname -m) platform is not supported out-of-box by Go, you must install a toolchain for it yourself."
|
GOLANG_FAILURE_REASON="We do not support automatic handling of a Go toolchain on this system, you must install one manually."
|
||||||
return 1
|
return 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [ -d '/usr/local/go' ]; then
|
if [ -d '/usr/local/go' ]; then
|
||||||
GOLANG_FAILURE_REASON="Refusing to overwrite existing Go toolchain install at /usr/local/go, it needs to be updated manually."
|
if [ -f '/usr/local/go/.installed-by-netdata' ]; then
|
||||||
return 1
|
rm -rf /usr/local/go
|
||||||
|
else
|
||||||
|
GOLANG_FAILURE_REASON="Refusing to overwrite existing Go toolchain install at /usr/local/go, it needs to be updated manually."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p "${GOLANG_TEMP_PATH}"
|
mkdir -p "${GOLANG_TEMP_PATH}"
|
||||||
|
@ -112,6 +148,8 @@ install_go_toolchain() {
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
touch /usr/local/go/.installed-by-netdata
|
||||||
|
|
||||||
rm -rf "${GOLANG_TEMP_PATH}"
|
rm -rf "${GOLANG_TEMP_PATH}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
39
packaging/cmake/Modules/FindGo.cmake
Normal file
39
packaging/cmake/Modules/FindGo.cmake
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
# Custom CMake module to find the Go toolchain
|
||||||
|
#
|
||||||
|
# Copyright (c) 2024 Netdata Inc
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
#
|
||||||
|
# This is a relatively orthodox CMake Find Module. It can be used by
|
||||||
|
# simply including it and then invoking `find_package(Go)`.
|
||||||
|
#
|
||||||
|
# Version handling is done by CMake itself via the
|
||||||
|
# find_package_handle_standard_args() function, so `find_package(Go 1.21)`
|
||||||
|
# will also work correctly.
|
||||||
|
|
||||||
|
if(GO_FOUND)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Two passes are needed here so that we prefer a copy in `/usr/local/go/bin` over a system copy.
|
||||||
|
find_program(GO_EXECUTABLE go PATHS /usr/local/go/bin DOC "Go toolchain" NO_DEFAULT_PATH)
|
||||||
|
find_program(GO_EXECUTABLE go DOC "Go toolchain")
|
||||||
|
|
||||||
|
if (GO_EXECUTABLE)
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${GO_EXECUTABLE} version
|
||||||
|
OUTPUT_VARIABLE GO_VERSION_STRING
|
||||||
|
RESULT_VARIABLE RESULT
|
||||||
|
)
|
||||||
|
if (RESULT EQUAL 0)
|
||||||
|
string(REGEX MATCH "go([0-9]+\\.[0-9]+(\\.[0-9]+)?)" GO_VERSION_STRING "${GO_VERSION_STRING}")
|
||||||
|
string(REGEX MATCH "([0-9]+\\.[0-9]+(\\.[0-9]+)?)" GO_VERSION_STRING "${GO_VERSION_STRING}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(
|
||||||
|
Go
|
||||||
|
REQUIRED_VARS GO_EXECUTABLE
|
||||||
|
VERSION_VAR GO_VERSION_STRING
|
||||||
|
)
|
85
packaging/cmake/Modules/NetdataGoTools.cmake
Normal file
85
packaging/cmake/Modules/NetdataGoTools.cmake
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
# Macros and functions to assist in working with Go
|
||||||
|
#
|
||||||
|
# Copyright (c) 2024 Netdata Inc
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: GPL
|
||||||
|
|
||||||
|
if(CMAKE_BUILD_TYPE STREQUAL Debug OR CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo)
|
||||||
|
set(GO_LDFLAGS "-X main.version=${NETDATA_VERSION}")
|
||||||
|
else()
|
||||||
|
set(GO_LDFLAGS "-w -s -X main.version=${NETDATA_VERSION}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# add_go_target: Add a new target that needs to be built using the Go toolchain.
|
||||||
|
#
|
||||||
|
# Takes four arguments, the target name, the output artifact name, the
|
||||||
|
# source tree for the Go module, and the sub-directory of that source tree
|
||||||
|
# to pass to `go build`.
|
||||||
|
#
|
||||||
|
# The target itself will invoke `go build` in the specified source tree,
|
||||||
|
# using the `-o` option to produce the final output artifact, and passing
|
||||||
|
# the requested sub-directory as the final argument.
|
||||||
|
#
|
||||||
|
# This will also automatically construct the dependency list for the
|
||||||
|
# target by finding all Go source files under the specified source tree
|
||||||
|
# and then appending the go.mod and go.sum files from the root of the
|
||||||
|
# source tree.
|
||||||
|
macro(add_go_target target output build_src build_dir)
|
||||||
|
file(GLOB_RECURSE ${target}_DEPS CONFIGURE_DEPENDS "${build_src}/*.go")
|
||||||
|
list(APPEND ${target}_DEPS
|
||||||
|
"${build_src}/go.mod"
|
||||||
|
"${build_src}/go.sum"
|
||||||
|
)
|
||||||
|
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT ${output}
|
||||||
|
COMMAND "${CMAKE_COMMAND}" -E env CGO_ENABLED=0 "${GO_EXECUTABLE}" build -buildvcs=false -ldflags "${GO_LDFLAGS}" -o "${CMAKE_BINARY_DIR}/${output}" "./${build_dir}"
|
||||||
|
DEPENDS ${${target}_DEPS}
|
||||||
|
COMMENT "Building Go component ${output}"
|
||||||
|
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/${build_src}"
|
||||||
|
VERBATIM
|
||||||
|
)
|
||||||
|
add_custom_target(
|
||||||
|
${target} ALL
|
||||||
|
DEPENDS ${output}
|
||||||
|
)
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
# find_min_go_version: Determine the minimum Go version based on go.mod files
|
||||||
|
#
|
||||||
|
# Takes one argument, specifying a source tree to scan for go.mod files.
|
||||||
|
#
|
||||||
|
# All files found will be checked for a `go` directive, and the
|
||||||
|
# MIN_GO_VERSION variable will be set to the highest version
|
||||||
|
# number found among these directives.
|
||||||
|
#
|
||||||
|
# Only works on UNIX-like systems, because it has to process the go.mod
|
||||||
|
# files in ways that CMake can't do on it's own.
|
||||||
|
function(find_min_go_version src_tree)
|
||||||
|
message(STATUS "Determining minimum required version of Go for this build")
|
||||||
|
|
||||||
|
file(GLOB_RECURSE go_mod_files ${src_tree}/go.mod)
|
||||||
|
|
||||||
|
set(result 1.0)
|
||||||
|
|
||||||
|
foreach(f IN ITEMS ${go_mod_files})
|
||||||
|
message(VERBOSE "Checking Go version specified in ${f}")
|
||||||
|
execute_process(
|
||||||
|
COMMAND grep -E "^go .*$" ${f}
|
||||||
|
COMMAND cut -f 2 -d " "
|
||||||
|
RESULT_VARIABLE version_check_result
|
||||||
|
OUTPUT_VARIABLE go_mod_version
|
||||||
|
)
|
||||||
|
|
||||||
|
if(version_check_result EQUAL 0)
|
||||||
|
string(REGEX MATCH "([0-9]+\\.[0-9]+(\\.[0-9]+)?)" go_mod_version "${go_mod_version}")
|
||||||
|
|
||||||
|
if(go_mod_version VERSION_GREATER result)
|
||||||
|
set(result "${go_mod_version}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
message(STATUS "Minimum required Go version determined to be ${result}")
|
||||||
|
set(MIN_GO_VERSION "${result}" PARENT_SCOPE)
|
||||||
|
endfunction()
|
|
@ -1,20 +0,0 @@
|
||||||
6ae6cc9970cb75a245a97e242ded366b37342c3b89d5f673e4f05f81d8623c85 *config.tar.gz
|
|
||||||
6ae6cc9970cb75a245a97e242ded366b37342c3b89d5f673e4f05f81d8623c85 *go.d.plugin-config-v0.58.1.tar.gz
|
|
||||||
5951ea9c3345c2d0fe9f66d559e4ff99d0d0ac1df57cd120f7d7ebc22e518d3d *go.d.plugin-v0.58.1.darwin-amd64.tar.gz
|
|
||||||
083f742e643c94c3d173d8b490752abd46cb00a27f7ce4eaa44f356c72ce83d0 *go.d.plugin-v0.58.1.darwin-arm64.tar.gz
|
|
||||||
4d042db7af2dd4065d1b3d121f30acdf4186d531b0918969540727b04e583bce *go.d.plugin-v0.58.1.freebsd-386.tar.gz
|
|
||||||
4496b2f27bf17e4e71b2867914e5f7f03675b31d0db100b9dff0da668c611651 *go.d.plugin-v0.58.1.freebsd-amd64.tar.gz
|
|
||||||
708affd49865c4c681ab269341347d6106eca4d23d1e8ba6dbf59d7b13e9569a *go.d.plugin-v0.58.1.freebsd-arm.tar.gz
|
|
||||||
efa87e606ad5e602df0dac143b78133bd70c2d5f8c96e4d48cc89efdebd8ce7c *go.d.plugin-v0.58.1.freebsd-arm64.tar.gz
|
|
||||||
846038bd893593879b965016fb917258a9778c4adb63cccc1722bdfbdc600b37 *go.d.plugin-v0.58.1.linux-386.tar.gz
|
|
||||||
eb43f1020947bcd3564e0917842c72e880438c00da2a5a3718fcd83c0d60d636 *go.d.plugin-v0.58.1.linux-amd64.tar.gz
|
|
||||||
310e82f7a227054a0fe27a4c076fd77296da5c37e9677f51e4c1c3f1edf9258f *go.d.plugin-v0.58.1.linux-arm.tar.gz
|
|
||||||
5066048efcd94711987e6554e15abb36c11356cd264a3c62b16697a687f2de81 *go.d.plugin-v0.58.1.linux-arm64.tar.gz
|
|
||||||
d77bfc0a98311fa989d826f60ea41acdd56a749b9b78e7192bc57f13d3ccf805 *go.d.plugin-v0.58.1.linux-mips.tar.gz
|
|
||||||
d57e7bf97e649f03675aeb5bfa7e3b04315a1a70e52e66b230bf915e2d86a976 *go.d.plugin-v0.58.1.linux-mips64.tar.gz
|
|
||||||
3fe10ededbf7b3b9f2aa428339a975ffa23ed062289b958a845bd879cc63e654 *go.d.plugin-v0.58.1.linux-mips64le.tar.gz
|
|
||||||
4d5c5e8324ddb6f3a085083826ea8670546aa7689fc664b62f75d1cf4dff155d *go.d.plugin-v0.58.1.linux-mipsle.tar.gz
|
|
||||||
fe238fb44d6b408e6977e12ced32b0140d72d62b1e63de44d66cd3602e17f2e3 *go.d.plugin-v0.58.1.linux-ppc64.tar.gz
|
|
||||||
a2b1940798462748bdc445e6bcc3557ca0ea65369dc3134ac5f6e35919d1d146 *go.d.plugin-v0.58.1.linux-ppc64le.tar.gz
|
|
||||||
87391dd6784ca6f4754fcf872f1fba0730275da24023cf7ad83250b486326980 *go.d.plugin-vendor-v0.58.1.tar.gz
|
|
||||||
87391dd6784ca6f4754fcf872f1fba0730275da24023cf7ad83250b486326980 *vendor.tar.gz
|
|
|
@ -1 +0,0 @@
|
||||||
v0.58.1
|
|
|
@ -257,6 +257,12 @@ prepare_cmake_options() {
|
||||||
NETDATA_CMAKE_OPTIONS="${NETDATA_CMAKE_OPTIONS} -DUSE_CXX_11=On"
|
NETDATA_CMAKE_OPTIONS="${NETDATA_CMAKE_OPTIONS} -DUSE_CXX_11=On"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "${ENABLE_GO:-1}" -eq 1 ]; then
|
||||||
|
enable_feature PLUGIN_GO 1
|
||||||
|
else
|
||||||
|
enable_feature PLUGIN_GO 0
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "${USE_SYSTEM_PROTOBUF:-1}" -eq 1 ]; then
|
if [ "${USE_SYSTEM_PROTOBUF:-1}" -eq 1 ]; then
|
||||||
enable_feature BUNDLED_PROTOBUF 0
|
enable_feature BUNDLED_PROTOBUF 0
|
||||||
else
|
else
|
||||||
|
|
|
@ -132,6 +132,7 @@ scanit() {
|
||||||
|
|
||||||
progress "Configuring netdata source..."
|
progress "Configuring netdata source..."
|
||||||
USE_SYSTEM_PROTOBUF=1
|
USE_SYSTEM_PROTOBUF=1
|
||||||
|
ENABLE_GO=0
|
||||||
prepare_cmake_options
|
prepare_cmake_options
|
||||||
|
|
||||||
run cmake ${NETDATA_CMAKE_OPTIONS}
|
run cmake ${NETDATA_CMAKE_OPTIONS}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
FROM golang:1.21 AS build-env
|
FROM golang:1.22 AS build-env
|
||||||
|
|
||||||
RUN mkdir -p /workspace
|
RUN mkdir -p /workspace
|
||||||
WORKDIR /workspace
|
WORKDIR /workspace
|
||||||
|
|
|
@ -60,7 +60,7 @@ dev-log:
|
||||||
docker-compose logs -f netdata
|
docker-compose logs -f netdata
|
||||||
|
|
||||||
dev-run: ## Run go.d.plugin inside development environment
|
dev-run: ## Run go.d.plugin inside development environment
|
||||||
go run github.com/netdata/go.d.plugin/cmd/godplugin -d -c conf.d
|
go run github.com/netdata/netdata/go/go.d.plugin/cmd/godplugin -d -c conf.d
|
||||||
|
|
||||||
dev-mock: ## Run go.d.plugin inside development environment with mock config
|
dev-mock: ## Run go.d.plugin inside development environment with mock config
|
||||||
go run github.com/netdata/go.d.plugin/cmd/godplugin -d -c ./mocks/conf.d -m $(DEV_MODULES)
|
go run github.com/netdata/netdata/go/go.d.plugin/cmd/godplugin -d -c ./mocks/conf.d -m $(DEV_MODULES)
|
||||||
|
|
|
@ -132,7 +132,7 @@ see the appropriate collector readme.
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
Edit the `go.d.conf` configuration file using `edit-config` from the
|
Edit the `go.d.conf` configuration file using `edit-config` from the
|
||||||
Netdata [config directory](https://github.com/netdata/netdata/blob/master/docs/configure/nodes.md), which is typically
|
Netdata [config directory](https://github.com/netdata/netdata/blob/master/docs/netdata-agent/configuration.md#the-netdata-config-directory), which is typically
|
||||||
at `/etc/netdata`.
|
at `/etc/netdata`.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|
|
@ -12,18 +12,18 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/confgroup"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/confgroup"
|
||||||
"github.com/netdata/go.d.plugin/agent/discovery"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/discovery"
|
||||||
"github.com/netdata/go.d.plugin/agent/filelock"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/filelock"
|
||||||
"github.com/netdata/go.d.plugin/agent/filestatus"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/filestatus"
|
||||||
"github.com/netdata/go.d.plugin/agent/functions"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/functions"
|
||||||
"github.com/netdata/go.d.plugin/agent/jobmgr"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/jobmgr"
|
||||||
"github.com/netdata/go.d.plugin/agent/module"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/module"
|
||||||
"github.com/netdata/go.d.plugin/agent/netdataapi"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/netdataapi"
|
||||||
"github.com/netdata/go.d.plugin/agent/safewriter"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/safewriter"
|
||||||
"github.com/netdata/go.d.plugin/agent/vnodes"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/vnodes"
|
||||||
"github.com/netdata/go.d.plugin/logger"
|
"github.com/netdata/netdata/go/go.d.plugin/logger"
|
||||||
"github.com/netdata/go.d.plugin/pkg/multipath"
|
"github.com/netdata/netdata/go/go.d.plugin/pkg/multipath"
|
||||||
|
|
||||||
"github.com/mattn/go-isatty"
|
"github.com/mattn/go-isatty"
|
||||||
)
|
)
|
||||||
|
|
|
@ -9,8 +9,8 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/module"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/module"
|
||||||
"github.com/netdata/go.d.plugin/agent/safewriter"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/safewriter"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,8 @@ import (
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/hostinfo"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/hostinfo"
|
||||||
"github.com/netdata/go.d.plugin/agent/module"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/module"
|
||||||
|
|
||||||
"github.com/ilyam8/hashstructure"
|
"github.com/ilyam8/hashstructure"
|
||||||
)
|
)
|
||||||
|
|
|
@ -5,7 +5,7 @@ package confgroup
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/module"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/module"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
package discovery
|
package discovery
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/netdata/go.d.plugin/agent/confgroup"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/confgroup"
|
||||||
)
|
)
|
||||||
|
|
||||||
type cache map[string]*confgroup.Group
|
type cache map[string]*confgroup.Group
|
||||||
|
|
|
@ -5,9 +5,9 @@ package discovery
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/confgroup"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/confgroup"
|
||||||
"github.com/netdata/go.d.plugin/agent/discovery/dummy"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/discovery/dummy"
|
||||||
"github.com/netdata/go.d.plugin/agent/discovery/file"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/discovery/file"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
|
|
|
@ -5,7 +5,7 @@ package dummy
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/confgroup"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/confgroup"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
|
|
|
@ -7,8 +7,8 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/confgroup"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/confgroup"
|
||||||
"github.com/netdata/go.d.plugin/logger"
|
"github.com/netdata/netdata/go/go.d.plugin/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewDiscovery(cfg Config) (*Discovery, error) {
|
func NewDiscovery(cfg Config) (*Discovery, error) {
|
||||||
|
|
|
@ -7,8 +7,8 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/confgroup"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/confgroup"
|
||||||
"github.com/netdata/go.d.plugin/agent/module"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/module"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
package dyncfg
|
package dyncfg
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/netdata/go.d.plugin/agent/confgroup"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/confgroup"
|
||||||
"github.com/netdata/go.d.plugin/agent/functions"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/functions"
|
||||||
"github.com/netdata/go.d.plugin/agent/module"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/module"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
|
|
|
@ -10,10 +10,10 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/confgroup"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/confgroup"
|
||||||
"github.com/netdata/go.d.plugin/agent/functions"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/functions"
|
||||||
"github.com/netdata/go.d.plugin/agent/module"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/module"
|
||||||
"github.com/netdata/go.d.plugin/logger"
|
"github.com/netdata/netdata/go/go.d.plugin/logger"
|
||||||
|
|
||||||
"gopkg.in/yaml.v2"
|
"gopkg.in/yaml.v2"
|
||||||
)
|
)
|
||||||
|
|
|
@ -8,9 +8,9 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/confgroup"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/confgroup"
|
||||||
"github.com/netdata/go.d.plugin/agent/functions"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/functions"
|
||||||
"github.com/netdata/go.d.plugin/agent/module"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/module"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/confgroup"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/confgroup"
|
||||||
|
|
||||||
"gopkg.in/yaml.v2"
|
"gopkg.in/yaml.v2"
|
||||||
)
|
)
|
||||||
|
|
|
@ -5,7 +5,7 @@ package file
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/confgroup"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/confgroup"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
|
|
|
@ -9,8 +9,8 @@ import (
|
||||||
"log/slog"
|
"log/slog"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/confgroup"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/confgroup"
|
||||||
"github.com/netdata/go.d.plugin/logger"
|
"github.com/netdata/netdata/go/go.d.plugin/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
var log = logger.New().With(
|
var log = logger.New().With(
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/confgroup"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/confgroup"
|
||||||
|
|
||||||
"gopkg.in/yaml.v2"
|
"gopkg.in/yaml.v2"
|
||||||
)
|
)
|
||||||
|
|
|
@ -5,8 +5,8 @@ package file
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/confgroup"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/confgroup"
|
||||||
"github.com/netdata/go.d.plugin/agent/module"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/module"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
|
@ -7,8 +7,8 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/confgroup"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/confgroup"
|
||||||
"github.com/netdata/go.d.plugin/logger"
|
"github.com/netdata/netdata/go/go.d.plugin/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
|
|
@ -5,8 +5,8 @@ package file
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/confgroup"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/confgroup"
|
||||||
"github.com/netdata/go.d.plugin/agent/module"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/module"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/confgroup"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/confgroup"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
|
@ -9,8 +9,8 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/confgroup"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/confgroup"
|
||||||
"github.com/netdata/go.d.plugin/logger"
|
"github.com/netdata/netdata/go/go.d.plugin/logger"
|
||||||
|
|
||||||
"github.com/fsnotify/fsnotify"
|
"github.com/fsnotify/fsnotify"
|
||||||
)
|
)
|
||||||
|
|
|
@ -6,8 +6,8 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/confgroup"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/confgroup"
|
||||||
"github.com/netdata/go.d.plugin/agent/module"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/module"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
|
@ -10,10 +10,10 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/confgroup"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/confgroup"
|
||||||
"github.com/netdata/go.d.plugin/agent/discovery/dummy"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/discovery/dummy"
|
||||||
"github.com/netdata/go.d.plugin/agent/discovery/file"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/discovery/file"
|
||||||
"github.com/netdata/go.d.plugin/logger"
|
"github.com/netdata/netdata/go/go.d.plugin/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewManager(cfg Config) (*Manager, error) {
|
func NewManager(cfg Config) (*Manager, error) {
|
||||||
|
|
|
@ -9,8 +9,8 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/confgroup"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/confgroup"
|
||||||
"github.com/netdata/go.d.plugin/agent/discovery/file"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/discovery/file"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
|
@ -15,8 +15,8 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/discovery/sd/model"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/discovery/sd/model"
|
||||||
"github.com/netdata/go.d.plugin/logger"
|
"github.com/netdata/netdata/go/go.d.plugin/logger"
|
||||||
|
|
||||||
"github.com/ilyam8/hashstructure"
|
"github.com/ilyam8/hashstructure"
|
||||||
)
|
)
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/discovery/sd/model"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/discovery/sd/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/discovery/sd/model"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/discovery/sd/model"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
|
@ -11,9 +11,9 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/discovery/sd/model"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/discovery/sd/model"
|
||||||
"github.com/netdata/go.d.plugin/logger"
|
"github.com/netdata/netdata/go/go.d.plugin/logger"
|
||||||
"github.com/netdata/go.d.plugin/pkg/k8sclient"
|
"github.com/netdata/netdata/go/go.d.plugin/pkg/k8sclient"
|
||||||
|
|
||||||
"github.com/ilyam8/hashstructure"
|
"github.com/ilyam8/hashstructure"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
|
|
|
@ -7,8 +7,8 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/discovery/sd/model"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/discovery/sd/model"
|
||||||
"github.com/netdata/go.d.plugin/pkg/k8sclient"
|
"github.com/netdata/netdata/go/go.d.plugin/pkg/k8sclient"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
|
|
|
@ -9,8 +9,8 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/discovery/sd/model"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/discovery/sd/model"
|
||||||
"github.com/netdata/go.d.plugin/logger"
|
"github.com/netdata/netdata/go/go.d.plugin/logger"
|
||||||
|
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/client-go/tools/cache"
|
"k8s.io/client-go/tools/cache"
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/discovery/sd/model"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/discovery/sd/model"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
|
|
|
@ -9,8 +9,8 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/discovery/sd/model"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/discovery/sd/model"
|
||||||
"github.com/netdata/go.d.plugin/logger"
|
"github.com/netdata/netdata/go/go.d.plugin/logger"
|
||||||
|
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/client-go/tools/cache"
|
"k8s.io/client-go/tools/cache"
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/discovery/sd/model"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/discovery/sd/model"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/discovery/sd/model"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/discovery/sd/model"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
|
@ -7,8 +7,8 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/discovery/sd/model"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/discovery/sd/model"
|
||||||
"github.com/netdata/go.d.plugin/logger"
|
"github.com/netdata/netdata/go/go.d.plugin/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
func newAccumulator() *accumulator {
|
func newAccumulator() *accumulator {
|
||||||
|
|
|
@ -7,8 +7,8 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"text/template"
|
"text/template"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/discovery/sd/model"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/discovery/sd/model"
|
||||||
"github.com/netdata/go.d.plugin/logger"
|
"github.com/netdata/netdata/go/go.d.plugin/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
func newTargetClassificator(cfg []ClassifyRuleConfig) (*targetClassificator, error) {
|
func newTargetClassificator(cfg []ClassifyRuleConfig) (*targetClassificator, error) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ package pipeline
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/discovery/sd/model"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/discovery/sd/model"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
|
@ -6,9 +6,9 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"text/template"
|
"text/template"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/confgroup"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/confgroup"
|
||||||
"github.com/netdata/go.d.plugin/agent/discovery/sd/model"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/discovery/sd/model"
|
||||||
"github.com/netdata/go.d.plugin/logger"
|
"github.com/netdata/netdata/go/go.d.plugin/logger"
|
||||||
|
|
||||||
"gopkg.in/yaml.v2"
|
"gopkg.in/yaml.v2"
|
||||||
)
|
)
|
||||||
|
|
|
@ -5,8 +5,8 @@ package pipeline
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/confgroup"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/confgroup"
|
||||||
"github.com/netdata/go.d.plugin/agent/discovery/sd/model"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/discovery/sd/model"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
|
@ -5,9 +5,9 @@ package pipeline
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/netdata/go.d.plugin/agent/discovery/sd/hostsocket"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/discovery/sd/hostsocket"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/discovery/sd/kubernetes"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/discovery/sd/kubernetes"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
|
|
|
@ -7,11 +7,11 @@ import (
|
||||||
"log/slog"
|
"log/slog"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/confgroup"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/confgroup"
|
||||||
"github.com/netdata/go.d.plugin/agent/discovery/sd/hostsocket"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/discovery/sd/hostsocket"
|
||||||
"github.com/netdata/go.d.plugin/agent/discovery/sd/kubernetes"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/discovery/sd/kubernetes"
|
||||||
"github.com/netdata/go.d.plugin/agent/discovery/sd/model"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/discovery/sd/model"
|
||||||
"github.com/netdata/go.d.plugin/logger"
|
"github.com/netdata/netdata/go/go.d.plugin/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
func New(cfg Config) (*Pipeline, error) {
|
func New(cfg Config) (*Pipeline, error) {
|
||||||
|
|
|
@ -9,8 +9,8 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/confgroup"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/confgroup"
|
||||||
"github.com/netdata/go.d.plugin/agent/discovery/sd/model"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/discovery/sd/model"
|
||||||
|
|
||||||
"github.com/ilyam8/hashstructure"
|
"github.com/ilyam8/hashstructure"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/discovery/sd/model"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/discovery/sd/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
type selector interface {
|
type selector interface {
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"regexp"
|
"regexp"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/discovery/sd/model"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/discovery/sd/model"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
|
@ -8,9 +8,9 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/confgroup"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/confgroup"
|
||||||
"github.com/netdata/go.d.plugin/agent/discovery/sd/model"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/discovery/sd/model"
|
||||||
"github.com/netdata/go.d.plugin/logger"
|
"github.com/netdata/netdata/go/go.d.plugin/logger"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
|
@ -6,9 +6,9 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/confgroup"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/confgroup"
|
||||||
"github.com/netdata/go.d.plugin/agent/discovery/sd/pipeline"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/discovery/sd/pipeline"
|
||||||
"github.com/netdata/go.d.plugin/logger"
|
"github.com/netdata/netdata/go/go.d.plugin/logger"
|
||||||
|
|
||||||
"gopkg.in/yaml.v2"
|
"gopkg.in/yaml.v2"
|
||||||
)
|
)
|
||||||
|
|
|
@ -5,7 +5,7 @@ package sd
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/discovery/sd/pipeline"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/discovery/sd/pipeline"
|
||||||
|
|
||||||
"gopkg.in/yaml.v2"
|
"gopkg.in/yaml.v2"
|
||||||
)
|
)
|
||||||
|
|
|
@ -9,9 +9,9 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/confgroup"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/confgroup"
|
||||||
"github.com/netdata/go.d.plugin/agent/discovery/sd/pipeline"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/discovery/sd/pipeline"
|
||||||
"github.com/netdata/go.d.plugin/logger"
|
"github.com/netdata/netdata/go/go.d.plugin/logger"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/confgroup"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/confgroup"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
42
src/go/collectors/go.d.plugin/agent/executable/executable.go
Normal file
42
src/go/collectors/go.d.plugin/agent/executable/executable.go
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
package executable
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
Name string
|
||||||
|
Directory string
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
path, err := os.Executable()
|
||||||
|
if err != nil || path == "" {
|
||||||
|
Name = "go.d"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
_, Name = filepath.Split(path)
|
||||||
|
Name = strings.TrimSuffix(Name, ".plugin")
|
||||||
|
Name = strings.TrimSuffix(Name, ".test")
|
||||||
|
|
||||||
|
// FIXME: can't use logger because of circular import
|
||||||
|
fi, err := os.Lstat(path)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if fi.Mode()&os.ModeSymlink != 0 {
|
||||||
|
realPath, err := filepath.EvalSymlinks(path)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
Directory = filepath.Dir(realPath)
|
||||||
|
} else {
|
||||||
|
Directory = filepath.Dir(path)
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,22 +0,0 @@
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
package executable
|
|
||||||
|
|
||||||
import (
|
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
"strings"
|
|
||||||
)
|
|
||||||
|
|
||||||
var Name string
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
s, err := os.Executable()
|
|
||||||
if err != nil || s == "" || strings.HasSuffix(s, ".test") {
|
|
||||||
Name = "go.d"
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
_, Name = filepath.Split(s)
|
|
||||||
Name = strings.TrimSuffix(Name, ".plugin")
|
|
||||||
}
|
|
|
@ -8,8 +8,8 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/confgroup"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/confgroup"
|
||||||
"github.com/netdata/go.d.plugin/logger"
|
"github.com/netdata/netdata/go/go.d.plugin/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewManager(path string) *Manager {
|
func NewManager(path string) *Manager {
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/confgroup"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/confgroup"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
"slices"
|
"slices"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/confgroup"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/confgroup"
|
||||||
)
|
)
|
||||||
|
|
||||||
func LoadStore(path string) (*Store, error) {
|
func LoadStore(path string) (*Store, error) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ package filestatus
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/confgroup"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/confgroup"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/logger"
|
"github.com/netdata/netdata/go/go.d.plugin/logger"
|
||||||
|
|
||||||
"github.com/mattn/go-isatty"
|
"github.com/mattn/go-isatty"
|
||||||
"github.com/muesli/cancelreader"
|
"github.com/muesli/cancelreader"
|
||||||
|
|
|
@ -5,7 +5,7 @@ package jobmgr
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/confgroup"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/confgroup"
|
||||||
)
|
)
|
||||||
|
|
||||||
func newRunningJobsCache() *runningJobsCache {
|
func newRunningJobsCache() *runningJobsCache {
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
package jobmgr
|
package jobmgr
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/netdata/go.d.plugin/agent/confgroup"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/confgroup"
|
||||||
"github.com/netdata/go.d.plugin/agent/vnodes"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/vnodes"
|
||||||
)
|
)
|
||||||
|
|
||||||
type FileLocker interface {
|
type FileLocker interface {
|
||||||
|
|
|
@ -12,9 +12,9 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/confgroup"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/confgroup"
|
||||||
"github.com/netdata/go.d.plugin/agent/module"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/module"
|
||||||
"github.com/netdata/go.d.plugin/logger"
|
"github.com/netdata/netdata/go/go.d.plugin/logger"
|
||||||
|
|
||||||
"gopkg.in/yaml.v2"
|
"gopkg.in/yaml.v2"
|
||||||
)
|
)
|
||||||
|
|
|
@ -9,9 +9,9 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/confgroup"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/confgroup"
|
||||||
"github.com/netdata/go.d.plugin/agent/module"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/module"
|
||||||
"github.com/netdata/go.d.plugin/agent/safewriter"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/safewriter"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
package jobmgr
|
package jobmgr
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/netdata/go.d.plugin/agent/confgroup"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/confgroup"
|
||||||
"github.com/netdata/go.d.plugin/agent/vnodes"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/vnodes"
|
||||||
)
|
)
|
||||||
|
|
||||||
type noop struct{}
|
type noop struct{}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"slices"
|
"slices"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/ticker"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/ticker"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (m *Manager) runRunningJobsHandling(ctx context.Context) {
|
func (m *Manager) runRunningJobsHandling(ctx context.Context) {
|
||||||
|
|
|
@ -14,9 +14,9 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/netdataapi"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/netdataapi"
|
||||||
"github.com/netdata/go.d.plugin/agent/vnodes"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/vnodes"
|
||||||
"github.com/netdata/go.d.plugin/logger"
|
"github.com/netdata/netdata/go/go.d.plugin/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
var obsoleteLock = &sync.Mutex{}
|
var obsoleteLock = &sync.Mutex{}
|
||||||
|
@ -39,7 +39,7 @@ var reSpace = regexp.MustCompile(`\s+`)
|
||||||
var ndInternalMonitoringDisabled = os.Getenv("NETDATA_INTERNALS_MONITORING") == "NO"
|
var ndInternalMonitoringDisabled = os.Getenv("NETDATA_INTERNALS_MONITORING") == "NO"
|
||||||
|
|
||||||
func newRuntimeChart(pluginName string) *Chart {
|
func newRuntimeChart(pluginName string) *Chart {
|
||||||
// this is needed to keep the same name as we had before https://github.com/netdata/go.d.plugin/issues/650
|
// this is needed to keep the same name as we had before https://github.com/netdata/netdata/go/go.d.plugin/issues/650
|
||||||
ctxName := pluginName
|
ctxName := pluginName
|
||||||
if ctxName == "go.d" {
|
if ctxName == "go.d" {
|
||||||
ctxName = "go"
|
ctxName = "go"
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
package module
|
package module
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/netdata/go.d.plugin/logger"
|
"github.com/netdata/netdata/go/go.d.plugin/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Module is an interface that represents a module.
|
// Module is an interface that represents a module.
|
||||||
|
|
|
@ -7,13 +7,13 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/confgroup"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/confgroup"
|
||||||
"github.com/netdata/go.d.plugin/agent/discovery"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/discovery"
|
||||||
"github.com/netdata/go.d.plugin/agent/discovery/dummy"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/discovery/dummy"
|
||||||
"github.com/netdata/go.d.plugin/agent/discovery/file"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/discovery/file"
|
||||||
"github.com/netdata/go.d.plugin/agent/hostinfo"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/hostinfo"
|
||||||
"github.com/netdata/go.d.plugin/agent/module"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/module"
|
||||||
"github.com/netdata/go.d.plugin/agent/vnodes"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/vnodes"
|
||||||
|
|
||||||
"gopkg.in/yaml.v2"
|
"gopkg.in/yaml.v2"
|
||||||
)
|
)
|
||||||
|
|
|
@ -5,7 +5,7 @@ package agent
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/module"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/module"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/logger"
|
"github.com/netdata/netdata/go/go.d.plugin/logger"
|
||||||
|
|
||||||
"gopkg.in/yaml.v2"
|
"gopkg.in/yaml.v2"
|
||||||
)
|
)
|
||||||
|
|
|
@ -11,15 +11,16 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent"
|
"github.com/netdata/netdata/go/go.d.plugin/agent"
|
||||||
"github.com/netdata/go.d.plugin/cli"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/executable"
|
||||||
"github.com/netdata/go.d.plugin/logger"
|
"github.com/netdata/netdata/go/go.d.plugin/cli"
|
||||||
"github.com/netdata/go.d.plugin/pkg/multipath"
|
"github.com/netdata/netdata/go/go.d.plugin/logger"
|
||||||
|
"github.com/netdata/netdata/go/go.d.plugin/pkg/multipath"
|
||||||
|
|
||||||
"github.com/jessevdk/go-flags"
|
"github.com/jessevdk/go-flags"
|
||||||
"golang.org/x/net/http/httpproxy"
|
"golang.org/x/net/http/httpproxy"
|
||||||
|
|
||||||
_ "github.com/netdata/go.d.plugin/modules"
|
_ "github.com/netdata/netdata/go/go.d.plugin/modules"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -45,6 +46,12 @@ func confDir(opts *cli.Option) multipath.MultiPath {
|
||||||
stockDir,
|
stockDir,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
if executable.Directory != "" {
|
||||||
|
return multipath.New(
|
||||||
|
filepath.Join(executable.Directory, "/../../../../etc/netdata"),
|
||||||
|
filepath.Join(executable.Directory, "/../../../../usr/lib/netdata/conf.d"),
|
||||||
|
)
|
||||||
|
}
|
||||||
return multipath.New(
|
return multipath.New(
|
||||||
filepath.Join(cd, "/../../../../etc/netdata"),
|
filepath.Join(cd, "/../../../../etc/netdata"),
|
||||||
filepath.Join(cd, "/../../../../usr/lib/netdata/conf.d"),
|
filepath.Join(cd, "/../../../../usr/lib/netdata/conf.d"),
|
||||||
|
@ -64,6 +71,12 @@ func modulesConfDir(opts *cli.Option) (mpath multipath.MultiPath) {
|
||||||
}
|
}
|
||||||
return multipath.New(mpath...)
|
return multipath.New(mpath...)
|
||||||
}
|
}
|
||||||
|
if executable.Directory != "" {
|
||||||
|
return multipath.New(
|
||||||
|
filepath.Join(executable.Directory, "/../../../../etc/netdata", name),
|
||||||
|
filepath.Join(executable.Directory, "/../../../../usr/lib/netdata/conf.d", name),
|
||||||
|
)
|
||||||
|
}
|
||||||
return multipath.New(
|
return multipath.New(
|
||||||
filepath.Join(cd, "/../../../../etc/netdata", name),
|
filepath.Join(cd, "/../../../../etc/netdata", name),
|
||||||
filepath.Join(cd, "/../../../../usr/lib/netdata/conf.d", name),
|
filepath.Join(cd, "/../../../../usr/lib/netdata/conf.d", name),
|
||||||
|
|
|
@ -9,11 +9,11 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent"
|
"github.com/netdata/netdata/go/go.d.plugin/agent"
|
||||||
"github.com/netdata/go.d.plugin/agent/module"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/module"
|
||||||
"github.com/netdata/go.d.plugin/cli"
|
"github.com/netdata/netdata/go/go.d.plugin/cli"
|
||||||
"github.com/netdata/go.d.plugin/logger"
|
"github.com/netdata/netdata/go/go.d.plugin/logger"
|
||||||
"github.com/netdata/go.d.plugin/pkg/multipath"
|
"github.com/netdata/netdata/go/go.d.plugin/pkg/multipath"
|
||||||
|
|
||||||
"github.com/jessevdk/go-flags"
|
"github.com/jessevdk/go-flags"
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module github.com/netdata/go.d.plugin
|
module github.com/netdata/netdata/go/go.d.plugin
|
||||||
|
|
||||||
go 1.21
|
go 1.21
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ require (
|
||||||
github.com/stretchr/testify v1.8.4
|
github.com/stretchr/testify v1.8.4
|
||||||
github.com/tomasen/fcgi_client v0.0.0-20180423082037-2bb3d819fd19
|
github.com/tomasen/fcgi_client v0.0.0-20180423082037-2bb3d819fd19
|
||||||
github.com/valyala/fastjson v1.6.4
|
github.com/valyala/fastjson v1.6.4
|
||||||
github.com/vmware/govmomi v0.34.2
|
github.com/vmware/govmomi v0.35.0
|
||||||
go.mongodb.org/mongo-driver v1.14.0
|
go.mongodb.org/mongo-driver v1.14.0
|
||||||
golang.org/x/net v0.21.0
|
golang.org/x/net v0.21.0
|
||||||
golang.org/x/text v0.14.0
|
golang.org/x/text v0.14.0
|
||||||
|
@ -79,7 +79,7 @@ require (
|
||||||
github.com/google/gnostic-models v0.6.8 // indirect
|
github.com/google/gnostic-models v0.6.8 // indirect
|
||||||
github.com/google/go-cmp v0.6.0 // indirect
|
github.com/google/go-cmp v0.6.0 // indirect
|
||||||
github.com/google/gofuzz v1.2.0 // indirect
|
github.com/google/gofuzz v1.2.0 // indirect
|
||||||
github.com/google/uuid v1.4.0 // indirect
|
github.com/google/uuid v1.6.0 // indirect
|
||||||
github.com/grafana/regexp v0.0.0-20220304095617-2e8d9baf4ac2 // indirect
|
github.com/grafana/regexp v0.0.0-20220304095617-2e8d9baf4ac2 // indirect
|
||||||
github.com/huandu/xstrings v1.3.3 // indirect
|
github.com/huandu/xstrings v1.3.3 // indirect
|
||||||
github.com/imdario/mergo v0.3.12 // indirect
|
github.com/imdario/mergo v0.3.12 // indirect
|
||||||
|
|
|
@ -111,8 +111,8 @@ github.com/google/pprof v0.0.0-20220520215854-d04f2422c8a1 h1:K4bn56FHdjFCfjSo3w
|
||||||
github.com/google/pprof v0.0.0-20220520215854-d04f2422c8a1/go.mod h1:gSuNB+gJaOiQKLEZ+q+PK9Mq3SOzhRcw2GsGS/FhYDk=
|
github.com/google/pprof v0.0.0-20220520215854-d04f2422c8a1/go.mod h1:gSuNB+gJaOiQKLEZ+q+PK9Mq3SOzhRcw2GsGS/FhYDk=
|
||||||
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
||||||
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4=
|
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||||
github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/gosnmp/gosnmp v1.37.0 h1:/Tf8D3b9wrnNuf/SfbvO+44mPrjVphBhRtcGg22V07Y=
|
github.com/gosnmp/gosnmp v1.37.0 h1:/Tf8D3b9wrnNuf/SfbvO+44mPrjVphBhRtcGg22V07Y=
|
||||||
github.com/gosnmp/gosnmp v1.37.0/go.mod h1:GDH9vNqpsD7f2HvZhKs5dlqSEcAS6s6Qp099oZRCR+M=
|
github.com/gosnmp/gosnmp v1.37.0/go.mod h1:GDH9vNqpsD7f2HvZhKs5dlqSEcAS6s6Qp099oZRCR+M=
|
||||||
github.com/grafana/regexp v0.0.0-20220304095617-2e8d9baf4ac2 h1:uirlL/j72L93RhV4+mkWhjv0cov2I0MIgPOG9rMDr1k=
|
github.com/grafana/regexp v0.0.0-20220304095617-2e8d9baf4ac2 h1:uirlL/j72L93RhV4+mkWhjv0cov2I0MIgPOG9rMDr1k=
|
||||||
|
@ -321,8 +321,8 @@ github.com/tomasen/fcgi_client v0.0.0-20180423082037-2bb3d819fd19 h1:ZCmSnT6CLGh
|
||||||
github.com/tomasen/fcgi_client v0.0.0-20180423082037-2bb3d819fd19/go.mod h1:SXTY+QvI+KTTKXQdg0zZ7nx0u94QWh8ZAwBQYsW9cqk=
|
github.com/tomasen/fcgi_client v0.0.0-20180423082037-2bb3d819fd19/go.mod h1:SXTY+QvI+KTTKXQdg0zZ7nx0u94QWh8ZAwBQYsW9cqk=
|
||||||
github.com/valyala/fastjson v1.6.4 h1:uAUNq9Z6ymTgGhcm0UynUAB6tlbakBrz6CQFax3BXVQ=
|
github.com/valyala/fastjson v1.6.4 h1:uAUNq9Z6ymTgGhcm0UynUAB6tlbakBrz6CQFax3BXVQ=
|
||||||
github.com/valyala/fastjson v1.6.4/go.mod h1:CLCAqky6SMuOcxStkYQvblddUtoRxhYMGLrsQns1aXY=
|
github.com/valyala/fastjson v1.6.4/go.mod h1:CLCAqky6SMuOcxStkYQvblddUtoRxhYMGLrsQns1aXY=
|
||||||
github.com/vmware/govmomi v0.34.2 h1:o6ydkTVITOkpQU6HAf6tP5GvHFCNJlNUNlMsvFK77X4=
|
github.com/vmware/govmomi v0.35.0 h1:vN6m2J5ezSJomSTHyKbvpfoEZTn2mGXWg2FFpjRTRp0=
|
||||||
github.com/vmware/govmomi v0.34.2/go.mod h1:qWWT6n9mdCr/T9vySsoUqcI04sSEj4CqHXxtk/Y+Los=
|
github.com/vmware/govmomi v0.35.0/go.mod h1:VvIo6siOYFKdF9eU7qrY9+j/F99DV/LtSgsOpxFXJAY=
|
||||||
github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
|
github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
|
||||||
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
|
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
|
||||||
github.com/xdg-go/scram v1.1.2 h1:FHX5I5B4i4hKRVRBCFRxq1iQRej7WO3hhBuJf+UUySY=
|
github.com/xdg-go/scram v1.1.2 h1:FHX5I5B4i4hKRVRBCFRxq1iQRej7WO3hhBuJf+UUySY=
|
||||||
|
|
|
@ -40,7 +40,7 @@ GOLDFLAGS="$GOLDFLAGS -w -s -X main.version=$VERSION"
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
echo "Building ${GOOS}/${GOARCH}"
|
echo "Building ${GOOS}/${GOARCH}"
|
||||||
CGO_ENABLED=0 GOOS="$1" GOARCH="$2" go build -ldflags "${GOLDFLAGS}" -o "$3" "github.com/netdata/go.d.plugin/cmd/godplugin"
|
CGO_ENABLED=0 GOOS="$1" GOARCH="$2" go build -ldflags "${GOLDFLAGS}" -o "$3" "github.com/netdata/netdata/go/go.d.plugin/cmd/godplugin"
|
||||||
}
|
}
|
||||||
|
|
||||||
create_config_archives() {
|
create_config_archives() {
|
||||||
|
|
|
@ -12,7 +12,7 @@ import (
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/executable"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/executable"
|
||||||
|
|
||||||
"github.com/mattn/go-isatty"
|
"github.com/mattn/go-isatty"
|
||||||
)
|
)
|
||||||
|
|
|
@ -8,10 +8,10 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/pkg/matcher"
|
"github.com/netdata/netdata/go/go.d.plugin/pkg/matcher"
|
||||||
"github.com/netdata/go.d.plugin/pkg/web"
|
"github.com/netdata/netdata/go/go.d.plugin/pkg/web"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/module"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/module"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:embed "config_schema.json"
|
//go:embed "config_schema.json"
|
||||||
|
|
|
@ -7,9 +7,9 @@ import (
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/pkg/web"
|
"github.com/netdata/netdata/go/go.d.plugin/pkg/web"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/module"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/module"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
|
@ -5,7 +5,7 @@ package activemq
|
||||||
import (
|
import (
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/netdata/go.d.plugin/pkg/web"
|
"github.com/netdata/netdata/go/go.d.plugin/pkg/web"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
package activemq
|
package activemq
|
||||||
|
|
||||||
import "github.com/netdata/go.d.plugin/agent/module"
|
import "github.com/netdata/netdata/go/go.d.plugin/agent/module"
|
||||||
|
|
||||||
type (
|
type (
|
||||||
// Charts is an alias for module.Charts
|
// Charts is an alias for module.Charts
|
||||||
|
|
|
@ -3,7 +3,7 @@ custom_edit_url: "https://github.com/netdata/go.d.plugin/edit/master/modules/act
|
||||||
meta_yaml: "https://github.com/netdata/go.d.plugin/edit/master/modules/activemq/metadata.yaml"
|
meta_yaml: "https://github.com/netdata/go.d.plugin/edit/master/modules/activemq/metadata.yaml"
|
||||||
sidebar_label: "ActiveMQ"
|
sidebar_label: "ActiveMQ"
|
||||||
learn_status: "Published"
|
learn_status: "Published"
|
||||||
learn_rel_path: "Data Collection/Message Brokers"
|
learn_rel_path: "Collecting Metrics/Message Brokers"
|
||||||
most_popular: False
|
most_popular: False
|
||||||
message: "DO NOT EDIT THIS FILE DIRECTLY, IT IS GENERATED BY THE COLLECTOR'S metadata.yaml FILE"
|
message: "DO NOT EDIT THIS FILE DIRECTLY, IT IS GENERATED BY THE COLLECTOR'S metadata.yaml FILE"
|
||||||
endmeta-->
|
endmeta-->
|
||||||
|
@ -92,7 +92,7 @@ The configuration file name for this integration is `go.d/activemq.conf`.
|
||||||
|
|
||||||
|
|
||||||
You can edit the configuration file using the `edit-config` script from the
|
You can edit the configuration file using the `edit-config` script from the
|
||||||
Netdata [config directory](https://github.com/netdata/netdata/blob/master/docs/configure/nodes.md#the-netdata-config-directory).
|
Netdata [config directory](https://github.com/netdata/netdata/blob/master/docs/netdata-agent/configuration.md#the-netdata-config-directory).
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata
|
cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata
|
||||||
|
|
|
@ -8,8 +8,8 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/agent/module"
|
"github.com/netdata/netdata/go/go.d.plugin/agent/module"
|
||||||
"github.com/netdata/go.d.plugin/pkg/web"
|
"github.com/netdata/netdata/go/go.d.plugin/pkg/web"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:embed "config_schema.json"
|
//go:embed "config_schema.json"
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/pkg/web"
|
"github.com/netdata/netdata/go/go.d.plugin/pkg/web"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
package apache
|
package apache
|
||||||
|
|
||||||
import "github.com/netdata/go.d.plugin/agent/module"
|
import "github.com/netdata/netdata/go/go.d.plugin/agent/module"
|
||||||
|
|
||||||
const (
|
const (
|
||||||
prioRequests = module.Priority + iota
|
prioRequests = module.Priority + iota
|
||||||
|
|
|
@ -10,8 +10,8 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/netdata/go.d.plugin/pkg/stm"
|
"github.com/netdata/netdata/go/go.d.plugin/pkg/stm"
|
||||||
"github.com/netdata/go.d.plugin/pkg/web"
|
"github.com/netdata/netdata/go/go.d.plugin/pkg/web"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (a *Apache) collect() (map[string]int64, error) {
|
func (a *Apache) collect() (map[string]int64, error) {
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue