Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
87c4649
enh(vcpkg): grpc removed from overlays and protobuf added
bouda1 Jun 3, 2025
0a68c9b
enh(common/process_stat): process_stat is a part of common now
bouda1 Jun 3, 2025
4d27bc2
fix(common/log_v2): log_v2 fixed
bouda1 Jun 3, 2025
702cdd2
fix(cmake): compilation fixed with the new vcpkg
bouda1 Jun 4, 2025
3b6bf71
fix(engine): compilation improved
bouda1 Jun 4, 2025
3bb7fac
fix(cmake): compilation fixed with the new vcpkg
bouda1 Jun 4, 2025
efaf958
fix(cmake): engine CMakeLists.txt fixed
bouda1 Jun 4, 2025
26a65cd
fix(broker/engine): link issues fixed and also ut issues fixed
bouda1 Jun 4, 2025
a4759f4
fix(packaging): packaging rules updated
bouda1 Jun 4, 2025
a783e0a
fix(engine/agent): attempt to be able to compile both engine and agent
bouda1 Jun 5, 2025
48b7348
fix(engine/grpc): the grpc module needs to know every protobuf object…
bouda1 Jun 5, 2025
66f177f
fix(tests): a bam test is fixed
bouda1 Jun 5, 2025
b1e96a6
fix(github/docker): git clone updated for vcpkg
bouda1 Jun 5, 2025
bc39461
fix(broker/bam): new dependency added
bouda1 Jun 5, 2025
7ac4708
fix(broker/multiplexing): new dependency added
bouda1 Jun 5, 2025
a36baf9
fix(broker/grpc): bad directory for grpc module
bouda1 Jun 5, 2025
830c9f7
fix(broker/graphite): bad location of the graphite module
bouda1 Jun 5, 2025
de2e31a
fix(broker/victoria-metrics): victoria-metrics was misplaced
bouda1 Jun 5, 2025
e50176e
fix(tests): benches are disabled on the CI
bouda1 Jun 5, 2025
bf46c80
fix(agent/test): the scheduler test is fixed
bouda1 Jun 5, 2025
e2efeb8
fix(engine/whitelist): rapidjson api change taken in count
bouda1 Jun 6, 2025
f0b055b
fix(engine): opentelemetry module could not be loaded
bouda1 Jun 6, 2025
8dfbb57
cleanup(broker/test): old test files removed
bouda1 Jun 6, 2025
0b19f11
cleanup(various): little fixes after review
bouda1 Jun 6, 2025
d2fde58
fix(engine): link issue in opentelemetry fixed.
bouda1 Jun 9, 2025
be1e7ca
enh(tests): new robot test to validate stats files
bouda1 Jun 9, 2025
6e8a604
fix(tests): ESS_STATS does not need to start broker
bouda1 Jun 9, 2025
914ea96
fix(tests): keywork setting bbdo3 is improved
bouda1 Jun 9, 2025
20b7767
fix(tests): keywork setting bbdo3 is improved
bouda1 Jun 9, 2025
58f1a63
fix(ci): issues with cmake fixed
bouda1 Jun 17, 2025
fb500fd
fix(cmake): ut agent cmake fixed with missing dependencies
bouda1 Jun 17, 2025
ddc4b75
fix(packaging): a strange rule because of agent tests
bouda1 Jun 17, 2025
0f5ddee
fix(engine/downtimes): no need to send a full service_status
bouda1 Jun 17, 2025
20c3efd
fix(broker/bam): trying to avoid to send service status when not mand…
bouda1 Jun 17, 2025
4e3dc9e
fix(common): process_stat not needed on Windows
bouda1 Jun 17, 2025
adfe31e
fix(common): header not known on Windows removed
bouda1 Jun 17, 2025
5ec6690
fix(common): process_stat not used on windows
bouda1 Jun 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ COPY custom-triplets /custom-triplets

RUN bash -e <<EOF

git clone --depth 1 -b 2024.01.12 https://github.com/Microsoft/vcpkg.git
git clone --depth 1 -b 2025.04.09 https://github.com/Microsoft/vcpkg.git
./vcpkg/bootstrap-vcpkg.sh -disableMetrics

export VCPKG_ROOT=/vcpkg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ COPY custom-triplets /custom-triplets

RUN bash -e <<EOF

