Skip to content

Commit

Permalink
Query a URL
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonBaeumer committed Aug 29, 2024
1 parent 18fbe60 commit 64e0983
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
18 changes: 18 additions & 0 deletions collector/lib/CollectorService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ extern "C" {
#include "Utility.h"
#include "prometheus/exposer.h"
#include "system-inspector/Service.h"
#include "curl/curl.h"

extern unsigned char g_bpf_drop_syscalls[]; // defined in libscap

Expand Down Expand Up @@ -65,6 +66,9 @@ void CollectorService::RunForever() {
std::unique_ptr<NetworkStatusInspector> network_status_inspector;

CLOG(INFO) << "Network scrape interval set to " << config_.ScrapeInterval() << " seconds";

CLOG(INFO) << "HALLO DMITRII";
CollectorService::QueryKubelet();

if (config_.grpc_channel) {
CLOG(INFO) << "Waiting for Sensor to become ready ...";
Expand Down Expand Up @@ -138,6 +142,20 @@ void CollectorService::RunForever() {
system_inspector_.CleanUp();
}

void CollectorService::QueryKubelet() {
CLOG(INFO) << "Query Kubelet Example";
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
if (res) {
CLOG(INFO) << printf("response: %d\n", res);
}
}
}

bool CollectorService::InitKernel() {
return system_inspector_.InitKernel(config_);
}
Expand Down
2 changes: 2 additions & 0 deletions collector/lib/CollectorService.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ class CollectorService {
const std::atomic<int>& signum_;

system_inspector::Service system_inspector_;

void QueryKubelet();
};

bool SetupKernelDriver(CollectorService& collector, const std::string& GRPCServer, const CollectorConfig& config);
Expand Down
28 changes: 28 additions & 0 deletions pod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: "3.9"
services:
collector:
image: quay.io/stackrox-io/collector:3.19.x-61-g18fbe6077a-dirty
container_name: collector-debug
network_mode: host
privileged: true
environment:
- GRPC_SERVER=localhost:9999
- COLLECTOR_CONFIG={"logLevel":"info","turnOffScrape":true,"scrapeInterval":2}
- COLLECTION_METHOD=core-bpf
- COLLECTOR_HOST_ROOT=/host
volumes:
- /var/run/docker.sock:/host/var/run/docker.sock:ro
- /proc:/host/proc:ro
- /etc:/host/etc:ro
- /usr/lib:/host/usr/lib:ro
- /sys/:/host/sys/:ro
- /dev:/host/dev:ro
depends_on:
- grpc-server-debug
grpc-server-debug:
image: quay.io/rhacs-eng/grpc-server:4.3.8
container_name: grpc-server
network_mode: host
user: 1000:1000
volumes:
- /tmp:/tmp:rw

0 comments on commit 64e0983

Please sign in to comment.