From 0164a51a8645bdb0bf923aad350c86759c3b2f10 Mon Sep 17 00:00:00 2001 From: Ilya Mashchenko Date: Fri, 31 Jan 2025 15:19:32 +0200 Subject: [PATCH 01/10] chore: remove old dashboard leftovers (#19545) --- .codacy.yml | 7 --- .github/workflows/dashboard-pr.yml | 54 ------------------- .gitignore | 8 --- README.md | 2 +- docs/dashboards-and-charts/README.md | 2 - .../python-collector.txt | 1 - docs/glossary.md | 2 - src/collectors/statsd.plugin/README.md | 2 - src/health/notifications/alarm-notify.sh.in | 1 - 9 files changed, 1 insertion(+), 78 deletions(-) delete mode 100644 .github/workflows/dashboard-pr.yml diff --git a/.codacy.yml b/.codacy.yml index ee9c3466977705..a92098653c68db 100644 --- a/.codacy.yml +++ b/.codacy.yml @@ -4,13 +4,6 @@ exclude_paths: - src/collectors/python.d.plugin/python_modules/urllib3/** - src/collectors/python.d.plugin/python_modules/third_party/** - packaging/makeself/** - - src/web/gui/css/** - - src/web/gui/lib/** - - src/web/gui/old/** - - src/web/gui/src/** - - src/web/gui/v1/** - - src/web/gui/v2/** - - src/web/gui/main.js - tests/** - aclk/tests/** - src/libnetdata/libjudy/** diff --git a/.github/workflows/dashboard-pr.yml b/.github/workflows/dashboard-pr.yml deleted file mode 100644 index b72c0fc6c66573..00000000000000 --- a/.github/workflows/dashboard-pr.yml +++ /dev/null @@ -1,54 +0,0 @@ ---- -# Create a PR to update the react dashboard code. -name: Dashboard Version PR - -on: - workflow_dispatch: - inputs: - dashboard_version: - # This must be specified, and must _exactly_ match the version - # tag for the release to be used for the update. - description: Dashboard Version - required: true - -env: - DISABLE_TELEMETRY: 1 - -jobs: - dashboard-pr: - name: Generate Dashboard Version Bump PR - runs-on: ubuntu-latest - steps: - - name: Checkout - id: checkout - uses: actions/checkout@v4 - - name: Update Files - id: update - run: | - src/web/gui/bundle_dashboard_v1.py ${{ github.event.inputs.dashboard_version }} - - name: Create Pull Request - id: pr - uses: peter-evans/create-pull-request@v7 - with: - title: 'Update dashboard to version ${{ github.event.inputs.dashboard_version }}.' - body: 'See https://github.com/netdata/dashboard/releases/tag/${{ github.event.inputs.dashboard_version }} for changes.' - branch: dashboard-${{ github.event.inputs.dashboard_version }} - branch-suffix: timestamp - delete-branch: true - commit-message: 'Update dashboard to version ${{ github.event.inputs.dashboard_version }}.' - token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }} - - name: Failure Notification - uses: rtCamp/action-slack-notify@v2 - env: - SLACK_COLOR: 'danger' - SLACK_FOOTER: '' - SLACK_ICON_EMOJI: ':github-actions:' - SLACK_TITLE: 'Dashboard update PR creation failed:' - SLACK_USERNAME: 'GitHub Actions' - SLACK_MESSAGE: |- - ${{ github.repository }}: Failed to create PR to update dashboard code to newest release. - Checkout: ${{ steps.checkout.outcome }} - Update files: ${{ steps.update.outcome }} - Create PR: ${{ steps.pr.outcome }} - SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} - if: failure() diff --git a/.gitignore b/.gitignore index 5d460ff33416a8..063a5b2a551d7c 100644 --- a/.gitignore +++ b/.gitignore @@ -60,14 +60,6 @@ README TODO.md TODO.txt -src/web/gui/chart-info/ -src/web/gui/control.html -src/web/gui/dashboard.js -src/web/gui/datasource.css -src/web/gui/gadget.xml -src/web/gui/index_new.html -src/web/gui/version.txt - # related to karma/javascript/node /node_modules/ /coverage/ diff --git a/README.md b/README.md index 32e1a1747cf999..15d8900edfe276 100644 --- a/README.md +++ b/README.md @@ -803,6 +803,6 @@ The Netdata ecosystem consists of three key parts: - **Netdata Cloud**: A commercial, closed-source component, Netdata Cloud enhances the capabilities of the open-source Netdata Agent by providing horizontal scalability, centralized alert notification dispatch (including a mobile app), user management, role-based access control, and other enterprise-grade features. It is available both as a SaaS solution and for on-premises deployment, with a free-to-use community tier also offered. -- **Netdata UI**: The Netdata UI is closed-source, and handles all visualization and dashboard functionalities related to metrics, logs and other collected data, as well as the central configuration and management of the Netdata ecosystem. It serves both the Netdata Agent and Netdata Cloud. The Netdata UI is distributed in binary form with the Netdata Agent and is publicly accessible via a CDN, licensed under the [Netdata Cloud UI License 1 (NCUL1)](https://app.netdata.cloud/LICENSE.txt). It integrates third-party open-source components, detailed in the [Netdata UI third-party licenses](https://github.com/netdata/netdata/blob/master/src/web/gui/v2/3D_PARTY_LICENSES.txt). +- **Netdata UI**: The Netdata UI is closed-source, and handles all visualization and dashboard functionalities related to metrics, logs and other collected data, as well as the central configuration and management of the Netdata ecosystem. It serves both the Netdata Agent and Netdata Cloud. The Netdata UI is distributed in binary form with the Netdata Agent and is publicly accessible via a CDN, licensed under the [Netdata Cloud UI License 1 (NCUL1)](https://app.netdata.cloud/LICENSE.txt). It integrates third-party open-source components, detailed in the [Netdata UI third-party licenses](https://app.netdata.cloud/3D_PARTY_LICENSES.txt). The binary installation packages provided by Netdata include the Netdata Agent and the Netdata UI. Since the Netdata Agent is open-source, it is frequently packaged by third parties (e.g., Linux Distributions) excluding the closed-source components (Netdata UI is not included). While their packages can still be useful in providing the necessary back-ends and the APIs of a fully functional monitoring solution, we recommend using the installation packages we provide to experience the full feature set of Netdata. diff --git a/docs/dashboards-and-charts/README.md b/docs/dashboards-and-charts/README.md index b32d97ccc2a1d1..7f292049caef29 100644 --- a/docs/dashboards-and-charts/README.md +++ b/docs/dashboards-and-charts/README.md @@ -36,5 +36,3 @@ You can access the dashboard at and [sign-in with a ### Netdata Agent To view your Netdata dashboard, open a web browser and enter the address `http://NODE:19999` - replace `NODE` with your Agent's IP address or hostname. If the Agent is on the same machine, use `http://localhost:19999`. - -Documentation for the previous Agent dashboard can still be found [here](/src/web/gui/README.md). diff --git a/docs/developer-and-contributor-corner/python-collector.txt b/docs/developer-and-contributor-corner/python-collector.txt index 9f75a030d6eb51..317fed85a7ad69 100644 --- a/docs/developer-and-contributor-corner/python-collector.txt +++ b/docs/developer-and-contributor-corner/python-collector.txt @@ -542,7 +542,6 @@ At minimum, to be buildable and testable, the PR needs to include: - A basic configuration for the plugin in the appropriate global config file: `collectors/python.d.plugin/python.d.conf`, which is also in YAML format. Either add a line that reads `# : yes` if the module is to be enabled by default, or one that reads `: no` if it is to be disabled by default. - A makefile for the plugin at `collectors/python.d.plugin//Makefile.inc`. Check an existing plugin for what this should look like. - A line in `collectors/python.d.plugin/Makefile.am` including the above-mentioned makefile. Place it with the other plugin includes (please keep the includes sorted alphabetically). -- Optionally, chart information in `src/web/gui/dashboard_info.js`. This generally involves specifying a name and icon for the section, and may include descriptions for the section or individual charts. - Optionally, some default alert configurations for your collector in `health/health.d/.conf` and a line adding `.conf` in `health/Makefile.am`. ## Framework class reference diff --git a/docs/glossary.md b/docs/glossary.md index ce9953d34fbddc..10657ed8b1118a 100644 --- a/docs/glossary.md +++ b/docs/glossary.md @@ -35,8 +35,6 @@ Missing a term? Let us know or submit a request to expand our glossary. Together - [**Context**](/docs/dashboards-and-charts/netdata-charts.md#contexts): A way of grouping charts by the types of metrics collected and dimensions displayed. It's kind of like a machine-readable naming and organization scheme. -- [**Custom dashboards**](/src/web/gui/custom/README.md) A dashboard that you can create using simple HTML (no JavaScript is required for basic dashboards). - ## D - [**Dashboard**](/docs/dashboards-and-charts/README.md): Out-of-the-box visual representation of metrics to provide insight into your infrastructure, its health and performance. diff --git a/src/collectors/statsd.plugin/README.md b/src/collectors/statsd.plugin/README.md index 7af7c14d18e887..25313ffa3d19ec 100644 --- a/src/collectors/statsd.plugin/README.md +++ b/src/collectors/statsd.plugin/README.md @@ -972,8 +972,6 @@ At this point, you have used StatsD to gather metrics for k6, creating a whole n Netdata dashboard in the process. Moreover, you can further customize the icon of the particular section, as well as the description for each chart. -To edit the section, please follow the Netdata [documentation](/src/web/gui/README.md#customizing-the-local-dashboard). - While the following configuration will be placed in a new file, as the documentation suggests, it is instructing to use `dashboard_info.js` as a template. Open the file and see how the rest of sections and collectors have been defined. diff --git a/src/health/notifications/alarm-notify.sh.in b/src/health/notifications/alarm-notify.sh.in index 3dccf2a4b61030..1170ddf5eed7a2 100755 --- a/src/health/notifications/alarm-notify.sh.in +++ b/src/health/notifications/alarm-notify.sh.in @@ -2490,7 +2490,6 @@ send_ntfy() { msg="${host} ${status_message}: ${alarm} - ${info}" httpcode=$(docurl -X POST \ "${ntfy_auth_header[@]}" \ - -H "Icon: https://raw.githubusercontent.com/netdata/netdata/master/src/web/gui/dashboard/images/favicon-196x196.png" \ -H "Title: ${host}: ${name//_/ }" \ -H "Tags: ${emoji}" \ -H "Priority: ${priority}" \ From 34236bffa4bec1952eb796e22f65900b82269866 Mon Sep 17 00:00:00 2001 From: "Austin S. Hemmelgarn" Date: Fri, 31 Jan 2025 08:20:05 -0500 Subject: [PATCH 02/10] Actually handle the `-fexceptions` requirement correctly in our build system. (#19534) --- CMakeLists.txt | 5 ----- .../cmake/Modules/NetdataCompilerFlags.cmake | 22 +++++++++++++++++++ src/daemon/main.c | 5 ----- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index acfedc84e19347..321ebddfb93dd3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,11 +83,6 @@ if(USE_MOLD) endif() endif() -check_c_compiler_flag("-fexceptions" HAVE_FEXCEPTIONS) -if (NOT HAVE_FEXCEPTIONS) - message(FATAL_ERROR "Missing required compiler flag: -fexceptions.") -endif() - set(CONFIG_H_DIR ${CMAKE_BINARY_DIR}) set(CONFIG_H ${CONFIG_H_DIR}/config.h) diff --git a/packaging/cmake/Modules/NetdataCompilerFlags.cmake b/packaging/cmake/Modules/NetdataCompilerFlags.cmake index 04f94d4aee0dd0..5e44137b17959c 100644 --- a/packaging/cmake/Modules/NetdataCompilerFlags.cmake +++ b/packaging/cmake/Modules/NetdataCompilerFlags.cmake @@ -69,6 +69,26 @@ function(add_double_extra_compiler_flag match flag1 flag2) endif() endfunction() +# Add a required extra compiler flag to C and C++ flags. +# +# Similar logic as add_simple_extra_compiler_flag, but ignores existing +# instances and throws an error if the flag is not supported. +function(add_required_compiler_flag flag) + set(CMAKE_REQUIRED_FLAGS "-Werror") + + make_cpp_safe_name("${flag}" flag_name) + + check_c_compiler_flag("${flag}" HAVE_C_${flag_name}) + check_cxx_compiler_flag("${flag}" HAVE_CXX_${flag_name}) + + if(HAVE_C_${flag_name} AND HAVE_CXX_${flag_name}) + add_compile_options("${flag}") + add_link_options("${flag}") + else() + message(FATAL_ERROR "${flag} support is required to build Netdata") + endif() +endfunction() + if(CMAKE_BUILD_TYPE STREQUAL "Debug") option(DISABLE_HARDENING "Disable adding extra compiler flags for hardening" TRUE) else() @@ -84,6 +104,8 @@ endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS}") +add_required_compiler_flag("-fexceptions") + if(NOT ${DISABLE_HARDENING}) add_double_extra_compiler_flag("stack-protector" "-fstack-protector-strong" "-fstack-protector") add_double_extra_compiler_flag("_FORTIFY_SOURCE" "-D_FORTIFY_SOURCE=3" "-D_FORTIFY_SOURCE=2") diff --git a/src/daemon/main.c b/src/daemon/main.c index 4d61070e9ae98d..9977802828054f 100644 --- a/src/daemon/main.c +++ b/src/daemon/main.c @@ -228,11 +228,6 @@ int unittest_prepare_rrd(const char **user) { } int netdata_main(int argc, char **argv) { -#if !defined(HAVE_FEXCEPTIONS) - fprintf(stderr, "Netdata has been compiled without these required compiler flags: -fexceptions.\n"); - exit(1); -#endif - string_init(); analytics_init(); From 10815cb24ac35a63461fdb3ec922b0446a043d75 Mon Sep 17 00:00:00 2001 From: "Austin S. Hemmelgarn" Date: Fri, 31 Jan 2025 08:22:23 -0500 Subject: [PATCH 03/10] Add LTO support in CMake build system. (#17027) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add LTO support in CMake build system. Internally, CMake calls LTO ‘Interprocedural Optimization’, and it provides functionality for checking for support for this as well as enabling it by default for targets. This leverages that support to auto-detect LTO and enable it if it’s supported. * Default to disabling LTO for Debug builds. * Add handling for LTO to netdata installer code. * Switch back to DISABLE_LTO as option name. Using `ENABLE_LTO` leads to a possibility for confusion among users, as it does behave in the most intuitive manner. Instead of ensuring that LTO is used (and thus behaving like every other `ENABLE_*` option we have), it allows the usage LTO if it’s supported. Thus a build with `-DENABLE_LTO=True` may not actually be built with LTO. By instead using `DISABLE_LTO`, the behavior matches up directly with how most people are likely to interpret the meaning, because a build with `-DDISABLE_LTO=True` will _never_ have LTO flags added to the compiler/linker flags. * Fix condition for determining default for DISABLE_LTO. * Turn off LTO auto-detection in RPM package builds. On pretty much all RPM platforms, the RPM build process itself will correctly add the required compiler flags when building, so we don’t actually need to auto-detect LTO support in CMake here. Additionally, on at least some RPM platforms, CMake’s auto-detection for LTO support actually breaks the build when used. * Disable function and data sections when using LTO. On at least some systems, `-fdata-sections` combined with LTO reliably causes failures at link time with our code. The final binary size on systems where the combination _works_ differs by no more than a few KiB on average (tested on 64-bit x86 on Ubuntu 22.04, Debian 12, Fedora 39, and Rocky Linux 9), so we’re not actually getting almost any benefit out of using both with things as they are now, but LTO gives us a meaasurable performance improvement that per-function and per-data sections do not. * Restructure in-line with current repo state. * Disable LTO on Windows builds since it doesn’t work there. * Fix compiler flag handling order. * Switch LTO option name to USE_LTO for consistency with USE_MOLD. --- CMakeLists.txt | 9 ++++++-- netdata-installer.sh | 8 ++----- netdata.spec.in | 1 + .../cmake/Modules/NetdataCompilerFlags.cmake | 22 +++++++++++++++++++ packaging/installer/functions.sh | 8 +++++++ 5 files changed, 40 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 321ebddfb93dd3..55db38ebe8cc0d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,8 +54,6 @@ if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release") endif() -include(NetdataCompilerFlags) - set(CMAKE_EXPORT_COMPILE_COMMANDS On) # Check for the mold linker and try to use it if available @@ -149,6 +147,13 @@ else() message(FATAL_ERROR "Unknown/unsupported platform: ${CMAKE_SYSTEM_NAME} (Supported platforms: FreeBSD, Linux, macOS, Windows)") endif() +include(NetdataCompilerFlags) + +check_c_compiler_flag("-fexceptions" HAVE_FEXCEPTIONS) +if (NOT HAVE_FEXCEPTIONS) + message(FATAL_ERROR "Missing required compiler flag: -fexceptions.") +endif() + # This is intended to make life easier for developers who are working on one # specific feature. # diff --git a/netdata-installer.sh b/netdata-installer.sh index dd1d436650eb20..494a79d78fb95a 100755 --- a/netdata-installer.sh +++ b/netdata-installer.sh @@ -312,12 +312,8 @@ while [ -n "${1}" ]; do ;; "--enable-ml") NETDATA_ENABLE_ML=1 ;; "--disable-ml") NETDATA_ENABLE_ML=0 ;; - "--enable-lto") - # TODO: Needs CMake support - ;; - "--disable-lto") - # TODO: Needs CMake support - ;; + "--enable-lto") NETDATA_ENABLE_LTO=1 ;; + "--disable-lto") NETDATA_ENABLE_LTO=0 ;; "--disable-x86-sse") # XXX: No longer supported. ;; diff --git a/netdata.spec.in b/netdata.spec.in index 6158eda8572aae..e4c60fa7eb2bfb 100644 --- a/netdata.spec.in +++ b/netdata.spec.in @@ -336,6 +336,7 @@ happened, on your systems and applications. -DUSE_CXX_11=On \ %endif %endif + -DDISABLE_LTO=On \ %if %{_have_cups} -DENABLE_PLUGIN_CUPS=On \ %else diff --git a/packaging/cmake/Modules/NetdataCompilerFlags.cmake b/packaging/cmake/Modules/NetdataCompilerFlags.cmake index 5e44137b17959c..1bfc7238dc4211 100644 --- a/packaging/cmake/Modules/NetdataCompilerFlags.cmake +++ b/packaging/cmake/Modules/NetdataCompilerFlags.cmake @@ -91,8 +91,10 @@ endfunction() if(CMAKE_BUILD_TYPE STREQUAL "Debug") option(DISABLE_HARDENING "Disable adding extra compiler flags for hardening" TRUE) + option(USE_LTO "Attempt to use of LTO when building. Defaults to being enabled if supported for release builds." FALSE) else() option(DISABLE_HARDENING "Disable adding extra compiler flags for hardening" FALSE) + option(USE_LTO "Attempt to use of LTO when building. Defaults to being enabled if supported for release builds." TRUE) endif() option(ENABLE_ADDRESS_SANITIZER "Build with address sanitizer enabled" False) @@ -102,6 +104,26 @@ if(ENABLE_ADDRESS_SANITIZER) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address") endif() +if(USE_LTO) + if(OS_WINDOWS) + message(WARNING "LTO not supported on Windows, not checking for it") + else() + include(CheckIPOSupported) + + message(CHECK_START "Checking for LTO support") + check_ipo_supported(RESULT HAVE_LTO) + + if(HAVE_LTO) + message(CHECK_PASS "supported") + set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) + else() + message(CHECK_FAIL "not supported") + endif() + endif() +else() + message(STATUS "Not checking for LTO support as it has been explicitly disabled") +endif() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS}") add_required_compiler_flag("-fexceptions") diff --git a/packaging/installer/functions.sh b/packaging/installer/functions.sh index 5249f8eaf42208..ceca2a6f3920d2 100644 --- a/packaging/installer/functions.sh +++ b/packaging/installer/functions.sh @@ -297,6 +297,14 @@ prepare_cmake_options() { NETDATA_CMAKE_OPTIONS="${NETDATA_CMAKE_OPTIONS} -DUSE_CXX_11=On" fi + if [ -n "${NETDATA_ENABLE_LTO}" ]; then + if [ "${NETDATA_ENABLE_LTO}" -eq 1 ]; then + NETDATA_CMAKE_OPTIONS="${NETDATA_CMAKE_OPTIONS} -DDISABLE_LTO=Off" + else + NETDATA_CMAKE_OPTIONS="${NETDATA_CMAKE_OPTIONS} -DDISABLE_LTO=On" + fi + fi + if [ "${ENABLE_GO:-1}" -eq 1 ]; then enable_feature PLUGIN_GO 1 else From fcd81cf537a288ff61a0f91205a9f57a12ca442e Mon Sep 17 00:00:00 2001 From: Ilya Mashchenko Date: Fri, 31 Jan 2025 15:26:36 +0200 Subject: [PATCH 04/10] chore(windows.plugin): format perflib ad and netframework (#19544) --- src/collectors/windows.plugin/perflib-ad.c | 983 ++++++++---------- .../windows.plugin/perflib-netframework.c | 768 +++++++------- 2 files changed, 834 insertions(+), 917 deletions(-) diff --git a/src/collectors/windows.plugin/perflib-ad.c b/src/collectors/windows.plugin/perflib-ad.c index dbd26d58104e82..895906d75561b4 100644 --- a/src/collectors/windows.plugin/perflib-ad.c +++ b/src/collectors/windows.plugin/perflib-ad.c @@ -3,34 +3,36 @@ #include "windows_plugin.h" #include "windows-internals.h" -static void initialize(void) { +static void initialize(void) +{ ; } -static void netdata_ad_directory(PERF_DATA_BLOCK *pDataBlock, PERF_OBJECT_TYPE *pObjectType, int update_every) { - static COUNTER_DATA directoryPercReadsFromDCA = { .key = "DS % Reads from DRA" }; - static COUNTER_DATA directoryPercReadsFromKCC = { .key = "DS % Reads from KCC" }; - static COUNTER_DATA directoryPercReadsFromLSA = { .key = "DS % Reads from LSA" }; - static COUNTER_DATA directoryPercReadsFromNSPI = { .key = "DS % Reads from NSPI" }; - static COUNTER_DATA directoryPercReadsFromNTDSAPI = { .key = "DS % Reads from NTDSAPI" }; - static COUNTER_DATA directoryPercReadsFromSAM = { .key = "DS % Reads from SAM" }; - static COUNTER_DATA directoryPercReadsOther = { .key = "DS % Reads from Other" }; - - static COUNTER_DATA directoryPercSearchesFromDCA = { .key = "DS % Searches from DRA" }; - static COUNTER_DATA directoryPercSearchesFromKCC = { .key = "DS % Searches from KCC" }; - static COUNTER_DATA directoryPercSearchesFromLSA = { .key = "DS % Searches from LSA" }; - static COUNTER_DATA directoryPercSearchesFromNSPI = { .key = "DS % Searches from NSPI" }; - static COUNTER_DATA directoryPercSearchesFromNTDSAPI = { .key = "DS % Searches from NTDSAPI" }; - static COUNTER_DATA directoryPercSearchesFromSAM = { .key = "DS % Searches from SAM" }; - static COUNTER_DATA directoryPercSearchesOther = { .key = "DS % Searches from Other" }; - - static COUNTER_DATA directoryPercWritesFromDCA = { .key = "DS % Writes from DRA" }; - static COUNTER_DATA directoryPercWritesFromKCC = { .key = "DS % Writes from KCC" }; - static COUNTER_DATA directoryPercWritesFromLSA = { .key = "DS % Writes from LSA" }; - static COUNTER_DATA directoryPercWritesFromNSPI = { .key = "DS % Writes from NSPI" }; - static COUNTER_DATA directoryPercWritesFromNTDSAPI = { .key = "DS % Writes from NTDSAPI" }; - static COUNTER_DATA directoryPercWritesFromSAM = { .key = "DS % Writes from SAM" }; - static COUNTER_DATA directoryPercWritesOther = { .key = "DS % Writes from Other" }; +static void netdata_ad_directory(PERF_DATA_BLOCK *pDataBlock, PERF_OBJECT_TYPE *pObjectType, int update_every) +{ + static COUNTER_DATA directoryPercReadsFromDCA = {.key = "DS % Reads from DRA"}; + static COUNTER_DATA directoryPercReadsFromKCC = {.key = "DS % Reads from KCC"}; + static COUNTER_DATA directoryPercReadsFromLSA = {.key = "DS % Reads from LSA"}; + static COUNTER_DATA directoryPercReadsFromNSPI = {.key = "DS % Reads from NSPI"}; + static COUNTER_DATA directoryPercReadsFromNTDSAPI = {.key = "DS % Reads from NTDSAPI"}; + static COUNTER_DATA directoryPercReadsFromSAM = {.key = "DS % Reads from SAM"}; + static COUNTER_DATA directoryPercReadsOther = {.key = "DS % Reads from Other"}; + + static COUNTER_DATA directoryPercSearchesFromDCA = {.key = "DS % Searches from DRA"}; + static COUNTER_DATA directoryPercSearchesFromKCC = {.key = "DS % Searches from KCC"}; + static COUNTER_DATA directoryPercSearchesFromLSA = {.key = "DS % Searches from LSA"}; + static COUNTER_DATA directoryPercSearchesFromNSPI = {.key = "DS % Searches from NSPI"}; + static COUNTER_DATA directoryPercSearchesFromNTDSAPI = {.key = "DS % Searches from NTDSAPI"}; + static COUNTER_DATA directoryPercSearchesFromSAM = {.key = "DS % Searches from SAM"}; + static COUNTER_DATA directoryPercSearchesOther = {.key = "DS % Searches from Other"}; + + static COUNTER_DATA directoryPercWritesFromDCA = {.key = "DS % Writes from DRA"}; + static COUNTER_DATA directoryPercWritesFromKCC = {.key = "DS % Writes from KCC"}; + static COUNTER_DATA directoryPercWritesFromLSA = {.key = "DS % Writes from LSA"}; + static COUNTER_DATA directoryPercWritesFromNSPI = {.key = "DS % Writes from NSPI"}; + static COUNTER_DATA directoryPercWritesFromNTDSAPI = {.key = "DS % Writes from NTDSAPI"}; + static COUNTER_DATA directoryPercWritesFromSAM = {.key = "DS % Writes from SAM"}; + static COUNTER_DATA directoryPercWritesOther = {.key = "DS % Writes from Other"}; perflibGetObjectCounter(pDataBlock, pObjectType, &directoryPercReadsFromDCA); perflibGetObjectCounter(pDataBlock, pObjectType, &directoryPercReadsFromKCC); @@ -61,195 +63,160 @@ static void netdata_ad_directory(PERF_DATA_BLOCK *pDataBlock, PERF_OBJECT_TYPE * static RRDDIM *rd_directory_operation_total_write = NULL; static RRDDIM *rd_directory_operation_total_search = NULL; - if (unlikely(!st_directory_operation_total)) { - st_directory_operation_total = rrdset_create_localhost("ad" - , "directory_operations_read" - , NULL - , "database" - , "ad.directory_operations" - , "AD directory operations" - , "operations/s" - , PLUGIN_WINDOWS_NAME - , "PerflibAD" - , PRIO_AD_DIROPERATIONS_TOTAL - , update_every - , RRDSET_TYPE_LINE); - - rd_directory_operation_total_read = rrddim_add(st_directory_operation_total, - "read", - NULL, - 1, - 1, - RRD_ALGORITHM_INCREMENTAL); - - rd_directory_operation_total_write = rrddim_add(st_directory_operation_total, - "write", - NULL, - 1, - 1, - RRD_ALGORITHM_INCREMENTAL); - - rd_directory_operation_total_search = rrddim_add(st_directory_operation_total, - "search", - NULL, - 1, - 1, - RRD_ALGORITHM_INCREMENTAL); + st_directory_operation_total = rrdset_create_localhost( + "ad", + "directory_operations_read", + NULL, + "database", + "ad.directory_operations", + "AD directory operations", + "operations/s", + PLUGIN_WINDOWS_NAME, + "PerflibAD", + PRIO_AD_DIROPERATIONS_TOTAL, + update_every, + RRDSET_TYPE_LINE); + + rd_directory_operation_total_read = + rrddim_add(st_directory_operation_total, "read", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); + + rd_directory_operation_total_write = + rrddim_add(st_directory_operation_total, "write", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); + + rd_directory_operation_total_search = + rrddim_add(st_directory_operation_total, "search", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); } - collected_number readValue = directoryPercReadsFromDCA.current.Data + - directoryPercReadsFromKCC.current.Data + - directoryPercReadsFromLSA.current.Data + - directoryPercReadsFromNSPI.current.Data + - directoryPercReadsFromNTDSAPI.current.Data + - directoryPercReadsFromSAM.current.Data + - directoryPercReadsOther.current.Data ; - - collected_number writeValue = directoryPercWritesFromDCA.current.Data + - directoryPercWritesFromKCC.current.Data + - directoryPercWritesFromLSA.current.Data + - directoryPercWritesFromNSPI.current.Data + - directoryPercWritesFromNTDSAPI.current.Data + - directoryPercWritesFromSAM.current.Data + - directoryPercWritesOther.current.Data ; - - collected_number searchValue = directoryPercSearchesFromDCA.current.Data + - directoryPercSearchesFromKCC.current.Data + - directoryPercSearchesFromLSA.current.Data + - directoryPercSearchesFromNSPI.current.Data + - directoryPercSearchesFromNTDSAPI.current.Data + - directoryPercSearchesFromSAM.current.Data + - directoryPercSearchesOther.current.Data ; - - rrddim_set_by_pointer(st_directory_operation_total, - rd_directory_operation_total_read, - readValue); - - rrddim_set_by_pointer(st_directory_operation_total, - rd_directory_operation_total_write, - writeValue); - - rrddim_set_by_pointer(st_directory_operation_total, - rd_directory_operation_total_search, - searchValue); + collected_number readValue = directoryPercReadsFromDCA.current.Data + directoryPercReadsFromKCC.current.Data + + directoryPercReadsFromLSA.current.Data + directoryPercReadsFromNSPI.current.Data + + directoryPercReadsFromNTDSAPI.current.Data + directoryPercReadsFromSAM.current.Data + + directoryPercReadsOther.current.Data; + + collected_number writeValue = directoryPercWritesFromDCA.current.Data + directoryPercWritesFromKCC.current.Data + + directoryPercWritesFromLSA.current.Data + directoryPercWritesFromNSPI.current.Data + + directoryPercWritesFromNTDSAPI.current.Data + + directoryPercWritesFromSAM.current.Data + directoryPercWritesOther.current.Data; + + collected_number searchValue = + directoryPercSearchesFromDCA.current.Data + directoryPercSearchesFromKCC.current.Data + + directoryPercSearchesFromLSA.current.Data + directoryPercSearchesFromNSPI.current.Data + + directoryPercSearchesFromNTDSAPI.current.Data + directoryPercSearchesFromSAM.current.Data + + directoryPercSearchesOther.current.Data; + + rrddim_set_by_pointer(st_directory_operation_total, rd_directory_operation_total_read, readValue); + + rrddim_set_by_pointer(st_directory_operation_total, rd_directory_operation_total_write, writeValue); + + rrddim_set_by_pointer(st_directory_operation_total, rd_directory_operation_total_search, searchValue); rrdset_done(st_directory_operation_total); } -static void netdata_ad_cache_lookups(PERF_DATA_BLOCK *pDataBlock, PERF_OBJECT_TYPE *pObjectType, int update_every) { - static COUNTER_DATA nameCacheLookupsTotal = { .key = "DS Name Cache hit rate,secondvalue" }; +static void netdata_ad_cache_lookups(PERF_DATA_BLOCK *pDataBlock, PERF_OBJECT_TYPE *pObjectType, int update_every) +{ + static COUNTER_DATA nameCacheLookupsTotal = {.key = "DS Name Cache hit rate,secondvalue"}; static RRDSET *st_name_cache_lookups_total = NULL; static RRDDIM *rd_name_cache_lookups_total = NULL; - if(perflibGetObjectCounter(pDataBlock, pObjectType, &nameCacheLookupsTotal)) { + if (perflibGetObjectCounter(pDataBlock, pObjectType, &nameCacheLookupsTotal)) { if (unlikely(!st_name_cache_lookups_total)) { - st_name_cache_lookups_total = rrdset_create_localhost("ad" - , "name_cache_lookups" - , NULL - , "database" - , "ad.name_cache_lookups" - , "Name cache lookups" - , "lookups/s" - , PLUGIN_WINDOWS_NAME - , "PerflibAD" - , PRIO_AD_CACHE_LOOKUP_TOTAL - , update_every - , RRDSET_TYPE_LINE - ); - - rd_name_cache_lookups_total = rrddim_add(st_name_cache_lookups_total, - "lookups", - NULL, - 1, - 1, - RRD_ALGORITHM_INCREMENTAL); + st_name_cache_lookups_total = rrdset_create_localhost( + "ad", + "name_cache_lookups", + NULL, + "database", + "ad.name_cache_lookups", + "Name cache lookups", + "lookups/s", + PLUGIN_WINDOWS_NAME, + "PerflibAD", + PRIO_AD_CACHE_LOOKUP_TOTAL, + update_every, + RRDSET_TYPE_LINE); + + rd_name_cache_lookups_total = + rrddim_add(st_name_cache_lookups_total, "lookups", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); } - rrddim_set_by_pointer(st_name_cache_lookups_total, - rd_name_cache_lookups_total, - (collected_number)nameCacheLookupsTotal.current.Data); + rrddim_set_by_pointer( + st_name_cache_lookups_total, + rd_name_cache_lookups_total, + (collected_number)nameCacheLookupsTotal.current.Data); rrdset_done(st_name_cache_lookups_total); } } -static void netdata_ad_cache_hits(PERF_DATA_BLOCK *pDataBlock, PERF_OBJECT_TYPE *pObjectType, int update_every) { - static COUNTER_DATA nameCacheHitsTotal = { .key = "DS Name Cache hit rate" }; +static void netdata_ad_cache_hits(PERF_DATA_BLOCK *pDataBlock, PERF_OBJECT_TYPE *pObjectType, int update_every) +{ + static COUNTER_DATA nameCacheHitsTotal = {.key = "DS Name Cache hit rate"}; static RRDSET *st_name_cache_hits_total = NULL; static RRDDIM *rd_name_cache_hits_total = NULL; - if(perflibGetObjectCounter(pDataBlock, pObjectType, &nameCacheHitsTotal)) { + if (perflibGetObjectCounter(pDataBlock, pObjectType, &nameCacheHitsTotal)) { if (unlikely(!st_name_cache_hits_total)) { - st_name_cache_hits_total = rrdset_create_localhost("ad" - , "name_cache_hits" - , NULL - , "database" - , "ad.name_cache_hits" - , "Name cache hits" - , "hits/s" - , PLUGIN_WINDOWS_NAME - , "PerflibAD" - , PRIO_AD_CACHE_HITS_TOTAL - , update_every - , RRDSET_TYPE_LINE - ); - - rd_name_cache_hits_total = rrddim_add(st_name_cache_hits_total, - "hits", - NULL, - 1, - 1, - RRD_ALGORITHM_INCREMENTAL); + st_name_cache_hits_total = rrdset_create_localhost( + "ad", + "name_cache_hits", + NULL, + "database", + "ad.name_cache_hits", + "Name cache hits", + "hits/s", + PLUGIN_WINDOWS_NAME, + "PerflibAD", + PRIO_AD_CACHE_HITS_TOTAL, + update_every, + RRDSET_TYPE_LINE); + + rd_name_cache_hits_total = + rrddim_add(st_name_cache_hits_total, "hits", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); } - rrddim_set_by_pointer(st_name_cache_hits_total, - rd_name_cache_hits_total, - (collected_number)nameCacheHitsTotal.current.Data); + rrddim_set_by_pointer( + st_name_cache_hits_total, rd_name_cache_hits_total, (collected_number)nameCacheHitsTotal.current.Data); rrdset_done(st_name_cache_hits_total); } } -static void netdata_ad_searches(PERF_DATA_BLOCK *pDataBlock, PERF_OBJECT_TYPE *pObjectType, int update_every) { - static COUNTER_DATA ldapSearchesTotal = { .key = "LDAP Searches/sec" }; +static void netdata_ad_searches(PERF_DATA_BLOCK *pDataBlock, PERF_OBJECT_TYPE *pObjectType, int update_every) +{ + static COUNTER_DATA ldapSearchesTotal = {.key = "LDAP Searches/sec"}; static RRDSET *st_ldap_searches_total = NULL; static RRDDIM *rd_ldap_searches_total = NULL; - if(perflibGetObjectCounter(pDataBlock, pObjectType, &ldapSearchesTotal)) { + if (perflibGetObjectCounter(pDataBlock, pObjectType, &ldapSearchesTotal)) { if (unlikely(!st_ldap_searches_total)) { - st_ldap_searches_total = rrdset_create_localhost("ad" - , "ldap_searches" - , NULL - , "ldap" - , "ad.ldap_searches" - , "LDAP client search operations" - , "searches/s" - , PLUGIN_WINDOWS_NAME - , "PerflibAD" - , PRIO_AD_LDAP_SEARCHES_TOTAL - , update_every - , RRDSET_TYPE_LINE - ); - - rd_ldap_searches_total = rrddim_add(st_ldap_searches_total, - "searches", - NULL, - 1, - 1, - RRD_ALGORITHM_INCREMENTAL); + st_ldap_searches_total = rrdset_create_localhost( + "ad", + "ldap_searches", + NULL, + "ldap", + "ad.ldap_searches", + "LDAP client search operations", + "searches/s", + PLUGIN_WINDOWS_NAME, + "PerflibAD", + PRIO_AD_LDAP_SEARCHES_TOTAL, + update_every, + RRDSET_TYPE_LINE); + + rd_ldap_searches_total = + rrddim_add(st_ldap_searches_total, "searches", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); } - rrddim_set_by_pointer(st_ldap_searches_total, - rd_ldap_searches_total, - (collected_number)ldapSearchesTotal.current.Data); + rrddim_set_by_pointer( + st_ldap_searches_total, rd_ldap_searches_total, (collected_number)ldapSearchesTotal.current.Data); rrdset_done(st_ldap_searches_total); } } -static void netdata_ad_properties(PERF_DATA_BLOCK *pDataBlock, PERF_OBJECT_TYPE *pObjectType, int update_every) { - static COUNTER_DATA replicationInboundPropertiesUpdatedTotal = { .key = "DRA Inbound Properties Applied/sec" }; - static COUNTER_DATA replicationInboundPropertiesFilteredTotal = { .key = "DRA Inbound Properties Filtered/sec" }; +static void netdata_ad_properties(PERF_DATA_BLOCK *pDataBlock, PERF_OBJECT_TYPE *pObjectType, int update_every) +{ + static COUNTER_DATA replicationInboundPropertiesUpdatedTotal = {.key = "DRA Inbound Properties Applied/sec"}; + static COUNTER_DATA replicationInboundPropertiesFilteredTotal = {.key = "DRA Inbound Properties Filtered/sec"}; static RRDSET *st_dra_replication_properties_updated = NULL; static RRDDIM *rd_dra_replication_properties_updated = NULL; @@ -261,30 +228,28 @@ static void netdata_ad_properties(PERF_DATA_BLOCK *pDataBlock, PERF_OBJECT_TYPE } if (unlikely(!st_dra_replication_properties_updated)) { - st_dra_replication_properties_updated = rrdset_create_localhost("ad" - , "dra_replication_properties_updated" - , NULL - , "replication" - , "ad.dra_replication_properties_updated" - , "DRA replication properties updated" - , "properties/s" - , PLUGIN_WINDOWS_NAME - , "PerflibAD" - , PRIO_AD_REPLICATION_PROPERTY_UPDATED - , update_every - , RRDSET_TYPE_LINE); - - rd_dra_replication_properties_updated = rrddim_add(st_dra_replication_properties_updated, - "inbound", - NULL, - 1, - 1, - RRD_ALGORITHM_INCREMENTAL); + st_dra_replication_properties_updated = rrdset_create_localhost( + "ad", + "dra_replication_properties_updated", + NULL, + "replication", + "ad.dra_replication_properties_updated", + "DRA replication properties updated", + "properties/s", + PLUGIN_WINDOWS_NAME, + "PerflibAD", + PRIO_AD_REPLICATION_PROPERTY_UPDATED, + update_every, + RRDSET_TYPE_LINE); + + rd_dra_replication_properties_updated = + rrddim_add(st_dra_replication_properties_updated, "inbound", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); } - rrddim_set_by_pointer(st_dra_replication_properties_updated, - rd_dra_replication_properties_updated, - (collected_number)replicationInboundPropertiesUpdatedTotal.current.Data); + rrddim_set_by_pointer( + st_dra_replication_properties_updated, + rd_dra_replication_properties_updated, + (collected_number)replicationInboundPropertiesUpdatedTotal.current.Data); rrdset_done(st_dra_replication_properties_updated); totalPropertyChart: @@ -293,39 +258,42 @@ static void netdata_ad_properties(PERF_DATA_BLOCK *pDataBlock, PERF_OBJECT_TYPE } if (unlikely(!st_dra_replication_properties_filtered)) { - st_dra_replication_properties_filtered = rrdset_create_localhost("ad" - , "dra_replication_properties_filtered" - , NULL - , "replication" - , "ad.dra_replication_properties_filtered" - , "DRA replication properties filtered" - , "properties/s" - , PLUGIN_WINDOWS_NAME - , "PerflibAD" - , PRIO_AD_REPLICATION_PROPERTY_FILTERED - , update_every - , RRDSET_TYPE_LINE); - - rd_dra_replication_properties_filtered = rrddim_add(st_dra_replication_properties_filtered, - "inbound", - NULL, - 1, - 1, - RRD_ALGORITHM_INCREMENTAL); + st_dra_replication_properties_filtered = rrdset_create_localhost( + "ad", + "dra_replication_properties_filtered", + NULL, + "replication", + "ad.dra_replication_properties_filtered", + "DRA replication properties filtered", + "properties/s", + PLUGIN_WINDOWS_NAME, + "PerflibAD", + PRIO_AD_REPLICATION_PROPERTY_FILTERED, + update_every, + RRDSET_TYPE_LINE); + + rd_dra_replication_properties_filtered = + rrddim_add(st_dra_replication_properties_filtered, "inbound", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); } - rrddim_set_by_pointer(st_dra_replication_properties_filtered, - rd_dra_replication_properties_filtered, - (collected_number)replicationInboundPropertiesFilteredTotal.current.Data); + rrddim_set_by_pointer( + st_dra_replication_properties_filtered, + rd_dra_replication_properties_filtered, + (collected_number)replicationInboundPropertiesFilteredTotal.current.Data); rrdset_done(st_dra_replication_properties_filtered); } -static void netdata_ad_compressed_traffic(PERF_DATA_BLOCK *pDataBlock, PERF_OBJECT_TYPE *pObjectType, int update_every) { - static COUNTER_DATA replicationInboundDataInterSiteBytesTotal = { .key = "DRA Inbound Bytes Compressed (Between Sites, After Compression)/sec" }; - static COUNTER_DATA replicationOutboundDataInterSiteBytesTotal = { .key = "DRA Outbound Bytes Compressed (Between Sites, After Compression)/sec" }; +static void netdata_ad_compressed_traffic(PERF_DATA_BLOCK *pDataBlock, PERF_OBJECT_TYPE *pObjectType, int update_every) +{ + static COUNTER_DATA replicationInboundDataInterSiteBytesTotal = { + .key = "DRA Inbound Bytes Compressed (Between Sites, After Compression)/sec"}; + static COUNTER_DATA replicationOutboundDataInterSiteBytesTotal = { + .key = "DRA Outbound Bytes Compressed (Between Sites, After Compression)/sec"}; - static COUNTER_DATA replicationDataInboundIntraSiteBytesTotal = { .key = "DRA Outbound Bytes Compressed (Between Sites, After Compression)/sec"}; - static COUNTER_DATA replicationDataOutboundIntraSiteBytesTotal = { .key = "DRA Outbound Bytes Not Compressed (Within Site)/sec"}; + static COUNTER_DATA replicationDataInboundIntraSiteBytesTotal = { + .key = "DRA Outbound Bytes Compressed (Between Sites, After Compression)/sec"}; + static COUNTER_DATA replicationDataOutboundIntraSiteBytesTotal = { + .key = "DRA Outbound Bytes Not Compressed (Within Site)/sec"}; static RRDSET *st_dra_replication_intersite_compressed_traffic = NULL; static RRDDIM *rd_replication_data_intersite_bytes_total_inbound = NULL; @@ -341,40 +309,35 @@ static void netdata_ad_compressed_traffic(PERF_DATA_BLOCK *pDataBlock, PERF_OBJE } if (unlikely(!st_dra_replication_intersite_compressed_traffic)) { - st_dra_replication_intersite_compressed_traffic = rrdset_create_localhost("ad" - , "dra_replication_intersite_compressed_traffic" - , NULL - , "replication" - , "ad.dra_replication_intersite_compressed_traffic" - , "DRA replication compressed traffic withing site" - , "bytes/s" - , PLUGIN_WINDOWS_NAME - , "PerflibAD" - , PRIO_AD_REPLICATION_INTERSITE_COMPRESSED - , update_every - , RRDSET_TYPE_AREA); - - rd_replication_data_intersite_bytes_total_inbound = rrddim_add(st_dra_replication_intersite_compressed_traffic, - "inbound", - NULL, - 1, - 1, - RRD_ALGORITHM_INCREMENTAL); - - rd_replication_data_intersite_bytes_total_outbound = rrddim_add(st_dra_replication_intersite_compressed_traffic, - "outbound", - NULL, - -1, - 1, - RRD_ALGORITHM_INCREMENTAL); + st_dra_replication_intersite_compressed_traffic = rrdset_create_localhost( + "ad", + "dra_replication_intersite_compressed_traffic", + NULL, + "replication", + "ad.dra_replication_intersite_compressed_traffic", + "DRA replication compressed traffic withing site", + "bytes/s", + PLUGIN_WINDOWS_NAME, + "PerflibAD", + PRIO_AD_REPLICATION_INTERSITE_COMPRESSED, + update_every, + RRDSET_TYPE_AREA); + + rd_replication_data_intersite_bytes_total_inbound = rrddim_add( + st_dra_replication_intersite_compressed_traffic, "inbound", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); + + rd_replication_data_intersite_bytes_total_outbound = rrddim_add( + st_dra_replication_intersite_compressed_traffic, "outbound", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL); } - rrddim_set_by_pointer(st_dra_replication_intersite_compressed_traffic, - rd_replication_data_intersite_bytes_total_inbound, - (collected_number)replicationInboundDataInterSiteBytesTotal.current.Data); - rrddim_set_by_pointer(st_dra_replication_intersite_compressed_traffic, - rd_replication_data_intersite_bytes_total_outbound, - (collected_number)replicationOutboundDataInterSiteBytesTotal.current.Data); + rrddim_set_by_pointer( + st_dra_replication_intersite_compressed_traffic, + rd_replication_data_intersite_bytes_total_inbound, + (collected_number)replicationInboundDataInterSiteBytesTotal.current.Data); + rrddim_set_by_pointer( + st_dra_replication_intersite_compressed_traffic, + rd_replication_data_intersite_bytes_total_outbound, + (collected_number)replicationOutboundDataInterSiteBytesTotal.current.Data); rrdset_done(st_dra_replication_intersite_compressed_traffic); intraChart: @@ -384,47 +347,43 @@ static void netdata_ad_compressed_traffic(PERF_DATA_BLOCK *pDataBlock, PERF_OBJE } if (unlikely(!st_dra_replication_intrasite_compressed_traffic)) { - st_dra_replication_intrasite_compressed_traffic = rrdset_create_localhost("ad" - , "dra_replication_intrasite_compressed_traffic" - , NULL - , "replication" - , "ad.dra_replication_intrasite_compressed_traffic" - , "DRA replication compressed traffic between sites" - , "bytes/s" - , PLUGIN_WINDOWS_NAME - , "PerflibAD" - , PRIO_AD_REPLICATION_INTRASITE_COMPRESSED - , update_every - , RRDSET_TYPE_LINE); - - rd_replication_data_intrasite_bytes_total_inbound = rrddim_add(st_dra_replication_intrasite_compressed_traffic, - "inbound", - NULL, - 1, - 1, - RRD_ALGORITHM_INCREMENTAL); - - rd_replication_data_intrasite_bytes_total_outbound = rrddim_add(st_dra_replication_intrasite_compressed_traffic, - "outbound", - NULL, - -1, - 1, - RRD_ALGORITHM_INCREMENTAL); + st_dra_replication_intrasite_compressed_traffic = rrdset_create_localhost( + "ad", + "dra_replication_intrasite_compressed_traffic", + NULL, + "replication", + "ad.dra_replication_intrasite_compressed_traffic", + "DRA replication compressed traffic between sites", + "bytes/s", + PLUGIN_WINDOWS_NAME, + "PerflibAD", + PRIO_AD_REPLICATION_INTRASITE_COMPRESSED, + update_every, + RRDSET_TYPE_LINE); + + rd_replication_data_intrasite_bytes_total_inbound = rrddim_add( + st_dra_replication_intrasite_compressed_traffic, "inbound", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); + + rd_replication_data_intrasite_bytes_total_outbound = rrddim_add( + st_dra_replication_intrasite_compressed_traffic, "outbound", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL); } - rrddim_set_by_pointer(st_dra_replication_intrasite_compressed_traffic, - rd_replication_data_intrasite_bytes_total_inbound, - (collected_number)replicationDataInboundIntraSiteBytesTotal.current.Data); - rrddim_set_by_pointer(st_dra_replication_intrasite_compressed_traffic, - rd_replication_data_intrasite_bytes_total_outbound, - (collected_number)replicationDataOutboundIntraSiteBytesTotal.current.Data); + rrddim_set_by_pointer( + st_dra_replication_intrasite_compressed_traffic, + rd_replication_data_intrasite_bytes_total_inbound, + (collected_number)replicationDataInboundIntraSiteBytesTotal.current.Data); + rrddim_set_by_pointer( + st_dra_replication_intrasite_compressed_traffic, + rd_replication_data_intrasite_bytes_total_outbound, + (collected_number)replicationDataOutboundIntraSiteBytesTotal.current.Data); rrdset_done(st_dra_replication_intrasite_compressed_traffic); } -static void netdata_ad_sync(PERF_DATA_BLOCK *pDataBlock, PERF_OBJECT_TYPE *pObjectType, int update_every) { - static COUNTER_DATA replicationSyncPending = { .key = "DRA Pending Replication Synchronizations" }; - static COUNTER_DATA replicationSyncRequestsTotal = { .key = "DRA Sync Requests Made" }; - static COUNTER_DATA replicationPendingSyncs = { .key = "DRA Pending Replication Synchronizations" }; +static void netdata_ad_sync(PERF_DATA_BLOCK *pDataBlock, PERF_OBJECT_TYPE *pObjectType, int update_every) +{ + static COUNTER_DATA replicationSyncPending = {.key = "DRA Pending Replication Synchronizations"}; + static COUNTER_DATA replicationSyncRequestsTotal = {.key = "DRA Sync Requests Made"}; + static COUNTER_DATA replicationPendingSyncs = {.key = "DRA Pending Replication Synchronizations"}; static RRDSET *st_dra_replication_pending_syncs = NULL; static RRDDIM *rd_dra_replication_pending_syncs = NULL; @@ -438,30 +397,28 @@ static void netdata_ad_sync(PERF_DATA_BLOCK *pDataBlock, PERF_OBJECT_TYPE *pObje } if (unlikely(!st_dra_replication_pending_syncs)) { - st_dra_replication_pending_syncs = rrdset_create_localhost("ad" - , "dra_replication_pending_syncs" - , NULL - , "replication" - , "ad.dra_replication_pending_syncs" - , "DRA replication pending syncs" - , "syncs" - , PLUGIN_WINDOWS_NAME - , "PerflibAD" - , PRIO_AD_SYNC_PENDING - , update_every - , RRDSET_TYPE_LINE); - - rd_dra_replication_pending_syncs = rrddim_add(st_dra_replication_pending_syncs, - "pending", - NULL, - 1, - 1, - RRD_ALGORITHM_ABSOLUTE); + st_dra_replication_pending_syncs = rrdset_create_localhost( + "ad", + "dra_replication_pending_syncs", + NULL, + "replication", + "ad.dra_replication_pending_syncs", + "DRA replication pending syncs", + "syncs", + PLUGIN_WINDOWS_NAME, + "PerflibAD", + PRIO_AD_SYNC_PENDING, + update_every, + RRDSET_TYPE_LINE); + + rd_dra_replication_pending_syncs = + rrddim_add(st_dra_replication_pending_syncs, "pending", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); } - rrddim_set_by_pointer(st_dra_replication_pending_syncs, - rd_dra_replication_pending_syncs, - (collected_number)replicationSyncPending.current.Data); + rrddim_set_by_pointer( + st_dra_replication_pending_syncs, + rd_dra_replication_pending_syncs, + (collected_number)replicationSyncPending.current.Data); rrdset_done(st_dra_replication_pending_syncs); totalSyncChart: @@ -470,30 +427,28 @@ static void netdata_ad_sync(PERF_DATA_BLOCK *pDataBlock, PERF_OBJECT_TYPE *pObje } if (unlikely(!st_dra_replication_sync_requests)) { - st_dra_replication_sync_requests = rrdset_create_localhost("ad" - , "dra_replication_sync_requests" - , NULL - , "replication" - , "ad.dra_replication_sync_requests" - , "DRA replication sync requests" - , "requests/s" - , PLUGIN_WINDOWS_NAME - , "PerflibAD" - , PRIO_AD_SYNC_TOTAL - , update_every - , RRDSET_TYPE_LINE); - - rd_dra_replication_sync_requests = rrddim_add(st_dra_replication_sync_requests, - "request", - NULL, - 1, - 1, - RRD_ALGORITHM_INCREMENTAL); + st_dra_replication_sync_requests = rrdset_create_localhost( + "ad", + "dra_replication_sync_requests", + NULL, + "replication", + "ad.dra_replication_sync_requests", + "DRA replication sync requests", + "requests/s", + PLUGIN_WINDOWS_NAME, + "PerflibAD", + PRIO_AD_SYNC_TOTAL, + update_every, + RRDSET_TYPE_LINE); + + rd_dra_replication_sync_requests = + rrddim_add(st_dra_replication_sync_requests, "request", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); } - rrddim_set_by_pointer(st_dra_replication_sync_requests, - rd_dra_replication_sync_requests, - (collected_number)replicationSyncRequestsTotal.current.Data); + rrddim_set_by_pointer( + st_dra_replication_sync_requests, + rd_dra_replication_sync_requests, + (collected_number)replicationSyncRequestsTotal.current.Data); rrdset_done(st_dra_replication_sync_requests); RemainingSyncChart: @@ -502,141 +457,131 @@ static void netdata_ad_sync(PERF_DATA_BLOCK *pDataBlock, PERF_OBJECT_TYPE *pObje } if (unlikely(!st_dra_replication_sync_objects_remaining)) { - st_dra_replication_sync_objects_remaining = rrdset_create_localhost("ad" - , "dra_replication_sync_objects_remaining" - , NULL - , "replication" - , "ad.dra_replication_sync_objects_remaining" - , "DRA replication full sync objects remaining" - , "objects" - , PLUGIN_WINDOWS_NAME - , "PerflibAD" - , PRIO_AD_SYNC_OBJECTS_REMAINING - , update_every - , RRDSET_TYPE_LINE); - - rd_dra_replication_sync_objects_remaining = rrddim_add(st_dra_replication_sync_objects_remaining, - "request", - NULL, - 1, - 1, - RRD_ALGORITHM_INCREMENTAL); + st_dra_replication_sync_objects_remaining = rrdset_create_localhost( + "ad", + "dra_replication_sync_objects_remaining", + NULL, + "replication", + "ad.dra_replication_sync_objects_remaining", + "DRA replication full sync objects remaining", + "objects", + PLUGIN_WINDOWS_NAME, + "PerflibAD", + PRIO_AD_SYNC_OBJECTS_REMAINING, + update_every, + RRDSET_TYPE_LINE); + + rd_dra_replication_sync_objects_remaining = + rrddim_add(st_dra_replication_sync_objects_remaining, "request", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); } - rrddim_set_by_pointer(st_dra_replication_sync_objects_remaining, - rd_dra_replication_sync_objects_remaining, - (collected_number)replicationPendingSyncs.current.Data); + rrddim_set_by_pointer( + st_dra_replication_sync_objects_remaining, + rd_dra_replication_sync_objects_remaining, + (collected_number)replicationPendingSyncs.current.Data); rrdset_done(st_dra_replication_sync_objects_remaining); } -static void netdata_ad_service_threads_in_use(PERF_DATA_BLOCK *pDataBlock, PERF_OBJECT_TYPE *pObjectType, int update_every) { - static COUNTER_DATA directoryServiceThreads = { .key = "DS Threads in Use" }; +static void +netdata_ad_service_threads_in_use(PERF_DATA_BLOCK *pDataBlock, PERF_OBJECT_TYPE *pObjectType, int update_every) +{ + static COUNTER_DATA directoryServiceThreads = {.key = "DS Threads in Use"}; static RRDSET *st_directory_services_threads = NULL; static RRDDIM *rd_directory_services_threads = NULL; - if(perflibGetObjectCounter(pDataBlock, pObjectType, &directoryServiceThreads)) { + if (perflibGetObjectCounter(pDataBlock, pObjectType, &directoryServiceThreads)) { if (unlikely(!st_directory_services_threads)) { - st_directory_services_threads = rrdset_create_localhost("ad" - , "ds_threads" - , NULL - , "threads" - , "ad.ds_threads" - , "Directory Service threads" - , "threads" - , PLUGIN_WINDOWS_NAME - , "PerflibAD" - , PRIO_AD_THREADS_IN_USE - , update_every - , RRDSET_TYPE_LINE - ); - - rd_directory_services_threads = rrddim_add(st_directory_services_threads, - "in_use", - NULL, - 1, - 1, - RRD_ALGORITHM_ABSOLUTE); + st_directory_services_threads = rrdset_create_localhost( + "ad", + "ds_threads", + NULL, + "threads", + "ad.ds_threads", + "Directory Service threads", + "threads", + PLUGIN_WINDOWS_NAME, + "PerflibAD", + PRIO_AD_THREADS_IN_USE, + update_every, + RRDSET_TYPE_LINE); + + rd_directory_services_threads = + rrddim_add(st_directory_services_threads, "in_use", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); } - rrddim_set_by_pointer(st_directory_services_threads, - rd_directory_services_threads, - (collected_number)directoryServiceThreads.current.Data); + rrddim_set_by_pointer( + st_directory_services_threads, + rd_directory_services_threads, + (collected_number)directoryServiceThreads.current.Data); rrdset_done(st_directory_services_threads); } } -static void netdata_ad_bind(PERF_DATA_BLOCK *pDataBlock, PERF_OBJECT_TYPE *pObjectType, int update_every) { - static COUNTER_DATA ldapLastBindTimeSecondsTotal = { .key = "DAP Bind Time" }; - static COUNTER_DATA bindsTotal = { .key = "DS Server Binds/sec" }; +static void netdata_ad_bind(PERF_DATA_BLOCK *pDataBlock, PERF_OBJECT_TYPE *pObjectType, int update_every) +{ + static COUNTER_DATA ldapLastBindTimeSecondsTotal = {.key = "DAP Bind Time"}; + static COUNTER_DATA bindsTotal = {.key = "DS Server Binds/sec"}; static RRDSET *st_ldap_last_bind_time_seconds_total = NULL; static RRDDIM *rd_ldap_last_bind_time_seconds_total = NULL; static RRDSET *st_binds_total = NULL; static RRDDIM *rd_binds_total = NULL; - if(perflibGetObjectCounter(pDataBlock, pObjectType, &ldapLastBindTimeSecondsTotal)) { + if (perflibGetObjectCounter(pDataBlock, pObjectType, &ldapLastBindTimeSecondsTotal)) { if (unlikely(!st_ldap_last_bind_time_seconds_total)) { - st_ldap_last_bind_time_seconds_total = rrdset_create_localhost("ad" - , "ldap_last_bind_time" - , NULL - , "bind" - , "ad.ldap_last_bind_time" - , "LDAP last successful bind time" - , "seconds" - , PLUGIN_WINDOWS_NAME - , "PerflibAD" - , PRIO_AD_BIND_TIME - , update_every - , RRDSET_TYPE_LINE - ); - - rd_ldap_last_bind_time_seconds_total = rrddim_add(st_ldap_last_bind_time_seconds_total, - "last_bind", - NULL, - 1, - 1, - RRD_ALGORITHM_ABSOLUTE); + st_ldap_last_bind_time_seconds_total = rrdset_create_localhost( + "ad", + "ldap_last_bind_time", + NULL, + "bind", + "ad.ldap_last_bind_time", + "LDAP last successful bind time", + "seconds", + PLUGIN_WINDOWS_NAME, + "PerflibAD", + PRIO_AD_BIND_TIME, + update_every, + RRDSET_TYPE_LINE); + + rd_ldap_last_bind_time_seconds_total = + rrddim_add(st_ldap_last_bind_time_seconds_total, "last_bind", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); } - rrddim_set_by_pointer(st_ldap_last_bind_time_seconds_total, - rd_ldap_last_bind_time_seconds_total, - (collected_number)ldapLastBindTimeSecondsTotal.current.Data); + rrddim_set_by_pointer( + st_ldap_last_bind_time_seconds_total, + rd_ldap_last_bind_time_seconds_total, + (collected_number)ldapLastBindTimeSecondsTotal.current.Data); rrdset_done(st_ldap_last_bind_time_seconds_total); } - if(perflibGetObjectCounter(pDataBlock, pObjectType, &bindsTotal)) { + if (perflibGetObjectCounter(pDataBlock, pObjectType, &bindsTotal)) { if (unlikely(!st_binds_total)) { - st_binds_total = rrdset_create_localhost("ad" - , "binds" - , NULL - , "bind" - , "ad.binds" - , "Successful binds" - , "bind/s" - , PLUGIN_WINDOWS_NAME - , "PerflibAD" - , PRIO_AD_BIND_TOTAL - , update_every - , RRDSET_TYPE_LINE); - - rd_binds_total = rrddim_add(st_binds_total, - "binds", - NULL, - 1, - 1, - RRD_ALGORITHM_INCREMENTAL); + st_binds_total = rrdset_create_localhost( + "ad", + "binds", + NULL, + "bind", + "ad.binds", + "Successful binds", + "bind/s", + PLUGIN_WINDOWS_NAME, + "PerflibAD", + PRIO_AD_BIND_TOTAL, + update_every, + RRDSET_TYPE_LINE); + + rd_binds_total = rrddim_add(st_binds_total, "binds", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); } - rrddim_set_by_pointer(st_binds_total, - rd_binds_total, - (collected_number)bindsTotal.current.Data); + rrddim_set_by_pointer(st_binds_total, rd_binds_total, (collected_number)bindsTotal.current.Data); rrdset_done(st_binds_total); } } -static void netdata_ad_atq(PERF_DATA_BLOCK *pDataBlock, PERF_OBJECT_TYPE *pObjectType, int update_every) { - static COUNTER_DATA atqAverageRequestLatency = { .key = "ATQ Request Latency" }; +static void netdata_ad_atq(PERF_DATA_BLOCK *pDataBlock, PERF_OBJECT_TYPE *pObjectType, int update_every) +{ + static COUNTER_DATA atqAverageRequestLatency = {.key = "ATQ Request Latency"}; //static COUNTER_DATA atqOutstandingRequests = { .key = "ATQ Outstanding Queued Requests" }; static RRDSET *st_atq_average_request_latency = NULL; @@ -646,33 +591,30 @@ static void netdata_ad_atq(PERF_DATA_BLOCK *pDataBlock, PERF_OBJECT_TYPE *pObjec static RRDDIM *rd_atq_outstanding_requests = NULL; */ - if(perflibGetObjectCounter(pDataBlock, pObjectType, &atqAverageRequestLatency)) { + if (perflibGetObjectCounter(pDataBlock, pObjectType, &atqAverageRequestLatency)) { if (unlikely(!st_atq_average_request_latency)) { - st_atq_average_request_latency = rrdset_create_localhost("ad" - , "atq_average_request_latency" - , NULL - , "queue" - , "ad.atq_average_request_latency" - , "Average request processing time" - , "seconds" - , PLUGIN_WINDOWS_NAME - , "PerflibAD" - , PRIO_AD_AVG_REQUEST_LATENCY - , update_every - , RRDSET_TYPE_LINE - ); - - rd_atq_average_request_latency = rrddim_add(st_atq_average_request_latency, - "time", - NULL, - 1, - 1000, - RRD_ALGORITHM_ABSOLUTE); + st_atq_average_request_latency = rrdset_create_localhost( + "ad", + "atq_average_request_latency", + NULL, + "queue", + "ad.atq_average_request_latency", + "Average request processing time", + "seconds", + PLUGIN_WINDOWS_NAME, + "PerflibAD", + PRIO_AD_AVG_REQUEST_LATENCY, + update_every, + RRDSET_TYPE_LINE); + + rd_atq_average_request_latency = + rrddim_add(st_atq_average_request_latency, "time", NULL, 1, 1000, RRD_ALGORITHM_ABSOLUTE); } - rrddim_set_by_pointer(st_atq_average_request_latency, - rd_atq_average_request_latency, - (collected_number)atqAverageRequestLatency.current.Data); + rrddim_set_by_pointer( + st_atq_average_request_latency, + rd_atq_average_request_latency, + (collected_number)atqAverageRequestLatency.current.Data); rrdset_done(st_atq_average_request_latency); } @@ -707,11 +649,12 @@ static void netdata_ad_atq(PERF_DATA_BLOCK *pDataBlock, PERF_OBJECT_TYPE *pObjec } */ } -static void netdata_ad_op_total(PERF_DATA_BLOCK *pDataBlock, PERF_OBJECT_TYPE *pObjectType, int update_every) { - static COUNTER_DATA databaseAddsPerSec = { .key = "Database adds/sec" }; - static COUNTER_DATA databaseDeletesPerSec = { .key = "Database deletes/sec" }; - static COUNTER_DATA databaseModifiesPerSec = { .key = "Database modifys/sec" }; - static COUNTER_DATA databaseRecyclesPerSec = { .key = "Database recycles/sec" }; +static void netdata_ad_op_total(PERF_DATA_BLOCK *pDataBlock, PERF_OBJECT_TYPE *pObjectType, int update_every) +{ + static COUNTER_DATA databaseAddsPerSec = {.key = "Database adds/sec"}; + static COUNTER_DATA databaseDeletesPerSec = {.key = "Database deletes/sec"}; + static COUNTER_DATA databaseModifiesPerSec = {.key = "Database modifys/sec"}; + static COUNTER_DATA databaseRecyclesPerSec = {.key = "Database recycles/sec"}; static RRDSET *st_database_operation_total = NULL; static RRDDIM *rd_database_operation_total_add = NULL; @@ -725,69 +668,58 @@ static void netdata_ad_op_total(PERF_DATA_BLOCK *pDataBlock, PERF_OBJECT_TYPE *p perflibGetObjectCounter(pDataBlock, pObjectType, &databaseRecyclesPerSec); if (unlikely(!st_database_operation_total)) { - st_database_operation_total = rrdset_create_localhost("ad" - , "database_operations" - , NULL - , "database" - , "ad.database_operations" - , "AD database operations" - , "operations/s" - , PLUGIN_WINDOWS_NAME - , "PerflibAD" - , PRIO_AD_OPERATIONS_TOTAL - , update_every - , RRDSET_TYPE_LINE); - - rd_database_operation_total_add = rrddim_add(st_database_operation_total, - "add", - NULL, - 1, - 1, - RRD_ALGORITHM_INCREMENTAL); - - rd_database_operation_total_delete = rrddim_add(st_database_operation_total, - "delete", - NULL, - 1, - 1, - RRD_ALGORITHM_INCREMENTAL); - - rd_database_operation_total_modify = rrddim_add(st_database_operation_total, - "modify", - NULL, - 1, - 1, - RRD_ALGORITHM_INCREMENTAL); - - rd_database_operation_total_recycle = rrddim_add(st_database_operation_total, - "recycle", - NULL, - 1, - 1, - RRD_ALGORITHM_INCREMENTAL); + st_database_operation_total = rrdset_create_localhost( + "ad", + "database_operations", + NULL, + "database", + "ad.database_operations", + "AD database operations", + "operations/s", + PLUGIN_WINDOWS_NAME, + "PerflibAD", + PRIO_AD_OPERATIONS_TOTAL, + update_every, + RRDSET_TYPE_LINE); + + rd_database_operation_total_add = + rrddim_add(st_database_operation_total, "add", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); + + rd_database_operation_total_delete = + rrddim_add(st_database_operation_total, "delete", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); + + rd_database_operation_total_modify = + rrddim_add(st_database_operation_total, "modify", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); + + rd_database_operation_total_recycle = + rrddim_add(st_database_operation_total, "recycle", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); } - rrddim_set_by_pointer(st_database_operation_total, - rd_database_operation_total_add, - (collected_number)databaseAddsPerSec.current.Data); + rrddim_set_by_pointer( + st_database_operation_total, + rd_database_operation_total_add, + (collected_number)databaseAddsPerSec.current.Data); - rrddim_set_by_pointer(st_database_operation_total, - rd_database_operation_total_delete, - (collected_number)databaseDeletesPerSec.current.Data); + rrddim_set_by_pointer( + st_database_operation_total, + rd_database_operation_total_delete, + (collected_number)databaseDeletesPerSec.current.Data); - rrddim_set_by_pointer(st_database_operation_total, - rd_database_operation_total_modify, - (collected_number)databaseModifiesPerSec.current.Data); + rrddim_set_by_pointer( + st_database_operation_total, + rd_database_operation_total_modify, + (collected_number)databaseModifiesPerSec.current.Data); - rrddim_set_by_pointer(st_database_operation_total, - rd_database_operation_total_recycle, - (collected_number)databaseRecyclesPerSec.current.Data); + rrddim_set_by_pointer( + st_database_operation_total, + rd_database_operation_total_recycle, + (collected_number)databaseRecyclesPerSec.current.Data); rrdset_done(st_database_operation_total); - } -static bool do_AD(PERF_DATA_BLOCK *pDataBlock, int update_every) { +static bool do_AD(PERF_DATA_BLOCK *pDataBlock, int update_every) +{ PERF_OBJECT_TYPE *pObjectType = perflibFindObjectTypeByName(pDataBlock, "DirectoryServices"); if (!pObjectType) return false; @@ -806,8 +738,7 @@ static bool do_AD(PERF_DATA_BLOCK *pDataBlock, int update_every) { netdata_ad_op_total, // This must be the end - NULL - }; + NULL}; for (int i = 0; doAD[i]; i++) doAD[i](pDataBlock, pObjectType, update_every); @@ -815,20 +746,22 @@ static bool do_AD(PERF_DATA_BLOCK *pDataBlock, int update_every) { return true; } -int do_PerflibAD(int update_every, usec_t dt __maybe_unused) { +int do_PerflibAD(int update_every, usec_t dt __maybe_unused) +{ static bool initialized = false; - if(unlikely(!initialized)) { + if (unlikely(!initialized)) { initialize(); initialized = true; } DWORD id = RegistryFindIDByName("DirectoryServices"); - if(id == PERFLIB_REGISTRY_NAME_NOT_FOUND) + if (id == PERFLIB_REGISTRY_NAME_NOT_FOUND) return -1; PERF_DATA_BLOCK *pDataBlock = perflibGetPerformanceData(id); - if(!pDataBlock) return -1; + if (!pDataBlock) + return -1; do_AD(pDataBlock, update_every); diff --git a/src/collectors/windows.plugin/perflib-netframework.c b/src/collectors/windows.plugin/perflib-netframework.c index 1b42dc03915fd0..3be62c9db2a6fc 100644 --- a/src/collectors/windows.plugin/perflib-netframework.c +++ b/src/collectors/windows.plugin/perflib-netframework.c @@ -154,7 +154,8 @@ struct net_framework_instances { COUNTER_DATA NETFrameworkCLRLocksAndThreadsContentions; }; -static inline void initialize_net_framework_processes_keys(struct net_framework_instances *p) { +static inline void initialize_net_framework_processes_keys(struct net_framework_instances *p) +{ p->NETFrameworkCLRExceptionFilters.key = "# of Filters / sec"; p->NETFrameworkCLRExceptionFinallys.key = "# of Finallys / sec"; p->NETFrameworkCLRExceptionThrown.key = "# of Exceps Thrown / sec"; @@ -200,21 +201,25 @@ static inline void initialize_net_framework_processes_keys(struct net_framework_ void dict_net_framework_processes_insert_cb( const DICTIONARY_ITEM *item __maybe_unused, void *value, - void *data __maybe_unused) { + void *data __maybe_unused) +{ struct net_framework_instances *p = value; initialize_net_framework_processes_keys(p); } static DICTIONARY *processes = NULL; -static void initialize(void) { +static void initialize(void) +{ processes = dictionary_create_advanced( DICT_OPTION_DONT_OVERWRITE_VALUE | DICT_OPTION_FIXED_SIZE, NULL, sizeof(struct net_framework_instances)); dictionary_register_insert_callback(processes, dict_net_framework_processes_insert_cb, NULL); } -static void netdata_framework_clr_exceptions(PERF_DATA_BLOCK *pDataBlock, PERF_OBJECT_TYPE *pObjectType, int update_every) { +static void +netdata_framework_clr_exceptions(PERF_DATA_BLOCK *pDataBlock, PERF_OBJECT_TYPE *pObjectType, int update_every) +{ PERF_INSTANCE_DEFINITION *pi = NULL; char id[RRD_ID_LENGTH_MAX + 1]; for (LONG i = 0; i < pObjectType->NumInstances; i++) { @@ -363,7 +368,8 @@ static void netdata_framework_clr_exceptions(PERF_DATA_BLOCK *pDataBlock, PERF_O } } -static void netdata_framework_clr_interop(PERF_DATA_BLOCK *pDataBlock, PERF_OBJECT_TYPE *pObjectType, int update_every) { +static void netdata_framework_clr_interop(PERF_DATA_BLOCK *pDataBlock, PERF_OBJECT_TYPE *pObjectType, int update_every) +{ PERF_INSTANCE_DEFINITION *pi = NULL; char id[RRD_ID_LENGTH_MAX + 1]; for (LONG i = 0; i < pObjectType->NumInstances; i++) { @@ -488,7 +494,8 @@ static void netdata_framework_clr_interop(PERF_DATA_BLOCK *pDataBlock, PERF_OBJE } } -static void netdata_framework_clr_jit(PERF_DATA_BLOCK *pDataBlock, PERF_OBJECT_TYPE *pObjectType, int update_every) { +static void netdata_framework_clr_jit(PERF_DATA_BLOCK *pDataBlock, PERF_OBJECT_TYPE *pObjectType, int update_every) +{ PERF_INSTANCE_DEFINITION *pi = NULL; char id[RRD_ID_LENGTH_MAX + 1]; for (LONG i = 0; i < pObjectType->NumInstances; i++) { @@ -631,7 +638,8 @@ static void netdata_framework_clr_jit(PERF_DATA_BLOCK *pDataBlock, PERF_OBJECT_T } } -static void netdata_framework_clr_loading(PERF_DATA_BLOCK *pDataBlock, PERF_OBJECT_TYPE *pObjectType, int update_every) { +static void netdata_framework_clr_loading(PERF_DATA_BLOCK *pDataBlock, PERF_OBJECT_TYPE *pObjectType, int update_every) +{ char id[RRD_ID_LENGTH_MAX + 1]; PERF_INSTANCE_DEFINITION *pi = NULL; for (LONG i = 0; i < pObjectType->NumInstances; i++) { @@ -844,9 +852,7 @@ static void netdata_framework_clr_loading(PERF_DATA_BLOCK *pDataBlock, PERF_OBJE } } -static void netdata_framework_clr_remoting(PERF_DATA_BLOCK *pDataBlock, - PERF_OBJECT_TYPE *pObjectType, - int update_every) +static void netdata_framework_clr_remoting(PERF_DATA_BLOCK *pDataBlock, PERF_OBJECT_TYPE *pObjectType, int update_every) { char id[RRD_ID_LENGTH_MAX + 1]; PERF_INSTANCE_DEFINITION *pi = NULL; @@ -867,223 +873,213 @@ static void netdata_framework_clr_remoting(PERF_DATA_BLOCK *pDataBlock, if (perflibGetObjectCounter(pDataBlock, pObjectType, &p->NETFrameworkCLRRemotingChannels)) { if (!p->st_clrremoting_channels) { snprintfz(id, RRD_ID_LENGTH_MAX, "%s_clrremoting_channels", windows_shared_buffer); - p->st_clrremoting_channels = rrdset_create_localhost("netframework" - , id, NULL - , "remoting" - , "netframework.clrremoting_channels" - , "Registered channels" - , "channels/s" - , PLUGIN_WINDOWS_NAME - , "PerflibNetFramework" - , PRIO_NETFRAMEWORK_CLR_REMOTING_CHANNELS - , update_every - , RRDSET_TYPE_LINE - ); + p->st_clrremoting_channels = rrdset_create_localhost( + "netframework", + id, + NULL, + "remoting", + "netframework.clrremoting_channels", + "Registered channels", + "channels/s", + PLUGIN_WINDOWS_NAME, + "PerflibNetFramework", + PRIO_NETFRAMEWORK_CLR_REMOTING_CHANNELS, + update_every, + RRDSET_TYPE_LINE); snprintfz(id, RRD_ID_LENGTH_MAX, "netframework_%s_clrremoting_channels_total", windows_shared_buffer); - p->rd_clrremoting_channels = rrddim_add(p->st_clrremoting_channels, - id, - "registered", - 1, - 1, - RRD_ALGORITHM_INCREMENTAL); - - rrdlabels_add(p->st_clrremoting_channels->rrdlabels, - "process", - windows_shared_buffer, - RRDLABEL_SRC_AUTO); + p->rd_clrremoting_channels = + rrddim_add(p->st_clrremoting_channels, id, "registered", 1, 1, RRD_ALGORITHM_INCREMENTAL); + + rrdlabels_add( + p->st_clrremoting_channels->rrdlabels, "process", windows_shared_buffer, RRDLABEL_SRC_AUTO); } - rrddim_set_by_pointer(p->st_clrremoting_channels, - p->rd_clrremoting_channels, - (collected_number)p->NETFrameworkCLRRemotingChannels.current.Data); + rrddim_set_by_pointer( + p->st_clrremoting_channels, + p->rd_clrremoting_channels, + (collected_number)p->NETFrameworkCLRRemotingChannels.current.Data); rrdset_done(p->st_clrremoting_channels); } if (perflibGetObjectCounter(pDataBlock, pObjectType, &p->NETFrameworkCLRRemotingContextBoundClassesLoaded)) { if (!p->st_clrremoting_context_bound_classes_loaded) { snprintfz(id, RRD_ID_LENGTH_MAX, "%s_clrremoting_context_bound_classes_loaded", windows_shared_buffer); - p->st_clrremoting_context_bound_classes_loaded = rrdset_create_localhost("netframework" - , id, NULL - , "remoting" - , "netframework.clrremoting_context_bound_classes_loaded" - , "Loaded context-bound classes" - , "classes" - , PLUGIN_WINDOWS_NAME - , "PerflibNetFramework" - , PRIO_NETFRAMEWORK_CLR_REMOTING_CONTEXT_BOUND_CLASSES_LOADED - , update_every - , RRDSET_TYPE_LINE - ); - - snprintfz(id, RRD_ID_LENGTH_MAX, "netframework_%s_clrremoting_context_bound_classes_loaded", windows_shared_buffer); - p->rd_clrremoting_context_bound_classes_loaded = rrddim_add(p->st_clrremoting_context_bound_classes_loaded, - id, - "loaded", - 1, - 1, - RRD_ALGORITHM_ABSOLUTE); - - rrdlabels_add(p->st_clrremoting_context_bound_classes_loaded->rrdlabels, - "process", - windows_shared_buffer, - RRDLABEL_SRC_AUTO); + p->st_clrremoting_context_bound_classes_loaded = rrdset_create_localhost( + "netframework", + id, + NULL, + "remoting", + "netframework.clrremoting_context_bound_classes_loaded", + "Loaded context-bound classes", + "classes", + PLUGIN_WINDOWS_NAME, + "PerflibNetFramework", + PRIO_NETFRAMEWORK_CLR_REMOTING_CONTEXT_BOUND_CLASSES_LOADED, + update_every, + RRDSET_TYPE_LINE); + + snprintfz( + id, + RRD_ID_LENGTH_MAX, + "netframework_%s_clrremoting_context_bound_classes_loaded", + windows_shared_buffer); + p->rd_clrremoting_context_bound_classes_loaded = rrddim_add( + p->st_clrremoting_context_bound_classes_loaded, id, "loaded", 1, 1, RRD_ALGORITHM_ABSOLUTE); + + rrdlabels_add( + p->st_clrremoting_context_bound_classes_loaded->rrdlabels, + "process", + windows_shared_buffer, + RRDLABEL_SRC_AUTO); } - rrddim_set_by_pointer(p->st_clrremoting_context_bound_classes_loaded, - p->rd_clrremoting_context_bound_classes_loaded, - (collected_number)p->NETFrameworkCLRRemotingContextBoundClassesLoaded.current.Data); + rrddim_set_by_pointer( + p->st_clrremoting_context_bound_classes_loaded, + p->rd_clrremoting_context_bound_classes_loaded, + (collected_number)p->NETFrameworkCLRRemotingContextBoundClassesLoaded.current.Data); rrdset_done(p->st_clrremoting_context_bound_classes_loaded); } if (perflibGetObjectCounter(pDataBlock, pObjectType, &p->NETFrameworkCLRRemotingContextBoundObjects)) { if (!p->st_clrremoting_context_bound_objects) { snprintfz(id, RRD_ID_LENGTH_MAX, "%s_clrremoting_context_bound_objects", windows_shared_buffer); - p->st_clrremoting_context_bound_objects = rrdset_create_localhost("netframework" - , id, NULL - , "remoting" - , "netframework.clrremoting_context_bound_objects" - , "Allocated context-bound objects" - , "objects/s" - , PLUGIN_WINDOWS_NAME - , "PerflibNetFramework" - , PRIO_NETFRAMEWORK_CLR_REMOTING_CONTEXT_BOUND_OBJECTS - , update_every - , RRDSET_TYPE_LINE - ); - - snprintfz(id, RRD_ID_LENGTH_MAX, "netframework_%s_clrremoting_context_bound_objects_total", windows_shared_buffer); - p->rd_clrremoting_context_bound_objects = rrddim_add(p->st_clrremoting_context_bound_objects, - id, - "allocated", - 1, - 1, - RRD_ALGORITHM_INCREMENTAL); - - rrdlabels_add(p->st_clrremoting_context_bound_objects->rrdlabels, - "process", - windows_shared_buffer, - RRDLABEL_SRC_AUTO); + p->st_clrremoting_context_bound_objects = rrdset_create_localhost( + "netframework", + id, + NULL, + "remoting", + "netframework.clrremoting_context_bound_objects", + "Allocated context-bound objects", + "objects/s", + PLUGIN_WINDOWS_NAME, + "PerflibNetFramework", + PRIO_NETFRAMEWORK_CLR_REMOTING_CONTEXT_BOUND_OBJECTS, + update_every, + RRDSET_TYPE_LINE); + + snprintfz( + id, + RRD_ID_LENGTH_MAX, + "netframework_%s_clrremoting_context_bound_objects_total", + windows_shared_buffer); + p->rd_clrremoting_context_bound_objects = rrddim_add( + p->st_clrremoting_context_bound_objects, id, "allocated", 1, 1, RRD_ALGORITHM_INCREMENTAL); + + rrdlabels_add( + p->st_clrremoting_context_bound_objects->rrdlabels, + "process", + windows_shared_buffer, + RRDLABEL_SRC_AUTO); } - rrddim_set_by_pointer(p->st_clrremoting_context_bound_objects, - p->rd_clrremoting_context_bound_objects, - (collected_number)p->NETFrameworkCLRRemotingContextBoundObjects.current.Data); + rrddim_set_by_pointer( + p->st_clrremoting_context_bound_objects, + p->rd_clrremoting_context_bound_objects, + (collected_number)p->NETFrameworkCLRRemotingContextBoundObjects.current.Data); rrdset_done(p->st_clrremoting_context_bound_objects); } if (perflibGetObjectCounter(pDataBlock, pObjectType, &p->NETFrameworkCLRRemotingContextProxies)) { if (!p->st_clrremoting_context_proxies) { snprintfz(id, RRD_ID_LENGTH_MAX, "%s_clrremoting_context_proxies", windows_shared_buffer); - p->st_clrremoting_context_proxies = rrdset_create_localhost("netframework" - , id, NULL - , "remoting" - , "netframework.clrremoting_context_proxies" - , "Remoting proxy objects" - , "objects/s" - , PLUGIN_WINDOWS_NAME - , "PerflibNetFramework" - , PRIO_NETFRAMEWORK_CLR_REMOTING_CONTEXTS_PROXIES - , update_every - , RRDSET_TYPE_LINE - ); - - snprintfz(id, RRD_ID_LENGTH_MAX, "netframework_%s_clrremoting_context_proxies_total", windows_shared_buffer); - p->rd_clrremoting_context_proxies = rrddim_add(p->st_clrremoting_context_proxies, - id, - "objects", - 1, - 1, - RRD_ALGORITHM_INCREMENTAL); - - rrdlabels_add(p->st_clrremoting_context_proxies->rrdlabels, - "process", - windows_shared_buffer, - RRDLABEL_SRC_AUTO); + p->st_clrremoting_context_proxies = rrdset_create_localhost( + "netframework", + id, + NULL, + "remoting", + "netframework.clrremoting_context_proxies", + "Remoting proxy objects", + "objects/s", + PLUGIN_WINDOWS_NAME, + "PerflibNetFramework", + PRIO_NETFRAMEWORK_CLR_REMOTING_CONTEXTS_PROXIES, + update_every, + RRDSET_TYPE_LINE); + + snprintfz( + id, RRD_ID_LENGTH_MAX, "netframework_%s_clrremoting_context_proxies_total", windows_shared_buffer); + p->rd_clrremoting_context_proxies = + rrddim_add(p->st_clrremoting_context_proxies, id, "objects", 1, 1, RRD_ALGORITHM_INCREMENTAL); + + rrdlabels_add( + p->st_clrremoting_context_proxies->rrdlabels, "process", windows_shared_buffer, RRDLABEL_SRC_AUTO); } - rrddim_set_by_pointer(p->st_clrremoting_context_proxies, - p->rd_clrremoting_context_proxies, - (collected_number)p->NETFrameworkCLRRemotingContextProxies.current.Data); + rrddim_set_by_pointer( + p->st_clrremoting_context_proxies, + p->rd_clrremoting_context_proxies, + (collected_number)p->NETFrameworkCLRRemotingContextProxies.current.Data); rrdset_done(p->st_clrremoting_context_proxies); } if (perflibGetObjectCounter(pDataBlock, pObjectType, &p->NETFrameworkCLRRemotingContexts)) { if (!p->st_clrremoting_contexts) { snprintfz(id, RRD_ID_LENGTH_MAX, "%s_clrremoting_contexts", windows_shared_buffer); - p->st_clrremoting_contexts = rrdset_create_localhost("netframework" - , id, NULL - , "remoting" - , "netframework.clrremoting_contexts" - , "Total of remoting contexts" - , "contexts" - , PLUGIN_WINDOWS_NAME - , "PerflibNetFramework" - , PRIO_NETFRAMEWORK_CLR_REMOTING_CONTEXTS - , update_every - , RRDSET_TYPE_LINE - ); + p->st_clrremoting_contexts = rrdset_create_localhost( + "netframework", + id, + NULL, + "remoting", + "netframework.clrremoting_contexts", + "Total of remoting contexts", + "contexts", + PLUGIN_WINDOWS_NAME, + "PerflibNetFramework", + PRIO_NETFRAMEWORK_CLR_REMOTING_CONTEXTS, + update_every, + RRDSET_TYPE_LINE); snprintfz(id, RRD_ID_LENGTH_MAX, "netframework_%s_clrremoting_contexts", windows_shared_buffer); - p->rd_clrremoting_contexts = rrddim_add(p->st_clrremoting_contexts, - id, - "contexts", - 1, - 1, - RRD_ALGORITHM_ABSOLUTE); - - rrdlabels_add(p->st_clrremoting_contexts->rrdlabels, - "process", - windows_shared_buffer, - RRDLABEL_SRC_AUTO); + p->rd_clrremoting_contexts = + rrddim_add(p->st_clrremoting_contexts, id, "contexts", 1, 1, RRD_ALGORITHM_ABSOLUTE); + + rrdlabels_add( + p->st_clrremoting_contexts->rrdlabels, "process", windows_shared_buffer, RRDLABEL_SRC_AUTO); } - rrddim_set_by_pointer(p->st_clrremoting_contexts, - p->rd_clrremoting_contexts, - (collected_number)p->NETFrameworkCLRRemotingContexts.current.Data); + rrddim_set_by_pointer( + p->st_clrremoting_contexts, + p->rd_clrremoting_contexts, + (collected_number)p->NETFrameworkCLRRemotingContexts.current.Data); rrdset_done(p->st_clrremoting_contexts); } if (perflibGetObjectCounter(pDataBlock, pObjectType, &p->NETFrameworkCLRRemotingRemoteCalls)) { if (!p->st_clrremoting_remote_calls) { snprintfz(id, RRD_ID_LENGTH_MAX, "%s_clrremoting_calls", windows_shared_buffer); - p->st_clrremoting_remote_calls = rrdset_create_localhost("netframework" - , id, NULL - , "remoting" - , "netframework.clrremoting_remote_calls" - , "Remote Procedure Calls (RPC) invoked" - , "calls/s" - , PLUGIN_WINDOWS_NAME - , "PerflibNetFramework" - , PRIO_NETFRAMEWORK_CLR_REMOTING_REMOTE_CALLS - , update_every - , RRDSET_TYPE_LINE - ); - - snprintfz(id, RRD_ID_LENGTH_MAX, "netframework_%s_clrremoting_remote_calls_total", windows_shared_buffer); - p->rd_clrremoting_remote_calls = rrddim_add(p->st_clrremoting_remote_calls, - id, - "contexts", - 1, - 1, - RRD_ALGORITHM_INCREMENTAL); - - rrdlabels_add(p->st_clrremoting_remote_calls->rrdlabels, - "process", - windows_shared_buffer, - RRDLABEL_SRC_AUTO); + p->st_clrremoting_remote_calls = rrdset_create_localhost( + "netframework", + id, + NULL, + "remoting", + "netframework.clrremoting_remote_calls", + "Remote Procedure Calls (RPC) invoked", + "calls/s", + PLUGIN_WINDOWS_NAME, + "PerflibNetFramework", + PRIO_NETFRAMEWORK_CLR_REMOTING_REMOTE_CALLS, + update_every, + RRDSET_TYPE_LINE); + + snprintfz( + id, RRD_ID_LENGTH_MAX, "netframework_%s_clrremoting_remote_calls_total", windows_shared_buffer); + p->rd_clrremoting_remote_calls = + rrddim_add(p->st_clrremoting_remote_calls, id, "contexts", 1, 1, RRD_ALGORITHM_INCREMENTAL); + + rrdlabels_add( + p->st_clrremoting_remote_calls->rrdlabels, "process", windows_shared_buffer, RRDLABEL_SRC_AUTO); } - rrddim_set_by_pointer(p->st_clrremoting_remote_calls, - p->rd_clrremoting_remote_calls, - (collected_number)p->NETFrameworkCLRRemotingContexts.current.Data); + rrddim_set_by_pointer( + p->st_clrremoting_remote_calls, + p->rd_clrremoting_remote_calls, + (collected_number)p->NETFrameworkCLRRemotingContexts.current.Data); rrdset_done(p->st_clrremoting_remote_calls); } } } -static void netdata_framework_clr_security(PERF_DATA_BLOCK *pDataBlock, - PERF_OBJECT_TYPE *pObjectType, - int update_every) +static void netdata_framework_clr_security(PERF_DATA_BLOCK *pDataBlock, PERF_OBJECT_TYPE *pObjectType, int update_every) { char id[RRD_ID_LENGTH_MAX + 1]; PERF_INSTANCE_DEFINITION *pi = NULL; @@ -1104,36 +1100,33 @@ static void netdata_framework_clr_security(PERF_DATA_BLOCK *pDataBlock, if (perflibGetObjectCounter(pDataBlock, pObjectType, &p->NETFrameworkCLRSecurityLinkTimeChecks)) { if (!p->st_clrsecurity_link_time_checks) { snprintfz(id, RRD_ID_LENGTH_MAX, "%s_clrsecurity_link_time_checks", windows_shared_buffer); - p->st_clrsecurity_link_time_checks = rrdset_create_localhost("netframework" - , id, NULL - , "security" - , "netframework.clrsecurity_link_time_checks" - , "Link-time code access security checks" - , "checks/s" - , PLUGIN_WINDOWS_NAME - , "PerflibNetFramework" - , PRIO_NETFRAMEWORK_CLR_SECURITY_LINK_TIME_CHECKS - , update_every - , RRDSET_TYPE_LINE - ); - - snprintfz(id, RRD_ID_LENGTH_MAX, "netframework_%s_clrsecurity_link_time_checks_total", windows_shared_buffer); - p->rd_clrsecurity_link_time_checks = rrddim_add(p->st_clrsecurity_link_time_checks, - id, - "linktime", - 1, - 1, - RRD_ALGORITHM_INCREMENTAL); - - rrdlabels_add(p->st_clrsecurity_link_time_checks->rrdlabels, - "process", - windows_shared_buffer, - RRDLABEL_SRC_AUTO); + p->st_clrsecurity_link_time_checks = rrdset_create_localhost( + "netframework", + id, + NULL, + "security", + "netframework.clrsecurity_link_time_checks", + "Link-time code access security checks", + "checks/s", + PLUGIN_WINDOWS_NAME, + "PerflibNetFramework", + PRIO_NETFRAMEWORK_CLR_SECURITY_LINK_TIME_CHECKS, + update_every, + RRDSET_TYPE_LINE); + + snprintfz( + id, RRD_ID_LENGTH_MAX, "netframework_%s_clrsecurity_link_time_checks_total", windows_shared_buffer); + p->rd_clrsecurity_link_time_checks = + rrddim_add(p->st_clrsecurity_link_time_checks, id, "linktime", 1, 1, RRD_ALGORITHM_INCREMENTAL); + + rrdlabels_add( + p->st_clrsecurity_link_time_checks->rrdlabels, "process", windows_shared_buffer, RRDLABEL_SRC_AUTO); } - rrddim_set_by_pointer(p->st_clrsecurity_link_time_checks, - p->rd_clrsecurity_link_time_checks, - (collected_number)p->NETFrameworkCLRSecurityLinkTimeChecks.current.Data); + rrddim_set_by_pointer( + p->st_clrsecurity_link_time_checks, + p->rd_clrsecurity_link_time_checks, + (collected_number)p->NETFrameworkCLRSecurityLinkTimeChecks.current.Data); rrdset_done(p->st_clrsecurity_link_time_checks); } @@ -1141,119 +1134,108 @@ static void netdata_framework_clr_security(PERF_DATA_BLOCK *pDataBlock, perflibGetObjectCounter(pDataBlock, pObjectType, &p->NETFrameworkCLRSecurityFrequency_PerfTime)) { if (!p->st_clrsecurity_link_time_checks) { snprintfz(id, RRD_ID_LENGTH_MAX, "%s_clrsecurity_checks_time", windows_shared_buffer); - p->st_clrsecurity_link_time_checks = rrdset_create_localhost("netframework" - , id, NULL - , "security" - , "netframework.clrsecurity_checks_time" - , "Time spent performing runtime code access security checks." - , "percentage" - , PLUGIN_WINDOWS_NAME - , "PerflibNetFramework" - , PRIO_NETFRAMEWORK_CLR_SECURITY_RT_CHECKS_TIME - , update_every - , RRDSET_TYPE_LINE - ); - - snprintfz(id, RRD_ID_LENGTH_MAX, "netframework_%s_clrsecurity_checks_time_percent", windows_shared_buffer); - p->rd_clrsecurity_link_time_checks = rrddim_add(p->st_clrsecurity_link_time_checks, - id, - "time", - 1, - 100, - RRD_ALGORITHM_ABSOLUTE); - - rrdlabels_add(p->st_clrsecurity_link_time_checks->rrdlabels, - "process", - windows_shared_buffer, - RRDLABEL_SRC_AUTO); + p->st_clrsecurity_link_time_checks = rrdset_create_localhost( + "netframework", + id, + NULL, + "security", + "netframework.clrsecurity_checks_time", + "Time spent performing runtime code access security checks.", + "percentage", + PLUGIN_WINDOWS_NAME, + "PerflibNetFramework", + PRIO_NETFRAMEWORK_CLR_SECURITY_RT_CHECKS_TIME, + update_every, + RRDSET_TYPE_LINE); + + snprintfz( + id, RRD_ID_LENGTH_MAX, "netframework_%s_clrsecurity_checks_time_percent", windows_shared_buffer); + p->rd_clrsecurity_link_time_checks = + rrddim_add(p->st_clrsecurity_link_time_checks, id, "time", 1, 100, RRD_ALGORITHM_ABSOLUTE); + + rrdlabels_add( + p->st_clrsecurity_link_time_checks->rrdlabels, "process", windows_shared_buffer, RRDLABEL_SRC_AUTO); } NETDATA_DOUBLE value = (NETDATA_DOUBLE)p->NETFrameworkCLRSecurityPercentTimeinRTChecks.current.Data; value /= (NETDATA_DOUBLE)p->NETFrameworkCLRSecurityFrequency_PerfTime.current.Data; - rrddim_set_by_pointer(p->st_clrsecurity_link_time_checks, - p->rd_clrsecurity_link_time_checks, - (collected_number)(value * 100.0)); + rrddim_set_by_pointer( + p->st_clrsecurity_link_time_checks, + p->rd_clrsecurity_link_time_checks, + (collected_number)(value * 100.0)); rrdset_done(p->st_clrsecurity_link_time_checks); } if (perflibGetObjectCounter(pDataBlock, pObjectType, &p->NETFrameworkCLRSecurityStackWalkDepth)) { if (!p->st_clrsecurity_stack_walk_depth) { snprintfz(id, RRD_ID_LENGTH_MAX, "%s_clrsecurity_stack_walk_depth", windows_shared_buffer); - p->st_clrsecurity_stack_walk_depth = rrdset_create_localhost("netframework" - , id, NULL - , "security" - , "netframework.clrsecurity_stack_walk_depth" - , "Depth of the stack" - , "depth" - , PLUGIN_WINDOWS_NAME - , "PerflibNetFramework" - , PRIO_NETFRAMEWORK_CLR_SECURITY_STACK_WALK_DEPTH - , update_every - , RRDSET_TYPE_LINE - ); + p->st_clrsecurity_stack_walk_depth = rrdset_create_localhost( + "netframework", + id, + NULL, + "security", + "netframework.clrsecurity_stack_walk_depth", + "Depth of the stack", + "depth", + PLUGIN_WINDOWS_NAME, + "PerflibNetFramework", + PRIO_NETFRAMEWORK_CLR_SECURITY_STACK_WALK_DEPTH, + update_every, + RRDSET_TYPE_LINE); snprintfz(id, RRD_ID_LENGTH_MAX, "netframework_%s_clrsecurity_stack_walk_depth", windows_shared_buffer); - p->rd_clrsecurity_stack_walk_depth = rrddim_add(p->st_clrsecurity_stack_walk_depth, - id, - "stack", - 1, - 1, - RRD_ALGORITHM_ABSOLUTE); - - rrdlabels_add(p->st_clrsecurity_stack_walk_depth->rrdlabels, - "process", - windows_shared_buffer, - RRDLABEL_SRC_AUTO); + p->rd_clrsecurity_stack_walk_depth = + rrddim_add(p->st_clrsecurity_stack_walk_depth, id, "stack", 1, 1, RRD_ALGORITHM_ABSOLUTE); + + rrdlabels_add( + p->st_clrsecurity_stack_walk_depth->rrdlabels, "process", windows_shared_buffer, RRDLABEL_SRC_AUTO); } - rrddim_set_by_pointer(p->st_clrsecurity_stack_walk_depth, - p->rd_clrsecurity_stack_walk_depth, - (collected_number)p->NETFrameworkCLRSecurityStackWalkDepth.current.Data); + rrddim_set_by_pointer( + p->st_clrsecurity_stack_walk_depth, + p->rd_clrsecurity_stack_walk_depth, + (collected_number)p->NETFrameworkCLRSecurityStackWalkDepth.current.Data); rrdset_done(p->st_clrsecurity_stack_walk_depth); } if (perflibGetObjectCounter(pDataBlock, pObjectType, &p->NETFrameworkCLRSecurityRunTimeChecks)) { if (!p->st_clrsecurity_stack_walk_depth) { snprintfz(id, RRD_ID_LENGTH_MAX, "%s_clrsecurity_runtime_checks", windows_shared_buffer); - p->st_clrsecurity_stack_walk_depth = rrdset_create_localhost("netframework" - , id, NULL - , "security" - , "netframework.clrsecurity_runtime_checks" - , "Runtime code access security checks performed" - , "checks/s" - , PLUGIN_WINDOWS_NAME - , "PerflibNetFramework" - , PRIO_NETFRAMEWORK_CLR_SECURITY_RUNTIME_CHECKS - , update_every - , RRDSET_TYPE_LINE - ); - - snprintfz(id, RRD_ID_LENGTH_MAX, "netframework_%s_clrsecurity_runtime_checks_total", windows_shared_buffer); - p->rd_clrsecurity_stack_walk_depth = rrddim_add(p->st_clrsecurity_stack_walk_depth, - id, - "runtime", - 1, - 1, - RRD_ALGORITHM_INCREMENTAL); - - rrdlabels_add(p->st_clrsecurity_stack_walk_depth->rrdlabels, - "process", - windows_shared_buffer, - RRDLABEL_SRC_AUTO); + p->st_clrsecurity_stack_walk_depth = rrdset_create_localhost( + "netframework", + id, + NULL, + "security", + "netframework.clrsecurity_runtime_checks", + "Runtime code access security checks performed", + "checks/s", + PLUGIN_WINDOWS_NAME, + "PerflibNetFramework", + PRIO_NETFRAMEWORK_CLR_SECURITY_RUNTIME_CHECKS, + update_every, + RRDSET_TYPE_LINE); + + snprintfz( + id, RRD_ID_LENGTH_MAX, "netframework_%s_clrsecurity_runtime_checks_total", windows_shared_buffer); + p->rd_clrsecurity_stack_walk_depth = + rrddim_add(p->st_clrsecurity_stack_walk_depth, id, "runtime", 1, 1, RRD_ALGORITHM_INCREMENTAL); + + rrdlabels_add( + p->st_clrsecurity_stack_walk_depth->rrdlabels, "process", windows_shared_buffer, RRDLABEL_SRC_AUTO); } - rrddim_set_by_pointer(p->st_clrsecurity_stack_walk_depth, - p->rd_clrsecurity_stack_walk_depth, - (collected_number)p->NETFrameworkCLRSecurityRunTimeChecks.current.Data); + rrddim_set_by_pointer( + p->st_clrsecurity_stack_walk_depth, + p->rd_clrsecurity_stack_walk_depth, + (collected_number)p->NETFrameworkCLRSecurityRunTimeChecks.current.Data); rrdset_done(p->st_clrsecurity_stack_walk_depth); } } } -static void netdata_framework_clr_locks_and_threads(PERF_DATA_BLOCK *pDataBlock, - PERF_OBJECT_TYPE *pObjectType, - int update_every) +static void +netdata_framework_clr_locks_and_threads(PERF_DATA_BLOCK *pDataBlock, PERF_OBJECT_TYPE *pObjectType, int update_every) { char id[RRD_ID_LENGTH_MAX + 1]; PERF_INSTANCE_DEFINITION *pi = NULL; @@ -1352,118 +1334,119 @@ static void netdata_framework_clr_locks_and_threads(PERF_DATA_BLOCK *pDataBlock, if (perflibGetObjectCounter(pDataBlock, pObjectType, &p->NETFrameworkCLRLocksAndThreadsCurrentPhysicalThreads)) { if (!p->st_clrlocksandthreads_current_physical_threads) { - snprintfz(id, RRD_ID_LENGTH_MAX, "%s_clrlocksandthreads_current_physical_threads", windows_shared_buffer); - p->st_clrlocksandthreads_current_physical_threads = rrdset_create_localhost("netframework", - id, - NULL, - "locks threads", - "netframework.clrlocksandthreads_current_physical_threads", - "Physical threads", - "threads", - PLUGIN_WINDOWS_NAME, - "PerflibNetFramework", - PRIO_NETFRAMEWORK_CLR_LOCKS_AND_THREADS_CURRENT_PHYSICAL_THREADS, - update_every, - RRDSET_TYPE_LINE); - - snprintfz(id, - RRD_ID_LENGTH_MAX, - "netframework_%s_clrlocksandthreads_physical_threads_current", - windows_shared_buffer); - p->rd_locksandthreads_current_physical_threads = rrddim_add(p->st_clrlocksandthreads_current_physical_threads, - id, - "physical", - 1, - 1, - RRD_ALGORITHM_ABSOLUTE); - - rrdlabels_add(p->st_clrlocksandthreads_current_physical_threads->rrdlabels, - "process", - windows_shared_buffer, - RRDLABEL_SRC_AUTO); + snprintfz( + id, RRD_ID_LENGTH_MAX, "%s_clrlocksandthreads_current_physical_threads", windows_shared_buffer); + p->st_clrlocksandthreads_current_physical_threads = rrdset_create_localhost( + "netframework", + id, + NULL, + "locks threads", + "netframework.clrlocksandthreads_current_physical_threads", + "Physical threads", + "threads", + PLUGIN_WINDOWS_NAME, + "PerflibNetFramework", + PRIO_NETFRAMEWORK_CLR_LOCKS_AND_THREADS_CURRENT_PHYSICAL_THREADS, + update_every, + RRDSET_TYPE_LINE); + + snprintfz( + id, + RRD_ID_LENGTH_MAX, + "netframework_%s_clrlocksandthreads_physical_threads_current", + windows_shared_buffer); + p->rd_locksandthreads_current_physical_threads = rrddim_add( + p->st_clrlocksandthreads_current_physical_threads, id, "physical", 1, 1, RRD_ALGORITHM_ABSOLUTE); + + rrdlabels_add( + p->st_clrlocksandthreads_current_physical_threads->rrdlabels, + "process", + windows_shared_buffer, + RRDLABEL_SRC_AUTO); } - rrddim_set_by_pointer(p->st_clrlocksandthreads_current_physical_threads, - p->rd_locksandthreads_current_physical_threads, - (collected_number)p->NETFrameworkCLRLocksAndThreadsCurrentPhysicalThreads.current.Data); + rrddim_set_by_pointer( + p->st_clrlocksandthreads_current_physical_threads, + p->rd_locksandthreads_current_physical_threads, + (collected_number)p->NETFrameworkCLRLocksAndThreadsCurrentPhysicalThreads.current.Data); rrdset_done(p->st_clrlocksandthreads_current_physical_threads); } if (perflibGetObjectCounter(pDataBlock, pObjectType, &p->NETFrameworkCLRLocksAndThreadsRecognizedThreads)) { if (!p->st_clrlocksandthreads_recognized_threads) { snprintfz(id, RRD_ID_LENGTH_MAX, "%s_clrlocksandthreads_recognized_threads", windows_shared_buffer); - p->st_clrlocksandthreads_recognized_threads = rrdset_create_localhost("netframework", - id, - NULL, - "locks threads", - "netframework.clrlocksandthreads_recognized_threads", - "Threads recognized by the runtime", - "threads/s", - PLUGIN_WINDOWS_NAME, - "PerflibNetFramework", - PRIO_NETFRAMEWORK_CLR_LOCKS_AND_THREADS_RECOGNIZED_THREADS, - update_every, - RRDSET_TYPE_LINE); - - snprintfz(id, - RRD_ID_LENGTH_MAX, - "netframework_%s_clrlocksandthreads_recognized_threads_total", - windows_shared_buffer); - p->rd_locksandthreads_recognized_threads = rrddim_add(p->st_clrlocksandthreads_recognized_threads, - id, - "threads", - 1, - 1, - RRD_ALGORITHM_ABSOLUTE); - - rrdlabels_add(p->st_clrlocksandthreads_recognized_threads->rrdlabels, - "process", - windows_shared_buffer, - RRDLABEL_SRC_AUTO); + p->st_clrlocksandthreads_recognized_threads = rrdset_create_localhost( + "netframework", + id, + NULL, + "locks threads", + "netframework.clrlocksandthreads_recognized_threads", + "Threads recognized by the runtime", + "threads/s", + PLUGIN_WINDOWS_NAME, + "PerflibNetFramework", + PRIO_NETFRAMEWORK_CLR_LOCKS_AND_THREADS_RECOGNIZED_THREADS, + update_every, + RRDSET_TYPE_LINE); + + snprintfz( + id, + RRD_ID_LENGTH_MAX, + "netframework_%s_clrlocksandthreads_recognized_threads_total", + windows_shared_buffer); + p->rd_locksandthreads_recognized_threads = rrddim_add( + p->st_clrlocksandthreads_recognized_threads, id, "threads", 1, 1, RRD_ALGORITHM_ABSOLUTE); + + rrdlabels_add( + p->st_clrlocksandthreads_recognized_threads->rrdlabels, + "process", + windows_shared_buffer, + RRDLABEL_SRC_AUTO); } - rrddim_set_by_pointer(p->st_clrlocksandthreads_recognized_threads, - p->rd_locksandthreads_recognized_threads, - (collected_number)p->NETFrameworkCLRLocksAndThreadsRecognizedThreads.current.Data); + rrddim_set_by_pointer( + p->st_clrlocksandthreads_recognized_threads, + p->rd_locksandthreads_recognized_threads, + (collected_number)p->NETFrameworkCLRLocksAndThreadsRecognizedThreads.current.Data); rrdset_done(p->st_clrlocksandthreads_recognized_threads); } if (perflibGetObjectCounter(pDataBlock, pObjectType, &p->NETFrameworkCLRLocksAndThreadsContentions)) { if (!p->st_clrlocksandthreads_contentions) { snprintfz(id, RRD_ID_LENGTH_MAX, "%s_clrlocksandthreads_contentions", windows_shared_buffer); - p->st_clrlocksandthreads_contentions = rrdset_create_localhost("netframework", - id, - NULL, - "locks threads", - "netframework.clrlocksandthreads_contentions", - "Fails to acquire a managed lock", - "contentions/s", - PLUGIN_WINDOWS_NAME, - "PerflibNetFramework", - PRIO_NETFRAMEWORK_CLR_LOCKS_AND_THREADS_CONTENTIONS, - update_every, - RRDSET_TYPE_LINE); - - snprintfz(id, - RRD_ID_LENGTH_MAX, - "netframework_%s_clrlocksandthreads_contentions_total", - windows_shared_buffer); - p->rd_locksandthreads_contentions = rrddim_add(p->st_clrlocksandthreads_contentions, - id, - "contentions", - 1, - 1, - RRD_ALGORITHM_INCREMENTAL); - - rrdlabels_add(p->st_clrlocksandthreads_contentions->rrdlabels, - "process", - windows_shared_buffer, - RRDLABEL_SRC_AUTO); + p->st_clrlocksandthreads_contentions = rrdset_create_localhost( + "netframework", + id, + NULL, + "locks threads", + "netframework.clrlocksandthreads_contentions", + "Fails to acquire a managed lock", + "contentions/s", + PLUGIN_WINDOWS_NAME, + "PerflibNetFramework", + PRIO_NETFRAMEWORK_CLR_LOCKS_AND_THREADS_CONTENTIONS, + update_every, + RRDSET_TYPE_LINE); + + snprintfz( + id, + RRD_ID_LENGTH_MAX, + "netframework_%s_clrlocksandthreads_contentions_total", + windows_shared_buffer); + p->rd_locksandthreads_contentions = rrddim_add( + p->st_clrlocksandthreads_contentions, id, "contentions", 1, 1, RRD_ALGORITHM_INCREMENTAL); + + rrdlabels_add( + p->st_clrlocksandthreads_contentions->rrdlabels, + "process", + windows_shared_buffer, + RRDLABEL_SRC_AUTO); } - rrddim_set_by_pointer(p->st_clrlocksandthreads_contentions, - p->rd_locksandthreads_contentions, - (collected_number)p->NETFrameworkCLRLocksAndThreadsContentions.current.Data); + rrddim_set_by_pointer( + p->st_clrlocksandthreads_contentions, + p->rd_locksandthreads_contentions, + (collected_number)p->NETFrameworkCLRLocksAndThreadsContentions.current.Data); rrdset_done(p->st_clrlocksandthreads_contentions); } } @@ -1473,17 +1456,18 @@ struct netdata_netframework_objects { char *object; void (*fnct)(PERF_DATA_BLOCK *, PERF_OBJECT_TYPE *, int); } netframewrk_obj[NETDATA_NETFRAMEWORK_END] = { - {.fnct = netdata_framework_clr_exceptions, .object = ".NET CLR Exceptions" }, - {.fnct = netdata_framework_clr_interop, .object = ".NET CLR Interop" }, - {.fnct = netdata_framework_clr_jit, .object = ".NET CLR Jit" }, - {.fnct = netdata_framework_clr_loading, .object = ".NET CLR Loading" }, - {.fnct = netdata_framework_clr_remoting, .object = ".NET CLR Remoting" }, - {.fnct = netdata_framework_clr_security, .object = ".NET CLR Security" }, - {.fnct = netdata_framework_clr_locks_and_threads, .object = ".NET CLR LocksAndThreads" } + {.fnct = netdata_framework_clr_exceptions, .object = ".NET CLR Exceptions"}, + {.fnct = netdata_framework_clr_interop, .object = ".NET CLR Interop"}, + {.fnct = netdata_framework_clr_jit, .object = ".NET CLR Jit"}, + {.fnct = netdata_framework_clr_loading, .object = ".NET CLR Loading"}, + {.fnct = netdata_framework_clr_remoting, .object = ".NET CLR Remoting"}, + {.fnct = netdata_framework_clr_security, .object = ".NET CLR Security"}, + {.fnct = netdata_framework_clr_locks_and_threads, .object = ".NET CLR LocksAndThreads"} }; -int do_PerflibNetFramework(int update_every, usec_t dt __maybe_unused) { +int do_PerflibNetFramework(int update_every, usec_t dt __maybe_unused) +{ static bool initialized = false; if (unlikely(!initialized)) { From d5ffcd1dd7d342e3ac30031a112abedbb42198c8 Mon Sep 17 00:00:00 2001 From: thiagoftsm Date: Fri, 31 Jan 2025 13:52:15 +0000 Subject: [PATCH 05/10] Add CLR Remoting metadata (#19203) --- src/collectors/windows.plugin/metadata.yaml | 84 +++++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/src/collectors/windows.plugin/metadata.yaml b/src/collectors/windows.plugin/metadata.yaml index e616dac078930e..3a0dbf10673872 100644 --- a/src/collectors/windows.plugin/metadata.yaml +++ b/src/collectors/windows.plugin/metadata.yaml @@ -1958,3 +1958,87 @@ modules: chart_type: line dimensions: - name: class_load + - name: netframework.clrremoting_channels + description: Registered channels + unit: channels/s + chart_type: line + dimensions: + - name: registered + - name: netframework.clrremoting_context_bound_classes_loaded + description: Loaded context-bound classes + unit: classes + chart_type: line + dimensions: + - name: loaded + - name: netframework.clrremoting_context_bound_objects + description: Allocated context-bound objects + unit: objects/s + chart_type: line + dimensions: + - name: objects + - name: netframework.clrremoting_context_proxies + description: Remoting proxy objects + unit: objects/s + chart_type: line + dimensions: + - name: contexts + - name: netframework.clrremoting_remote_calls + description: Remote Procedure Calls (RPC) invoked + unit: calls/s + chart_type: line + dimensions: + - name: rpc + - name: netframework.clrsecurity_link_time_checks + description: Link-time code access security checks + unit: checks/s + chart_type: line + dimensions: + - name: linktime + - name: netframework.clrsecurity_checks_time + description: Time spent performing runtime code access security checks + unit: percentage + chart_type: line + dimensions: + - name: time + - name: netframework.clrsecurity_stack_walk_depth + description: Depth of the stack + unit: depth + chart_type: line + dimensions: + - name: stack + - name: netframework.clrsecurity_runtime_checks + description: Runtime code access security checks performed + unit: checks/s + chart_type: line + dimensions: + - name: runtime + - name: netframework.clrlocksandthreads_queue_length + description: Threads waited to acquire a managed lock + unit: threads/s + chart_type: line + dimensions: + - name: threads + - name: netframework.clrlocksandthreads_current_logical_threads + description: Logical threads + unit: threads + chart_type: line + dimensions: + - name: logical + - name: netframework.clrlocksandthreads_current_physical_threads + description: Physical threads + unit: threads + chart_type: line + dimensions: + - name: physical + - name: netframework.clrlocksandthreads_recognized_threads + description: Threads recognized by the runtime + unit: threads/s + chart_type: line + dimensions: + - name: threads + - name: netframework.clrlocksandthreads_contentions + description: Fails to acquire a managed lock + unit: contentions/s + chart_type: line + dimensions: + - name: contentions From 33acb2fa89e81aef3418941bc8f54d5ff74e9245 Mon Sep 17 00:00:00 2001 From: Netdata bot <43409846+netdatabot@users.noreply.github.com> Date: Fri, 31 Jan 2025 08:59:36 -0500 Subject: [PATCH 06/10] Regenerate integrations docs (#19548) Co-authored-by: ilyam8 <22274335+ilyam8@users.noreply.github.com> --- .../windows.plugin/integrations/net_framework.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/collectors/windows.plugin/integrations/net_framework.md b/src/collectors/windows.plugin/integrations/net_framework.md index 82e185b9640b25..a1b59031ab2594 100644 --- a/src/collectors/windows.plugin/integrations/net_framework.md +++ b/src/collectors/windows.plugin/integrations/net_framework.md @@ -89,6 +89,20 @@ Metrics: | netframework.clrloading_assemblies_loaded | loaded | assemblies/s | | netframework.clrloading_classes_loaded | loaded | classes/s | | netframework.clrloading_class_load_failures | class_load | failures/s | +| netframework.clrremoting_channels | registered | channels/s | +| netframework.clrremoting_context_bound_classes_loaded | loaded | classes | +| netframework.clrremoting_context_bound_objects | objects | objects/s | +| netframework.clrremoting_context_proxies | contexts | objects/s | +| netframework.clrremoting_remote_calls | rpc | calls/s | +| netframework.clrsecurity_link_time_checks | linktime | checks/s | +| netframework.clrsecurity_checks_time | time | percentage | +| netframework.clrsecurity_stack_walk_depth | stack | depth | +| netframework.clrsecurity_runtime_checks | runtime | checks/s | +| netframework.clrlocksandthreads_queue_length | threads | threads/s | +| netframework.clrlocksandthreads_current_logical_threads | logical | threads | +| netframework.clrlocksandthreads_current_physical_threads | physical | threads | +| netframework.clrlocksandthreads_recognized_threads | threads | threads/s | +| netframework.clrlocksandthreads_contentions | contentions | contentions/s | From 30892d49e7da21b805c0fc82ddaee5223b4fe449 Mon Sep 17 00:00:00 2001 From: thiagoftsm Date: Fri, 31 Jan 2025 15:34:10 +0000 Subject: [PATCH 07/10] Active Directory Certification Service (windows.plugin) (#19492) Co-authored-by: ilyam8 --- CMakeLists.txt | 1 + src/collectors/windows.plugin/perflib-adcs.c | 721 ++++++++++++++++++ .../windows.plugin/windows_plugin.c | 68 +- .../windows.plugin/windows_plugin.h | 19 +- 4 files changed, 781 insertions(+), 28 deletions(-) create mode 100644 src/collectors/windows.plugin/perflib-adcs.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 55db38ebe8cc0d..c39fc9420760be 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1775,6 +1775,7 @@ set(WINDOWS_PLUGIN_FILES src/collectors/windows.plugin/GetSystemUptime.c src/collectors/windows.plugin/GetSystemRAM.c src/collectors/windows.plugin/GetSystemCPU.c + src/collectors/windows.plugin/perflib-adcs.c src/collectors/windows.plugin/perflib-rrd.c src/collectors/windows.plugin/perflib-rrd.h src/collectors/windows.plugin/perflib-ad.c diff --git a/src/collectors/windows.plugin/perflib-adcs.c b/src/collectors/windows.plugin/perflib-adcs.c new file mode 100644 index 00000000000000..c5a39d0357cb95 --- /dev/null +++ b/src/collectors/windows.plugin/perflib-adcs.c @@ -0,0 +1,721 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "windows_plugin.h" +#include "windows-internals.h" + +struct adcs_certificate { + char *name; + + RRDSET *st_adcs_requests_total; + RRDDIM *rd_adcs_requests_total; + + RRDSET *st_adcs_failed_requests_total; + RRDDIM *rd_adcs_failed_requests_total; + + RRDSET *st_adcs_issued_requests_total; + RRDDIM *rd_adcs_issued_requests_total; + + RRDSET *st_adcs_pending_requests_total; + RRDDIM *rd_adcs_pending_requests_total; + + RRDSET *st_adcs_request_processing_time_seconds; + RRDDIM *rd_adcs_request_processing_time_seconds; + + RRDSET *st_adcs_retrievals_total; + RRDDIM *rd_adcs_retrievals_total; + + RRDSET *st_adcs_retrievals_processing_time_seconds; + RRDDIM *rd_adcs_retrievals_processing_time_seconds; + + RRDSET *st_adcs_request_cryptographic_signing_time_seconds; + RRDDIM *rd_adcs_request_cryptographic_signing_time_seconds; + + RRDSET *st_adcs_request_policy_module_processing_time_seconds; + RRDDIM *rd_adcs_request_policy_module_processing_time_seconds; + + RRDSET *st_adcs_challenge_responses_total; + RRDDIM *rd_adcs_challenge_responses_total; + + RRDSET *st_adcs_challenge_response_processing_time_seconds; + RRDDIM *rd_adcs_challenge_response_processing_time_seconds; + + RRDSET *st_adcs_signed_certificate_timestamp_lists_total; + RRDDIM *rd_adcs_signed_certificate_timestamp_lists_total; + + RRDSET *st_adcs_signed_certificate_timestamp_list_processing_time_seconds; + RRDDIM *rd_adcs_signed_certificate_timestamp_list_processing_time_seconds; + + COUNTER_DATA ADCSRequestsTotal; + COUNTER_DATA ADCSFailedRequestsTotal; + COUNTER_DATA ADCSIssuedRequestsTotal; + COUNTER_DATA ADCSPendingRequestsTotal; + COUNTER_DATA ADCSRequestProcessingTime; + COUNTER_DATA ADCSRetrievalsTotal; + COUNTER_DATA ADCSRetrievalsProcessingTime; + COUNTER_DATA ADCSRequestCryptoSigningTime; + COUNTER_DATA ADCSRequestPolicyModuleProcessingTime; + COUNTER_DATA ADCSChallengeResponseResponsesTotal; + COUNTER_DATA ADCSChallengeResponseProcessingTime; + COUNTER_DATA ADCSSignedCertTimestampListsTotal; + COUNTER_DATA ADCSSignedCertTimestampListProcessingTime; +}; + +static DICTIONARY *adcs_certificates = NULL; + +void dict_adcs_insert_certificate_cb(const DICTIONARY_ITEM *item __maybe_unused, void *value, void *data __maybe_unused) +{ + struct adcs_certificate *ptr = value; + const char *name = dictionary_acquired_item_name((DICTIONARY_ITEM *)item); + + ptr->name = strdupz(name); + + ptr->ADCSRequestsTotal.key = "Requests/sec"; + ptr->ADCSFailedRequestsTotal.key = "Failed Requests/sec"; + ptr->ADCSIssuedRequestsTotal.key = "Issued Requests/sec"; + ptr->ADCSPendingRequestsTotal.key = "Pending Requests/sec"; + ptr->ADCSRequestProcessingTime.key = "Request processing time (ms)"; + ptr->ADCSRetrievalsTotal.key = "Retrievals/sec"; + ptr->ADCSRetrievalsProcessingTime.key = "Retrieval processing time (ms)"; + ptr->ADCSRequestCryptoSigningTime.key = "Request cryptographic signing time (ms)"; + ptr->ADCSRequestPolicyModuleProcessingTime.key = "Request policy module processing time (ms)"; + ptr->ADCSChallengeResponseResponsesTotal.key = "Challenge Responses/sec"; + ptr->ADCSChallengeResponseProcessingTime.key = "Challenge Response processing time (ms)"; + ptr->ADCSSignedCertTimestampListsTotal.key = "Signed Certificate Timestamp Lists/sec"; + ptr->ADCSSignedCertTimestampListProcessingTime.key = "Signed Certificate Timestamp List processing time (ms)"; +} + +static void initialize(void) +{ + adcs_certificates = dictionary_create_advanced( + DICT_OPTION_DONT_OVERWRITE_VALUE | DICT_OPTION_FIXED_SIZE, NULL, sizeof(struct adcs_certificate)); + + dictionary_register_insert_callback(adcs_certificates, dict_adcs_insert_certificate_cb, NULL); +} + +static void netdata_adcs_requests( + struct adcs_certificate *ac, + PERF_DATA_BLOCK *pDataBlock, + PERF_OBJECT_TYPE *pObjectType, + int update_every) +{ + char id[RRD_ID_LENGTH_MAX + 1]; + if (!perflibGetObjectCounter(pDataBlock, pObjectType, &ac->ADCSRequestsTotal)) { + return; + } + + if (!ac->st_adcs_requests_total) { + snprintfz(id, RRD_ID_LENGTH_MAX, "cert_%s_requests", ac->name); + ac->st_adcs_requests_total = rrdset_create_localhost( + "adcs", + id, + NULL, + "requests", + "adcs.cert_requests", + "Certificate requests processed", + "requests/s", + PLUGIN_WINDOWS_NAME, + "PerflibADCS", + PRIO_ADCS_CERT_REQUESTS_TOTAL, + update_every, + RRDSET_TYPE_LINE); + + ac->rd_adcs_requests_total = + rrddim_add(ac->st_adcs_requests_total, "requests", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); + + rrdlabels_add(ac->st_adcs_requests_total->rrdlabels, "cert", ac->name, RRDLABEL_SRC_AUTO); + } + + rrddim_set_by_pointer( + ac->st_adcs_requests_total, ac->rd_adcs_requests_total, (collected_number)ac->ADCSRequestsTotal.current.Data); + rrdset_done(ac->st_adcs_requests_total); +} + +static void netdata_adcs_requests_processing_time( + struct adcs_certificate *ac, + PERF_DATA_BLOCK *pDataBlock, + PERF_OBJECT_TYPE *pObjectType, + int update_every) +{ + char id[RRD_ID_LENGTH_MAX + 1]; + if (!perflibGetObjectCounter(pDataBlock, pObjectType, &ac->ADCSRequestProcessingTime)) { + return; + } + + if (!ac->st_adcs_request_processing_time_seconds) { + snprintfz(id, RRD_ID_LENGTH_MAX, "cert_%s_request_processing_time", ac->name); + ac->st_adcs_request_processing_time_seconds = rrdset_create_localhost( + "adcs", + id, + NULL, + "requests", + "adcs.cert_request_processing_time", + "Certificate last request processing time", + "seconds", + PLUGIN_WINDOWS_NAME, + "PerflibADCS", + PRIO_ADCS_CERT_REQUESTS_PROCESSING_TIME, + update_every, + RRDSET_TYPE_LINE); + + ac->rd_adcs_request_processing_time_seconds = rrddim_add( + ac->st_adcs_request_processing_time_seconds, "processing_time", NULL, 1, 1000, RRD_ALGORITHM_ABSOLUTE); + + rrdlabels_add(ac->st_adcs_request_processing_time_seconds->rrdlabels, "cert", ac->name, RRDLABEL_SRC_AUTO); + } + + rrddim_set_by_pointer( + ac->st_adcs_request_processing_time_seconds, + ac->rd_adcs_request_processing_time_seconds, + (collected_number)ac->ADCSRequestProcessingTime.current.Data); + rrdset_done(ac->st_adcs_request_processing_time_seconds); +} + +static void netdata_adcs_retrievals( + struct adcs_certificate *ac, + PERF_DATA_BLOCK *pDataBlock, + PERF_OBJECT_TYPE *pObjectType, + int update_every) +{ + char id[RRD_ID_LENGTH_MAX + 1]; + if (!perflibGetObjectCounter(pDataBlock, pObjectType, &ac->ADCSRetrievalsTotal)) { + return; + } + + if (!ac->st_adcs_retrievals_total) { + snprintfz(id, RRD_ID_LENGTH_MAX, "cert_%s_retrievals", ac->name); + ac->st_adcs_retrievals_total = rrdset_create_localhost( + "adcs", + id, + NULL, + "retrievals", + "adcs.cert_retrievals", + "Total of certificate retrievals", + "retrievals/s", + PLUGIN_WINDOWS_NAME, + "PerflibADCS", + PRIO_ADCS_CERT_RETRIVALS, + update_every, + RRDSET_TYPE_LINE); + + ac->rd_adcs_retrievals_total = + rrddim_add(ac->st_adcs_retrievals_total, "retrievals", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); + + rrdlabels_add(ac->st_adcs_retrievals_total->rrdlabels, "cert", ac->name, RRDLABEL_SRC_AUTO); + } + + rrddim_set_by_pointer( + ac->st_adcs_retrievals_total, + ac->rd_adcs_retrievals_total, + (collected_number)ac->ADCSRetrievalsTotal.current.Data); + rrdset_done(ac->st_adcs_retrievals_total); +} + +static void netdata_adcs_failed_requets( + struct adcs_certificate *ac, + PERF_DATA_BLOCK *pDataBlock, + PERF_OBJECT_TYPE *pObjectType, + int update_every) +{ + char id[RRD_ID_LENGTH_MAX + 1]; + if (!perflibGetObjectCounter(pDataBlock, pObjectType, &ac->ADCSFailedRequestsTotal)) { + return; + } + + if (!ac->st_adcs_failed_requests_total) { + snprintfz(id, RRD_ID_LENGTH_MAX, "cert_%s_failed_requests", ac->name); + ac->st_adcs_failed_requests_total = rrdset_create_localhost( + "adcs", + id, + NULL, + "requests", + "adcs.cert_failed_requests", + "Certificate failed requests processed", + "requests/s", + PLUGIN_WINDOWS_NAME, + "PerflibADCS", + PRIO_ADCS_CERT_FAILED_REQUESTS, + update_every, + RRDSET_TYPE_LINE); + + ac->rd_adcs_failed_requests_total = + rrddim_add(ac->st_adcs_failed_requests_total, "failed", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); + + rrdlabels_add(ac->st_adcs_failed_requests_total->rrdlabels, "cert", ac->name, RRDLABEL_SRC_AUTO); + } + + rrddim_set_by_pointer( + ac->st_adcs_failed_requests_total, + ac->rd_adcs_failed_requests_total, + (collected_number)ac->ADCSFailedRequestsTotal.current.Data); + rrdset_done(ac->st_adcs_failed_requests_total); +} + +static void netdata_adcs_issued_requets( + struct adcs_certificate *ac, + PERF_DATA_BLOCK *pDataBlock, + PERF_OBJECT_TYPE *pObjectType, + int update_every) +{ + char id[RRD_ID_LENGTH_MAX + 1]; + if (!perflibGetObjectCounter(pDataBlock, pObjectType, &ac->ADCSIssuedRequestsTotal)) { + return; + } + + if (!ac->st_adcs_issued_requests_total) { + snprintfz(id, RRD_ID_LENGTH_MAX, "cert_%s_issued_requests", ac->name); + ac->st_adcs_issued_requests_total = rrdset_create_localhost( + "adcs", + id, + NULL, + "requests", + "adcs.cert_issued_requests", + "Certificate issued requests processed", + "requests/s", + PLUGIN_WINDOWS_NAME, + "PerflibADCS", + PRIO_ADCS_CERT_ISSUED_REQUESTS, + update_every, + RRDSET_TYPE_LINE); + + ac->rd_adcs_issued_requests_total = + rrddim_add(ac->st_adcs_issued_requests_total, "issued", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); + + rrdlabels_add(ac->st_adcs_issued_requests_total->rrdlabels, "cert", ac->name, RRDLABEL_SRC_AUTO); + } + + rrddim_set_by_pointer( + ac->st_adcs_issued_requests_total, + ac->rd_adcs_issued_requests_total, + (collected_number)ac->ADCSIssuedRequestsTotal.current.Data); + rrdset_done(ac->st_adcs_issued_requests_total); +} + +static void netdata_adcs_pending_requets( + struct adcs_certificate *ac, + PERF_DATA_BLOCK *pDataBlock, + PERF_OBJECT_TYPE *pObjectType, + int update_every) +{ + char id[RRD_ID_LENGTH_MAX + 1]; + if (!perflibGetObjectCounter(pDataBlock, pObjectType, &ac->ADCSPendingRequestsTotal)) { + return; + } + + if (!ac->st_adcs_pending_requests_total) { + snprintfz(id, RRD_ID_LENGTH_MAX, "cert_%s_pending_requests", ac->name); + ac->st_adcs_pending_requests_total = rrdset_create_localhost( + "adcs", + id, + NULL, + "requests", + "adcs.cert_pending_requests", + "Certificate pending requests processed", + "requests/s", + PLUGIN_WINDOWS_NAME, + "PerflibADCS", + PRIO_ADCS_CERT_PENDING_REQUESTS, + update_every, + RRDSET_TYPE_LINE); + + ac->rd_adcs_pending_requests_total = + rrddim_add(ac->st_adcs_pending_requests_total, "pending", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); + + rrdlabels_add(ac->st_adcs_pending_requests_total->rrdlabels, "cert", ac->name, RRDLABEL_SRC_AUTO); + } + + rrddim_set_by_pointer( + ac->st_adcs_pending_requests_total, + ac->rd_adcs_pending_requests_total, + (collected_number)ac->ADCSPendingRequestsTotal.current.Data); + rrdset_done(ac->st_adcs_pending_requests_total); +} + +static void netdata_adcs_challenge_response( + struct adcs_certificate *ac, + PERF_DATA_BLOCK *pDataBlock, + PERF_OBJECT_TYPE *pObjectType, + int update_every) +{ + char id[RRD_ID_LENGTH_MAX + 1]; + if (!perflibGetObjectCounter(pDataBlock, pObjectType, &ac->ADCSChallengeResponseResponsesTotal)) { + return; + } + + if (!ac->st_adcs_challenge_responses_total) { + snprintfz(id, RRD_ID_LENGTH_MAX, "cert_%s_challenge_responses", ac->name); + ac->st_adcs_challenge_responses_total = rrdset_create_localhost( + "adcs", + id, + NULL, + "responses", + "adcs.cert_challenge_responses", + "Certificate challenge responses", + "responses/s", + PLUGIN_WINDOWS_NAME, + "PerflibADCS", + PRIO_ADCS_CERT_CHALLENGE_RESPONSES, + update_every, + RRDSET_TYPE_LINE); + + ac->rd_adcs_challenge_responses_total = + rrddim_add(ac->st_adcs_challenge_responses_total, "challenge", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); + + rrdlabels_add(ac->st_adcs_challenge_responses_total->rrdlabels, "cert", ac->name, RRDLABEL_SRC_AUTO); + } + + rrddim_set_by_pointer( + ac->st_adcs_challenge_responses_total, + ac->rd_adcs_challenge_responses_total, + (collected_number)ac->ADCSChallengeResponseResponsesTotal.current.Data); + rrdset_done(ac->st_adcs_challenge_responses_total); +} + +static void netdata_adcs_retrieval_processing( + struct adcs_certificate *ac, + PERF_DATA_BLOCK *pDataBlock, + PERF_OBJECT_TYPE *pObjectType, + int update_every) +{ + char id[RRD_ID_LENGTH_MAX + 1]; + if (!perflibGetObjectCounter(pDataBlock, pObjectType, &ac->ADCSRetrievalsProcessingTime)) { + return; + } + + if (!ac->st_adcs_challenge_response_processing_time_seconds) { + snprintfz(id, RRD_ID_LENGTH_MAX, "cert_%s_retrievals_processing_time", ac->name); + ac->st_adcs_challenge_response_processing_time_seconds = rrdset_create_localhost( + "adcs", + id, + NULL, + "retrievals", + "adcs.cert_retrieval_processing_time", + "Certificate last retrieval processing time", + "seconds", + PLUGIN_WINDOWS_NAME, + "PerflibADCS", + PRIO_ADCS_CERT_RETRIEVAL_PROCESSING_TIME, + update_every, + RRDSET_TYPE_LINE); + + ac->rd_adcs_challenge_response_processing_time_seconds = rrddim_add( + ac->st_adcs_challenge_response_processing_time_seconds, + "processing_time", + NULL, + 1, + 1000, + RRD_ALGORITHM_ABSOLUTE); + + rrdlabels_add( + ac->st_adcs_challenge_response_processing_time_seconds->rrdlabels, "cert", ac->name, RRDLABEL_SRC_AUTO); + } + + rrddim_set_by_pointer( + ac->st_adcs_challenge_response_processing_time_seconds, + ac->rd_adcs_challenge_response_processing_time_seconds, + (collected_number)ac->ADCSRetrievalsProcessingTime.current.Data); + rrdset_done(ac->st_adcs_challenge_response_processing_time_seconds); +} + +static void netdata_adcs_crypto_singing_time( + struct adcs_certificate *ac, + PERF_DATA_BLOCK *pDataBlock, + PERF_OBJECT_TYPE *pObjectType, + int update_every) +{ + char id[RRD_ID_LENGTH_MAX + 1]; + if (!perflibGetObjectCounter(pDataBlock, pObjectType, &ac->ADCSRetrievalsProcessingTime)) { + return; + } + + if (!ac->st_adcs_request_cryptographic_signing_time_seconds) { + snprintfz(id, RRD_ID_LENGTH_MAX, "cert_%s_request_cryptographic_signing_time", ac->name); + ac->st_adcs_request_cryptographic_signing_time_seconds = rrdset_create_localhost( + "adcs", + id, + NULL, + "timings", + "adcs.cert_request_cryptographic_signing_time", + "Certificate last signing operation request time", + "seconds", + PLUGIN_WINDOWS_NAME, + "PerflibADCS", + PRIO_ADCS_CERT_REQ_CRYPTO_SIGNING_TIME, + update_every, + RRDSET_TYPE_LINE); + + ac->rd_adcs_request_cryptographic_signing_time_seconds = rrddim_add( + ac->st_adcs_request_cryptographic_signing_time_seconds, + "singing_time", + NULL, + 1, + 1000, + RRD_ALGORITHM_ABSOLUTE); + + rrdlabels_add( + ac->st_adcs_request_cryptographic_signing_time_seconds->rrdlabels, "cert", ac->name, RRDLABEL_SRC_AUTO); + } + + rrddim_set_by_pointer( + ac->st_adcs_request_cryptographic_signing_time_seconds, + ac->rd_adcs_request_cryptographic_signing_time_seconds, + (collected_number)ac->ADCSRetrievalsProcessingTime.current.Data); + rrdset_done(ac->st_adcs_request_cryptographic_signing_time_seconds); +} + +static void netdata_adcs_policy_mod_processing_time( + struct adcs_certificate *ac, + PERF_DATA_BLOCK *pDataBlock, + PERF_OBJECT_TYPE *pObjectType, + int update_every) +{ + char id[RRD_ID_LENGTH_MAX + 1]; + if (!perflibGetObjectCounter(pDataBlock, pObjectType, &ac->ADCSRequestPolicyModuleProcessingTime)) { + return; + } + + if (!ac->st_adcs_request_policy_module_processing_time_seconds) { + snprintfz(id, RRD_ID_LENGTH_MAX, "cert_%s_request_policy_module_processing_time", ac->name); + ac->st_adcs_request_policy_module_processing_time_seconds = rrdset_create_localhost( + "adcs", + id, + NULL, + "timings", + "adcs.cert_request_policy_module_processing", + "Certificate last policy module processing request time", + "seconds", + PLUGIN_WINDOWS_NAME, + "PerflibADCS", + PRIO_ADCS_CERT_REQ_POLICY_MODULE_PROCESS_TIME, + update_every, + RRDSET_TYPE_LINE); + + ac->rd_adcs_request_policy_module_processing_time_seconds = rrddim_add( + ac->st_adcs_request_policy_module_processing_time_seconds, + "processing_time", + NULL, + 1, + 1000, + RRD_ALGORITHM_ABSOLUTE); + + rrdlabels_add( + ac->st_adcs_request_policy_module_processing_time_seconds->rrdlabels, "cert", ac->name, RRDLABEL_SRC_AUTO); + } + + rrddim_set_by_pointer( + ac->st_adcs_request_policy_module_processing_time_seconds, + ac->rd_adcs_request_policy_module_processing_time_seconds, + (collected_number)ac->ADCSRequestPolicyModuleProcessingTime.current.Data); + rrdset_done(ac->st_adcs_request_policy_module_processing_time_seconds); +} + +static void netdata_adcs_challenge_response_processing_time( + struct adcs_certificate *ac, + PERF_DATA_BLOCK *pDataBlock, + PERF_OBJECT_TYPE *pObjectType, + int update_every) +{ + char id[RRD_ID_LENGTH_MAX + 1]; + if (!perflibGetObjectCounter(pDataBlock, pObjectType, &ac->ADCSChallengeResponseProcessingTime)) { + return; + } + + if (!ac->st_adcs_challenge_response_processing_time_seconds) { + snprintfz(id, RRD_ID_LENGTH_MAX, "cert_%s_challenge_response_processing_time", ac->name); + ac->st_adcs_challenge_response_processing_time_seconds = rrdset_create_localhost( + "adcs", + id, + NULL, + "timings", + "adcs.cert_challenge_response_processing_time", + "Certificate last challenge response time", + "seconds", + PLUGIN_WINDOWS_NAME, + "PerflibADCS", + PRIO_ADCS_CERT_CHALLENGE_RESP_PROCESSING_TIME, + update_every, + RRDSET_TYPE_LINE); + + ac->rd_adcs_challenge_response_processing_time_seconds = rrddim_add( + ac->st_adcs_challenge_response_processing_time_seconds, + "processing_time", + NULL, + 1, + 1000, + RRD_ALGORITHM_ABSOLUTE); + + rrdlabels_add( + ac->st_adcs_challenge_response_processing_time_seconds->rrdlabels, "cert", ac->name, RRDLABEL_SRC_AUTO); + } + + rrddim_set_by_pointer( + ac->st_adcs_challenge_response_processing_time_seconds, + ac->rd_adcs_challenge_response_processing_time_seconds, + (collected_number)ac->ADCSChallengeResponseProcessingTime.current.Data); + rrdset_done(ac->st_adcs_challenge_response_processing_time_seconds); +} + +static void netdata_adcs_signed_certificate_timetamp_list( + struct adcs_certificate *ac, + PERF_DATA_BLOCK *pDataBlock, + PERF_OBJECT_TYPE *pObjectType, + int update_every) +{ + char id[RRD_ID_LENGTH_MAX + 1]; + if (!perflibGetObjectCounter(pDataBlock, pObjectType, &ac->ADCSSignedCertTimestampListsTotal)) { + return; + } + + if (!ac->st_adcs_signed_certificate_timestamp_lists_total) { + snprintfz(id, RRD_ID_LENGTH_MAX, "cert_%s_signed_certificate_timestamp_lists", ac->name); + ac->st_adcs_signed_certificate_timestamp_lists_total = rrdset_create_localhost( + "adcs", + id, + NULL, + "timings", + "adcs.cert_signed_certificate_timestamp_lists", + "Certificate Signed Certificate Timestamp Lists processed", + "lists/s", + PLUGIN_WINDOWS_NAME, + "PerflibADCS", + PRIO_ADCS_CERT_SIGNED_CERTIFICATE_TIMESTAMP_LIST, + update_every, + RRDSET_TYPE_LINE); + + ac->rd_adcs_signed_certificate_timestamp_lists_total = rrddim_add( + ac->st_adcs_signed_certificate_timestamp_lists_total, + "processing_time", + NULL, + 1, + 1, + RRD_ALGORITHM_INCREMENTAL); + + rrdlabels_add( + ac->st_adcs_signed_certificate_timestamp_lists_total->rrdlabels, "cert", ac->name, RRDLABEL_SRC_AUTO); + } + + rrddim_set_by_pointer( + ac->st_adcs_signed_certificate_timestamp_lists_total, + ac->rd_adcs_signed_certificate_timestamp_lists_total, + (collected_number)ac->ADCSSignedCertTimestampListsTotal.current.Data); + rrdset_done(ac->st_adcs_signed_certificate_timestamp_lists_total); +} + +static void netdata_adcs_signed_certificate_timetamp_list_processing( + struct adcs_certificate *ac, + PERF_DATA_BLOCK *pDataBlock, + PERF_OBJECT_TYPE *pObjectType, + int update_every) +{ + char id[RRD_ID_LENGTH_MAX + 1]; + if (!perflibGetObjectCounter(pDataBlock, pObjectType, &ac->ADCSSignedCertTimestampListProcessingTime)) { + return; + } + + if (!ac->st_adcs_signed_certificate_timestamp_list_processing_time_seconds) { + snprintfz(id, RRD_ID_LENGTH_MAX, "cert_%s_signed_certificate_timestamp_list_processing_time", ac->name); + ac->st_adcs_signed_certificate_timestamp_list_processing_time_seconds = rrdset_create_localhost( + "adcs", + id, + NULL, + "timings", + "adcs.cert_signed_certificate_timestamp_list_processing_time", + "Certificate last Signed Certificate Timestamp List process time", + "seconds", + PLUGIN_WINDOWS_NAME, + "PerflibADCS", + PRIO_ADCS_CERT_SIGNED_CERTIFICATE_TIMESTAMP_PROC_TIME_LIST, + update_every, + RRDSET_TYPE_LINE); + + ac->rd_adcs_signed_certificate_timestamp_list_processing_time_seconds = rrddim_add( + ac->st_adcs_signed_certificate_timestamp_list_processing_time_seconds, + "processing_time", + NULL, + 1, + 1000, + RRD_ALGORITHM_ABSOLUTE); + + rrdlabels_add( + ac->st_adcs_signed_certificate_timestamp_list_processing_time_seconds->rrdlabels, + "cert", + ac->name, + RRDLABEL_SRC_AUTO); + } + + rrddim_set_by_pointer( + ac->st_adcs_signed_certificate_timestamp_list_processing_time_seconds, + ac->rd_adcs_signed_certificate_timestamp_list_processing_time_seconds, + (collected_number)ac->ADCSSignedCertTimestampListProcessingTime.current.Data); + rrdset_done(ac->st_adcs_signed_certificate_timestamp_list_processing_time_seconds); +} + +static bool do_ADCS(PERF_DATA_BLOCK *pDataBlock, int update_every) +{ + PERF_OBJECT_TYPE *pObjectType = perflibFindObjectTypeByName(pDataBlock, "Certification Authority"); + if (!pObjectType) + return false; + + static void (*doADCS[])(struct adcs_certificate *, PERF_DATA_BLOCK *, PERF_OBJECT_TYPE *, int) = { + netdata_adcs_requests, + netdata_adcs_requests_processing_time, + netdata_adcs_retrievals, + netdata_adcs_failed_requets, + netdata_adcs_issued_requets, + netdata_adcs_pending_requets, + + netdata_adcs_challenge_response, + + netdata_adcs_retrieval_processing, + + netdata_adcs_crypto_singing_time, + netdata_adcs_policy_mod_processing_time, + netdata_adcs_challenge_response_processing_time, + netdata_adcs_signed_certificate_timetamp_list, + netdata_adcs_signed_certificate_timetamp_list_processing, + netdata_adcs_retrieval_processing, + + // This must be the end + NULL}; + + PERF_INSTANCE_DEFINITION *pi = NULL; + for (LONG i = 0; i < pObjectType->NumInstances; i++) { + pi = perflibForEachInstance(pDataBlock, pObjectType, pi); + if (!pi) + break; + + if (!getInstanceName(pDataBlock, pObjectType, pi, windows_shared_buffer, sizeof(windows_shared_buffer))) + strncpyz(windows_shared_buffer, "[unknown]", sizeof(windows_shared_buffer) - 1); + + if (strcasecmp(windows_shared_buffer, "_Total") == 0) + continue; + + struct adcs_certificate *ptr = dictionary_set(adcs_certificates, windows_shared_buffer, NULL, sizeof(*ptr)); + + for (int i = 0; doADCS[i]; i++) + doADCS[i](ptr, pDataBlock, pObjectType, update_every); + } + + return true; +} + +int do_PerflibADCS(int update_every, usec_t dt __maybe_unused) +{ + static bool initialized = false; + + if (unlikely(!initialized)) { + initialize(); + initialized = true; + } + + DWORD id = RegistryFindIDByName("Certification Authority"); + if (id == PERFLIB_REGISTRY_NAME_NOT_FOUND) + return -1; + + PERF_DATA_BLOCK *pDataBlock = perflibGetPerformanceData(id); + if (!pDataBlock) + return -1; + + do_ADCS(pDataBlock, update_every); + + return 0; +} diff --git a/src/collectors/windows.plugin/windows_plugin.c b/src/collectors/windows.plugin/windows_plugin.c index f1c82421d760ba..e84f171973b0d1 100644 --- a/src/collectors/windows.plugin/windows_plugin.c +++ b/src/collectors/windows.plugin/windows_plugin.c @@ -13,39 +13,53 @@ static struct proc_module { } win_modules[] = { // system metrics - {.name = "GetSystemUptime", .dim = "GetSystemUptime", .enabled = CONFIG_BOOLEAN_YES, .func = do_GetSystemUptime}, - {.name = "GetSystemRAM", .dim = "GetSystemRAM", .enabled = CONFIG_BOOLEAN_YES, .func = do_GetSystemRAM}, + {.name = "GetSystemUptime", .dim = "GetSystemUptime", .enabled = CONFIG_BOOLEAN_YES, .func = do_GetSystemUptime}, + {.name = "GetSystemRAM", .dim = "GetSystemRAM", .enabled = CONFIG_BOOLEAN_YES, .func = do_GetSystemRAM}, // the same is provided by PerflibProcessor, with more detailed analysis //{.name = "GetSystemCPU", .dim = "GetSystemCPU", .enabled = CONFIG_BOOLEAN_YES, .func = do_GetSystemCPU}, - {.name = "PerflibProcesses", .dim = "PerflibProcesses", .enabled = CONFIG_BOOLEAN_YES, .func = do_PerflibProcesses}, - {.name = "PerflibProcessor", .dim = "PerflibProcessor", .enabled = CONFIG_BOOLEAN_YES, .func = do_PerflibProcessor}, - {.name = "PerflibMemory", .dim = "PerflibMemory", .enabled = CONFIG_BOOLEAN_YES, .func = do_PerflibMemory}, - {.name = "PerflibStorage", .dim = "PerflibStorage", .enabled = CONFIG_BOOLEAN_YES, .func = do_PerflibStorage}, - {.name = "PerflibNetwork", .dim = "PerflibNetwork", .enabled = CONFIG_BOOLEAN_YES, .func = do_PerflibNetwork}, - {.name = "PerflibObjects", .dim = "PerflibObjects", .enabled = CONFIG_BOOLEAN_YES, .func = do_PerflibObjects}, - {.name = "PerflibHyperV", .dim = "PerflibHyperV", .enabled = CONFIG_BOOLEAN_YES, .func = do_PerflibHyperV}, + {.name = "PerflibProcesses", .dim = "PerflibProcesses", .enabled = CONFIG_BOOLEAN_YES, .func = do_PerflibProcesses}, + {.name = "PerflibProcessor", .dim = "PerflibProcessor", .enabled = CONFIG_BOOLEAN_YES, .func = do_PerflibProcessor}, + {.name = "PerflibMemory", .dim = "PerflibMemory", .enabled = CONFIG_BOOLEAN_YES, .func = do_PerflibMemory}, + {.name = "PerflibStorage", .dim = "PerflibStorage", .enabled = CONFIG_BOOLEAN_YES, .func = do_PerflibStorage}, + {.name = "PerflibNetwork", .dim = "PerflibNetwork", .enabled = CONFIG_BOOLEAN_YES, .func = do_PerflibNetwork}, + {.name = "PerflibObjects", .dim = "PerflibObjects", .enabled = CONFIG_BOOLEAN_YES, .func = do_PerflibObjects}, + {.name = "PerflibHyperV", .dim = "PerflibHyperV", .enabled = CONFIG_BOOLEAN_YES, .func = do_PerflibHyperV}, - {.name = "PerflibThermalZone", .dim = "PerflibThermalZone", .enabled = CONFIG_BOOLEAN_NO, .func = do_PerflibThermalZone}, + {.name = "PerflibThermalZone", + .dim = "PerflibThermalZone", + .enabled = CONFIG_BOOLEAN_NO, + .func = do_PerflibThermalZone}, - {.name = "PerflibWebService", .dim = "PerflibWebService", .enabled = CONFIG_BOOLEAN_YES, .func = do_PerflibWebService}, - {.name = "PerflibMSSQL", .dim = "PerflibMSSQL", .enabled = CONFIG_BOOLEAN_YES, .func = do_PerflibMSSQL}, + {.name = "PerflibWebService", + .dim = "PerflibWebService", + .enabled = CONFIG_BOOLEAN_YES, + .func = do_PerflibWebService}, + {.name = "PerflibMSSQL", .dim = "PerflibMSSQL", .enabled = CONFIG_BOOLEAN_YES, .func = do_PerflibMSSQL}, - {.name = "PerflibNetFramework", .dim = "PerflibNetFramework", .enabled = CONFIG_BOOLEAN_YES, .func = do_PerflibNetFramework}, - {.name = "PerflibAD", .dim = "PerflibAD", .enabled = CONFIG_BOOLEAN_YES, .func = do_PerflibAD}, + {.name = "PerflibNetFramework", + .dim = "PerflibNetFramework", + .enabled = CONFIG_BOOLEAN_YES, + .func = do_PerflibNetFramework}, + {.name = "PerflibAD", .dim = "PerflibAD", .enabled = CONFIG_BOOLEAN_YES, .func = do_PerflibAD}, + + {.name = "PerflibADCS", .dim = "PerflibADCS", .enabled = CONFIG_BOOLEAN_YES, .func = do_PerflibADCS}, + + {.name = "PerflibADCS", .dim = "PerflibADCS", .enabled = CONFIG_BOOLEAN_YES, .func = do_PerflibADCS}, // the terminator of this array - {.name = NULL, .dim = NULL, .func = NULL} -}; + {.name = NULL, .dim = NULL, .func = NULL}}; #if WORKER_UTILIZATION_MAX_JOB_TYPES < 36 #error WORKER_UTILIZATION_MAX_JOB_TYPES has to be at least 36 #endif -static void windows_main_cleanup(void *pptr) { +static void windows_main_cleanup(void *pptr) +{ struct netdata_static_thread *static_thread = CLEANUP_FUNCTION_GET_PTR(pptr); - if(!static_thread) return; + if (!static_thread) + return; static_thread->enabled = NETDATA_MAIN_THREAD_EXITING; @@ -54,13 +68,15 @@ static void windows_main_cleanup(void *pptr) { worker_unregister(); } -static bool log_windows_module(BUFFER *wb, void *data) { +static bool log_windows_module(BUFFER *wb, void *data) +{ struct proc_module *pm = data; buffer_sprintf(wb, PLUGIN_WINDOWS_NAME "[%s]", pm->name); return true; } -void *win_plugin_main(void *ptr) { +void *win_plugin_main(void *ptr) +{ worker_register("WIN"); rrd_collector_started(); @@ -70,7 +86,7 @@ void *win_plugin_main(void *ptr) { // check the enabled status for each module int i; - for(i = 0; win_modules[i].name; i++) { + for (i = 0; win_modules[i].name; i++) { struct proc_module *pm = &win_modules[i]; pm->enabled = config_get_boolean("plugin:windows", pm->name, pm->enabled); @@ -90,21 +106,21 @@ void *win_plugin_main(void *ptr) { }; ND_LOG_STACK_PUSH(lgs); - while(service_running(SERVICE_COLLECTORS)) { + while (service_running(SERVICE_COLLECTORS)) { worker_is_idle(); usec_t hb_dt = heartbeat_next(&hb); - if(unlikely(!service_running(SERVICE_COLLECTORS))) + if (unlikely(!service_running(SERVICE_COLLECTORS))) break; PerflibNamesRegistryUpdate(); - for(i = 0; win_modules[i].name; i++) { - if(unlikely(!service_running(SERVICE_COLLECTORS))) + for (i = 0; win_modules[i].name; i++) { + if (unlikely(!service_running(SERVICE_COLLECTORS))) break; struct proc_module *pm = &win_modules[i]; - if(unlikely(!pm->enabled)) + if (unlikely(!pm->enabled)) continue; worker_is_busy(i); diff --git a/src/collectors/windows.plugin/windows_plugin.h b/src/collectors/windows.plugin/windows_plugin.h index 73344528d4ddd0..65aff48d85461a 100644 --- a/src/collectors/windows.plugin/windows_plugin.h +++ b/src/collectors/windows.plugin/windows_plugin.h @@ -29,6 +29,7 @@ int do_PerflibWebService(int update_every, usec_t dt); int do_PerflibMSSQL(int update_every, usec_t dt); int do_PerflibNetFramework(int update_every, usec_t dt); int do_PerflibAD(int update_every, usec_t dt); +int do_PerflibADCS(int update_every, usec_t dt); enum PERFLIB_PRIO { PRIO_WEBSITE_IIS_REQUESTS_RATE = 21000, // PRIO selected, because APPS is using 20YYY @@ -122,8 +123,8 @@ enum PERFLIB_PRIO { PRIO_AD_DIROPERATIONS_TOTAL, PRIO_AD_CACHE_LOOKUP_TOTAL, PRIO_AD_CACHE_HITS_TOTAL, - PRIO_AD_REPLICATION_INTERSITE_COMPRESSED, PRIO_AD_REPLICATION_INTRASITE_COMPRESSED, + PRIO_AD_REPLICATION_INTERSITE_COMPRESSED, PRIO_AD_SYNC_OBJECTS_REMAINING, PRIO_AD_REPLICATION_PROPERTY_UPDATED, PRIO_AD_REPLICATION_PROPERTY_FILTERED, @@ -134,7 +135,21 @@ enum PERFLIB_PRIO { PRIO_AD_BIND_TOTAL, PRIO_AD_LDAP_SEARCHES_TOTAL, PRIO_AD_AVG_REQUEST_LATENCY, - PRIO_AD_OUTSTANDING_REQUEST + PRIO_AD_OUTSTANDING_REQUEST, + + PRIO_ADCS_CERT_REQUESTS_TOTAL, + PRIO_ADCS_CERT_REQUESTS_PROCESSING_TIME, + PRIO_ADCS_CERT_RETRIVALS, + PRIO_ADCS_CERT_FAILED_REQUESTS, + PRIO_ADCS_CERT_ISSUED_REQUESTS, + PRIO_ADCS_CERT_PENDING_REQUESTS, + PRIO_ADCS_CERT_CHALLENGE_RESPONSES, + PRIO_ADCS_CERT_RETRIEVAL_PROCESSING_TIME, + PRIO_ADCS_CERT_REQ_CRYPTO_SIGNING_TIME, + PRIO_ADCS_CERT_REQ_POLICY_MODULE_PROCESS_TIME, + PRIO_ADCS_CERT_CHALLENGE_RESP_PROCESSING_TIME, + PRIO_ADCS_CERT_SIGNED_CERTIFICATE_TIMESTAMP_LIST, + PRIO_ADCS_CERT_SIGNED_CERTIFICATE_TIMESTAMP_PROC_TIME_LIST }; int do_PerflibHyperV(int update_every, usec_t dt); From d35dcc38236f03f8ac846cd294df1807f629af81 Mon Sep 17 00:00:00 2001 From: Stelios Fragkakis <52996999+stelfrag@users.noreply.github.com> Date: Fri, 31 Jan 2025 18:04:06 +0200 Subject: [PATCH 08/10] Fix cloud connect after claim (#19547) --- src/aclk/aclk.c | 11 ++++-- src/aclk/aclk.h | 2 +- src/database/sqlite/sqlite_aclk.c | 56 +++++++++++++-------------- src/database/sqlite/sqlite_metadata.c | 14 +++---- src/database/sqlite/sqlite_metadata.h | 2 +- 5 files changed, 45 insertions(+), 40 deletions(-) diff --git a/src/aclk/aclk.c b/src/aclk/aclk.c index 61c1a4b5c4c342..cd1369a5eda12c 100644 --- a/src/aclk/aclk.c +++ b/src/aclk/aclk.c @@ -1002,12 +1002,15 @@ void aclk_host_state_update(RRDHOST *host, int cmd, int queryable) aclk_add_job(query); } -void aclk_send_node_instances() +void aclk_send_node_instances(mqtt_wss_client client) { struct node_instance_list *list_head = get_node_list(); struct node_instance_list *list = list_head; if (unlikely(!list)) { error_report("Failure to get_node_list from DB!"); + sleep_usec(USEC_PER_SEC); + aclk_query_t query = aclk_query_new(SEND_NODE_INSTANCES); + aclk_add_job(query); return; } while (!uuid_is_null(list->host_id)) { @@ -1045,7 +1048,8 @@ void aclk_send_node_instances() freez((void*)node_state_update.node_id); query->data.bin_payload.msg_name = "UpdateNodeInstanceConnection"; query->data.bin_payload.topic = ACLK_TOPICID_NODE_CONN; - aclk_add_job(query); + send_bin_msg(client, query); + aclk_query_free(query); } else { aclk_query_t create_query; create_query = aclk_query_new(REGISTER_NODE); @@ -1067,7 +1071,8 @@ void aclk_send_node_instances() (char*)node_instance_creation.machine_guid, list->hops); freez((void *)node_instance_creation.machine_guid); - aclk_add_job(create_query); + send_bin_msg(client, create_query); + aclk_query_free(create_query); } freez(list->hostname); diff --git a/src/aclk/aclk.h b/src/aclk/aclk.h index d3e93bb40cd65f..ff09434ca7aad5 100644 --- a/src/aclk/aclk.h +++ b/src/aclk/aclk.h @@ -96,7 +96,7 @@ extern struct aclk_shared_state { void aclk_host_state_update(RRDHOST *host, int cmd, int queryable); bool aclk_host_state_update_auto(RRDHOST *host); -void aclk_send_node_instances(void); +void aclk_send_node_instances(mqtt_wss_client client); void aclk_send_bin_msg(char *msg, size_t msg_len, enum aclk_topics subtopic, const char *msgname); diff --git a/src/database/sqlite/sqlite_aclk.c b/src/database/sqlite/sqlite_aclk.c index 3f9f07fc01f2cd..317d1d9df70805 100644 --- a/src/database/sqlite/sqlite_aclk.c +++ b/src/database/sqlite/sqlite_aclk.c @@ -13,7 +13,7 @@ void sanity_check(void) { #include "../aclk_query.h" #include "../aclk_capas.h" -static void create_node_instance_result_job(const char *machine_guid, const char *node_id) +static void create_node_instance_result_job(mqtt_wss_client client __maybe_unused, const char *machine_guid, const char *node_id) { nd_uuid_t host_uuid, node_uuid; @@ -32,33 +32,33 @@ static void create_node_instance_result_job(const char *machine_guid, const char netdata_log_error("Cannot find machine_guid provided by CreateNodeInstanceResult"); return; } - sql_update_node_id(&host_uuid, &node_uuid); - - aclk_query_t query = aclk_query_new(NODE_STATE_UPDATE); - node_instance_connection_t node_state_update = { - .hops = 1, - .live = 0, - .queryable = 1, - .session_id = aclk_session_newarch, - .node_id = node_id, - .capabilities = NULL}; - - node_state_update.live = rrdhost_is_local(host) ? 1 : 0; - node_state_update.hops = rrdhost_ingestion_hops(host); - node_state_update.capabilities = aclk_get_node_instance_capas(host); schedule_node_state_update(host, 5000); - - CLAIM_ID claim_id = claim_id_get(); - node_state_update.claim_id = claim_id_is_set(claim_id) ? claim_id.str : NULL; - query->data.bin_payload.payload = generate_node_instance_connection(&query->data.bin_payload.size, &node_state_update); - - freez((void *)node_state_update.capabilities); - - query->data.bin_payload.msg_name = "UpdateNodeInstanceConnection"; - query->data.bin_payload.topic = ACLK_TOPICID_NODE_CONN; - - aclk_add_job(query); +// +// aclk_query_t query = aclk_query_new(NODE_STATE_UPDATE); +// node_instance_connection_t node_state_update = { +// .hops = 1, +// .live = 0, +// .queryable = 1, +// .session_id = aclk_session_newarch, +// .node_id = node_id, +// .capabilities = NULL}; +// +// node_state_update.live = rrdhost_is_local(host) ? 1 : 0; +// node_state_update.hops = rrdhost_ingestion_hops(host); +// node_state_update.capabilities = aclk_get_node_instance_capas(host); +// schedule_node_state_update(host, 5000); +// +// CLAIM_ID claim_id = claim_id_get(); +// node_state_update.claim_id = claim_id_is_set(claim_id) ? claim_id.str : NULL; +// query->data.bin_payload.payload = generate_node_instance_connection(&query->data.bin_payload.size, &node_state_update); +// +// freez((void *)node_state_update.capabilities); +// +// query->data.bin_payload.msg_name = "UpdateNodeInstanceConnection"; +// query->data.bin_payload.topic = ACLK_TOPICID_NODE_CONN; +// +// aclk_add_job(query); } struct aclk_sync_config_s { @@ -395,7 +395,7 @@ static void aclk_run_query(struct aclk_sync_config_s *config, aclk_query_t query break; case SEND_NODE_INSTANCES: worker_is_busy(UV_EVENT_SEND_NODE_INSTANCES); - aclk_send_node_instances(); + aclk_send_node_instances(config->client); ok_to_send = false; break; case ALERT_START_STREAMING: @@ -410,7 +410,7 @@ static void aclk_run_query(struct aclk_sync_config_s *config, aclk_query_t query break; case CREATE_NODE_INSTANCE: worker_is_busy(UV_EVENT_CREATE_NODE_INSTANCE); - create_node_instance_result_job(query->machine_guid, query->data.node_id); + create_node_instance_result_job(config->client, query->machine_guid, query->data.node_id); ok_to_send = false; break; diff --git a/src/database/sqlite/sqlite_metadata.c b/src/database/sqlite/sqlite_metadata.c index 7e5ba2703d6c1a..0169d8d09ef685 100644 --- a/src/database/sqlite/sqlite_metadata.c +++ b/src/database/sqlite/sqlite_metadata.c @@ -420,11 +420,10 @@ bool sql_set_host_label(nd_uuid_t *host_id, const char *label_key, const char *l #define SQL_UPDATE_NODE_ID "UPDATE node_instance SET node_id = @node_id WHERE host_id = @host_id" -int sql_update_node_id(nd_uuid_t *host_id, nd_uuid_t *node_id) +void sql_update_node_id(nd_uuid_t *host_id, nd_uuid_t *node_id) { sqlite3_stmt *res = NULL; RRDHOST *host = NULL; - int rc = 2; char host_guid[GUID_LEN + 1]; uuid_unparse_lower(*host_id, host_guid); @@ -435,25 +434,23 @@ int sql_update_node_id(nd_uuid_t *host_id, nd_uuid_t *node_id) rrd_wrunlock(); if (!REQUIRE_DB(db_meta)) - return 1; + return; if (!PREPARE_STATEMENT(db_meta, SQL_UPDATE_NODE_ID, &res)) - return 1; + return; int param = 0; SQLITE_BIND_FAIL(done, sqlite3_bind_blob(res, ++param, node_id, sizeof(*node_id), SQLITE_STATIC)); SQLITE_BIND_FAIL(done, sqlite3_bind_blob(res, ++param, host_id, sizeof(*host_id), SQLITE_STATIC)); param = 0; - rc = execute_insert(res); + int rc = sqlite3_step_monitored(res); if (unlikely(rc != SQLITE_DONE)) error_report("Failed to store node instance information, rc = %d", rc); - rc = sqlite3_changes(db_meta); done: REPORT_BIND_FAIL(res, param); SQLITE_FINALIZE(res); - return rc - 1; } #define SQL_SELECT_NODE_ID "SELECT node_id FROM node_instance WHERE host_id = @host_id AND node_id IS NOT NULL" @@ -534,6 +531,9 @@ struct node_instance_list *get_node_list(void) while (sqlite3_step_monitored(res) == SQLITE_ROW) row++; + if (row == 0) + return NULL; + if (sqlite3_reset(res) != SQLITE_OK) { error_report("Failed to reset the prepared statement while fetching node instance information"); goto failed; diff --git a/src/database/sqlite/sqlite_metadata.h b/src/database/sqlite/sqlite_metadata.h index 353501541d1301..1924d23ea2f054 100644 --- a/src/database/sqlite/sqlite_metadata.h +++ b/src/database/sqlite/sqlite_metadata.h @@ -48,7 +48,7 @@ void vacuum_database(sqlite3 *database, const char *db_alias, int threshold, int int sql_metadata_cache_stats(int op); int get_node_id(nd_uuid_t *host_id, nd_uuid_t *node_id); -int sql_update_node_id(nd_uuid_t *host_id, nd_uuid_t *node_id); +void sql_update_node_id(nd_uuid_t *host_id, nd_uuid_t *node_id); struct node_instance_list *get_node_list(void); void sql_load_node_id(RRDHOST *host); From b31bec86a2b5d6a5313aaeab1ec36e8c89bab965 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Van=C4=9Bk?= Date: Fri, 31 Jan 2025 19:18:26 +0100 Subject: [PATCH 09/10] fix(go.d/mysql): fix typo in test name (#19550) --- src/go/plugin/go.d/collector/mysql/collector_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/go/plugin/go.d/collector/mysql/collector_test.go b/src/go/plugin/go.d/collector/mysql/collector_test.go index 518976085792be..f48a7e3a91c089 100644 --- a/src/go/plugin/go.d/collector/mysql/collector_test.go +++ b/src/go/plugin/go.d/collector/mysql/collector_test.go @@ -278,7 +278,7 @@ func TestCollector_Collect(t *testing.T) { check func(t *testing.T, my *Collector) } tests := map[string][]testCaseStep{ - "MariaDB-Standalone[v5.5.46]: success on all queries": { + "MariaDB-Standalone[v5.5.64]: success on all queries": { { prepareMock: func(t *testing.T, m sqlmock.Sqlmock) { mockExpect(t, m, queryShowVersion, dataMariaVer5564Version) From 852e54aea7c78ddb25e79c9ac4c894b8e282f65d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Van=C4=9Bk?= Date: Fri, 31 Jan 2025 19:20:23 +0100 Subject: [PATCH 10/10] fix(go.d/mysql): don't collect global variables on every iteration (#19549) --- src/go/plugin/go.d/collector/mysql/collect.go | 1 + 1 file changed, 1 insertion(+) diff --git a/src/go/plugin/go.d/collector/mysql/collect.go b/src/go/plugin/go.d/collector/mysql/collect.go index 85677d7709b20a..2d34920eb15d98 100644 --- a/src/go/plugin/go.d/collector/mysql/collect.go +++ b/src/go/plugin/go.d/collector/mysql/collect.go @@ -57,6 +57,7 @@ func (c *Collector) collect() (map[string]int64, error) { if err := c.collectGlobalVariables(); err != nil { return nil, fmt.Errorf("error on collecting global variables: %v", err) } + c.recheckGlobalVarsTime = now } mx["max_connections"] = c.varMaxConns mx["table_open_cache"] = c.varTableOpenCache