git clone --depth 1 -b 2024.01.12 https://github.com/Microsoft/vcpkg.git
git clone --depth 1 -b 2025.04.09 https://github.com/Microsoft/vcpkg.git
./vcpkg/bootstrap-vcpkg.sh -disableMetrics

export VCPKG_ROOT=/vcpkg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ if [ "${TRIPLET}" = "arm64-linux" ] ; then
export VCPKG_FORCE_SYSTEM_BINARIES=arm
fi

git clone --depth 1 -b 2024.01.12 https://github.com/Microsoft/vcpkg.git
git clone --depth 1 -b 2025.04.09 https://github.com/Microsoft/vcpkg.git
./vcpkg/bootstrap-vcpkg.sh -disableMetrics

export VCPKG_ROOT=/vcpkg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ if [ "${TRIPLET}" = "arm64-linux" ] ; then
export VCPKG_FORCE_SYSTEM_BINARIES=arm
fi

git clone --depth 1 -b 2024.01.12 https://github.com/Microsoft/vcpkg.git
git clone --depth 1 -b 2025.04.09 https://github.com/Microsoft/vcpkg.git
./vcpkg/bootstrap-vcpkg.sh -disableMetrics

export VCPKG_ROOT=/vcpkg
Expand Down
7 changes: 5 additions & 2 deletions .github/docker/Dockerfile.packaging-centreon-collect-jammy
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ APT::Install-Suggests "false";
' > /etc/apt/apt.conf.d/99custom

apt-get update
apt-get install -y ca-certificates
apt-get install -y ca-certificates gpg wget

echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | tee /etc/apt/sources.list.d/goreleaser.list

wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg > /dev/null
echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ jammy main' | tee /etc/apt/sources.list.d/kitware.list

apt-get update

apt-get install -y \
Expand Down Expand Up @@ -87,7 +90,7 @@ if [ "${TRIPLET}" = "arm64-linux" ] ; then
export VCPKG_FORCE_SYSTEM_BINARIES=arm
fi

git clone --depth 1 -b 2024.01.12 https://github.com/Microsoft/vcpkg.git
git clone --depth 1 -b 2025.04.09 https://github.com/Microsoft/vcpkg.git
./vcpkg/bootstrap-vcpkg.sh -disableMetrics

export VCPKG_ROOT=/vcpkg
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows-agent-robot-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
run: wsl --list --online

- name: install debian
uses: Vampire/setup-wsl@f40fb59d850112c9a292b0218bca8271305b9127 # v5.0.0
uses: uses: Vampire/setup-wsl@3b46b44374d5d0ae94654c45d114a3ed7a0e07a8 # v5.0.1
with:
wsl-version: 1
distribution: Debian
Expand Down
20 changes: 5 additions & 15 deletions CMakeListsLinux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,13 @@ find_package(Protobuf REQUIRED)
find_package(nlohmann_json CONFIG REQUIRED)
find_package(GTest CONFIG REQUIRED)
find_package(CURL REQUIRED)
find_package(Boost REQUIRED COMPONENTS url)
find_package(Boost REQUIRED COMPONENTS url program_options process)
find_package(ryml CONFIG REQUIRED)
add_definitions("-DSPDLOG_FMT_EXTERNAL")

# Find the location of the gRPC plugin
get_target_property(GRPC_CPP_PLUGIN gRPC::grpc_cpp_plugin LOCATION)

add_definitions("-DCOLLECT_MAJOR=${COLLECT_MAJOR}")
add_definitions("-DCOLLECT_MINOR=${COLLECT_MINOR}")
add_definitions("-DCOLLECT_PATCH=${COLLECT_PATCH}")
Expand All @@ -98,21 +101,8 @@ include(FindPkgConfig)
pkg_check_modules(MARIADB REQUIRED libmariadb)
pkg_check_modules(LIBSSH2 REQUIRED libssh2)

# There is a bug with grpc. It is not put in the triplet directory. So we have
# to search for its plugin.
file(
GLOB_RECURSE GRPC_CPP_PLUGIN_EXE
RELATIVE ${CMAKE_BINARY_DIR}
grpc_cpp_plugin)
find_program(
GRPC_CPP_PLUGIN
NAMES ${GRPC_CPP_PLUGIN_EXE}
PATHS ${CMAKE_BINARY_DIR} REQUIRED
NO_DEFAULT_PATH)

set(PROTOBUF_LIB_DIR ${Protobuf_DIR}/../../lib)
set(OTLP_LIB_DIR ${opentelemetry-cpp_DIR}/../../lib)
set(VCPKG_INCLUDE_DIR ${Protobuf_INCLUDE_DIR})
set(VCPKG_INCLUDE_DIR ${Protobuf_INCLUDE_DIRS})
include(GNUInstallDirs)

# import opentelemetry-proto
Expand Down
14 changes: 3 additions & 11 deletions CMakeListsWindows.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ find_package(boost_program_options CONFIG REQUIRED)
find_package(boost_multi_index CONFIG REQUIRED)
add_definitions("-DSPDLOG_FMT_EXTERNAL")

# Find the location of the gRPC plugin
get_target_property(GRPC_CPP_PLUGIN gRPC::grpc_cpp_plugin LOCATION)

add_definitions("-DCOLLECT_MAJOR=${COLLECT_MAJOR}")
add_definitions("-DCOLLECT_MINOR=${COLLECT_MINOR}")
add_definitions("-DCOLLECT_PATCH=${COLLECT_PATCH}")
Expand All @@ -51,17 +54,6 @@ if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
endif()
endif()

# There is a bug with grpc. It is not put in the triplet directory. So we have
# to search for its plugin.
file(GLOB_RECURSE GRPC_CPP_PLUGIN_EXE
RELATIVE ${CMAKE_BINARY_DIR} grpc_cpp_plugin.exe)
find_program(GRPC_CPP_PLUGIN
NAMES ${GRPC_CPP_PLUGIN_EXE}
PATHS ${CMAKE_BINARY_DIR}
REQUIRED
NO_DEFAULT_PATH)

set(PROTOBUF_LIB_DIR ${Protobuf_DIR}/../../lib)
set(VCPKG_INCLUDE_DIR ${OPENSSL_INCLUDE_DIR})
include(GNUInstallDirs)

Expand Down
15 changes: 8 additions & 7 deletions agent/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ add_library(centagent_lib STATIC

include_directories(
${INCLUDE_DIR}
${NATIVE_INC}
${SRC_DIR}
${NATIVE_INC}
${SRC_DIR}
${CMAKE_SOURCE_DIR}/common/inc
${CMAKE_SOURCE_DIR}/common/grpc/inc
${CMAKE_SOURCE_DIR}/common/process/inc
Expand All @@ -199,14 +199,15 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")

target_link_libraries(
${CENTREON_AGENT} PRIVATE
-L${PROTOBUF_LIB_DIR}
gRPC::gpr gRPC::grpc gRPC::grpc++ gRPC::grpc++_alts
-Wl,--whole-archive
gRPC::grpc++
-Wl,--no-whole-archive
absl::any absl::log absl::base absl::bits
centagent_lib
centreon_common
centreon_grpc
centreon_process
-L${Boost_LIBRARY_DIR_RELEASE}
boost_program_options
Boost::program_options
-static-libgcc -static-libstdc++
fmt::fmt
stdc++fs)
Expand All @@ -219,7 +220,7 @@ else()
centreon_common
centreon_grpc
centreon_process
gRPC::gpr gRPC::grpc gRPC::grpc++ gRPC::grpc++_alts
gRPC::grpc++
absl::any absl::log absl::base absl::bits
Boost::program_options
fmt::fmt
Expand Down
211 changes: 102 additions & 109 deletions agent/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,109 +1,102 @@
#
# Copyright 2024 Centreon
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
#
# For more information : contact@centreon.com
#

set( SRC_COMMON
check_test.cc
check_exec_test.cc
drive_size_test.cc
check_health_test.cc
scheduler_test.cc
test_main.cc
)



if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(SRC ${SRC_COMMON} config_test.cc check_linux_cpu_test.cc)
else()
set(SRC ${SRC_COMMON}
filter_test.cc
check_event_log_data_test.cc
check_event_log_filter_test.cc
check_event_log_test.cc
check_event_log_uniq_test.cc
check_process_container_test.cc
check_process_data_test.cc
check_process_filter_test.cc
check_process_test.cc
check_windows_cpu_test.cc
check_windows_counter.cc
check_windows_memory_test.cc
check_windows_sched.cc
check_uptime_test.cc
check_windows_service_test.cc)

set_source_files_properties(filter_test.cc PROPERTIES COMPILE_FLAGS /bigobj)
endif()


add_executable(ut_agent ${SRC})

add_test(NAME tests COMMAND ut_agent)

set_target_properties(
ut_agent
PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/tests
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/tests
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/tests
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_BINARY_DIR}/tests
RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${CMAKE_BINARY_DIR}/tests)

if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
target_link_libraries(ut_agent PRIVATE
centagent_lib
centreon_common
centreon_process
GTest::gtest
GTest::gtest_main
GTest::gmock
GTest::gmock_main
-L${Boost_LIBRARY_DIR_RELEASE}
boost_program_options
stdc++fs
-L${PROTOBUF_LIB_DIR}
gRPC::gpr gRPC::grpc gRPC::grpc++ gRPC::grpc++_alts
fmt::fmt pthread
crypto ssl
)
else()
target_link_libraries(ut_agent PRIVATE
centagent_lib
centreon_common
centreon_process
GTest::gtest
GTest::gtest_main
GTest::gmock
GTest::gmock_main
Boost::program_options
gRPC::gpr gRPC::grpc gRPC::grpc++ gRPC::grpc++_alts
fmt::fmt
pdh
taskschd)
endif()

add_dependencies(ut_agent centreon_common centagent_lib)

set_property(TARGET ut_agent PROPERTY POSITION_INDEPENDENT_CODE ON)

target_include_directories(ut_agent PRIVATE "${PROJECT_SOURCE_DIR}/src")

target_precompile_headers(ut_agent PRIVATE ${PROJECT_SOURCE_DIR}/precomp_inc/precomp.hh)

file(COPY ${PROJECT_SOURCE_DIR}/test/scripts/sleep.bat
DESTINATION ${CMAKE_BINARY_DIR}/tests)

#
# Copyright 2024-2025 Centreon
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
#
# For more information : contact@centreon.com
#

set(SRC_COMMON check_test.cc check_exec_test.cc drive_size_test.cc
check_health_test.cc scheduler_test.cc test_main.cc)

if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(SRC ${SRC_COMMON} config_test.cc check_linux_cpu_test.cc)
else()
set(SRC
${SRC_COMMON}
filter_test.cc
check_event_log_data_test.cc
check_event_log_filter_test.cc
check_event_log_test.cc
check_event_log_uniq_test.cc
check_process_container_test.cc
check_process_data_test.cc
check_process_filter_test.cc
check_process_test.cc
check_windows_cpu_test.cc
check_windows_counter.cc
check_windows_memory_test.cc
check_windows_sched.cc
check_uptime_test.cc
check_windows_service_test.cc)

set_source_files_properties(filter_test.cc PROPERTIES COMPILE_FLAGS /bigobj)
endif()

add_executable(ut_agent ${SRC})

add_test(NAME tests COMMAND ut_agent)

set_target_properties(
ut_agent
PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/tests
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/tests
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/tests
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_BINARY_DIR}/tests
RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${CMAKE_BINARY_DIR}/tests)

if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
target_link_libraries(
ut_agent
PRIVATE centagent_lib
centreon_common
centreon_process
GTest::gtest
GTest::gtest_main
GTest::gmock
GTest::gmock_main
Boost::program_options
stdc++fs
gRPC::grpc++
fmt::fmt
pthread
crypto
ssl)
add_dependencies(ut_agent centreon_common centagent_lib process_stat)
else()
target_link_libraries(
ut_agent
PRIVATE centagent_lib
centreon_common
centreon_process
GTest::gtest
GTest::gtest_main
GTest::gmock
GTest::gmock_main
Boost::program_options
gRPC::grpc++
fmt::fmt
pdh
taskschd)
add_dependencies(ut_agent centreon_common centagent_lib)
endif()

set_property(TARGET ut_agent PROPERTY POSITION_INDEPENDENT_CODE ON)

target_include_directories(ut_agent PRIVATE "${PROJECT_SOURCE_DIR}/src")

target_precompile_headers(ut_agent PRIVATE
${PROJECT_SOURCE_DIR}/precomp_inc/precomp.hh)

file(COPY ${PROJECT_SOURCE_DIR}/test/scripts/sleep.bat
DESTINATION ${CMAKE_BINARY_DIR}/tests)
Loading
Loading