-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add code template and basic facilities
- Loading branch information
Showing
7 changed files
with
115 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM gitpod/workspace-full | ||
|
||
USER gitpod | ||
|
||
RUN sudo apt-get -q update && \ | ||
sudo apt-get install -yq autoconf automake libcurl4-openssl-dev bear && \ | ||
sudo rm -rf /var/lib/apt/lists/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
tasks: | ||
- init: >- | ||
export ZABBIX_SOURCE="/workspace/zabbix" && | ||
git clone https://git.zabbix.com/scm/zbx/zabbix.git --depth 1 "$ZABBIX_SOURCE" && | ||
bear make | ||
image: | ||
file: .gitpod.Dockerfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
language: c | ||
compiler: | ||
- clang | ||
- gcc | ||
dist: xenial | ||
env: | ||
- BRANCH=master | ||
- BRANCH=release/5.4 | ||
- BRANCH=release/5.0 | ||
- BRANCH=release/4.0 | ||
before_script: | ||
- git clone https://git.zabbix.com/scm/zbx/zabbix.git --depth 1 --single-branch --branch $BRANCH | ||
script: | ||
- ZABBIX_SOURCE=zabbix CFLAGS='-Wall -Wextra -Wpedantic -g -O2' make |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"files.associations": { | ||
".h": "c" | ||
}, | ||
"[c]": { | ||
"editor.insertSpaces": false, | ||
"editor.tabSize": 8 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
CFLAGS:=-fPIC -I$(ZABBIX_SOURCE)/include $(CFLAGS) | ||
OBJECTS:=$(patsubst %.c,%.o,$(wildcard src/*.c)) | ||
|
||
sheepskin.so: $(OBJECTS) | ||
$(CC) $(OBJECTS) $(LDFLAGS) $(LIBS) `curl-config --libs` -shared -o $@ | ||
|
||
all: sheepskin.so | ||
|
||
clean: | ||
rm -rf $(OBJECTS) sheepskin.so |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#include <stdint.h> | ||
#include <stdlib.h> | ||
|
||
#include <curl/curl.h> | ||
|
||
#include "module.h" | ||
|
||
int sheep_item_timeout; | ||
|
||
int zbx_module_api_version(void) | ||
{ | ||
return ZBX_MODULE_API_VERSION; | ||
} | ||
|
||
void zbx_module_item_timeout(int timeout) | ||
{ | ||
sheep_item_timeout = timeout; | ||
} | ||
|
||
int zbx_module_init(void) | ||
{ | ||
int ret = ZBX_MODULE_OK; | ||
|
||
printf("Initializing \"sheepskin\" module...\n"); | ||
|
||
/* TODO */ | ||
|
||
if (ZBX_MODULE_OK == ret) | ||
printf("Module \"sheepskin\" has been successfully initialized.\n"); | ||
|
||
return ret; | ||
} | ||
|
||
int zbx_module_uninit(void) | ||
{ | ||
printf("Uninitializing \"sheepskin\" module...\n"); | ||
|
||
/* TODO */ | ||
|
||
printf("Module \"sheepskin\" has been successfully uninitialized.\n"); | ||
|
||
return ZBX_MODULE_OK; | ||
} | ||
|
||
static int sheep_web_certificate_get(AGENT_REQUEST *request, AGENT_RESULT *result) | ||
{ | ||
/* TODO */ | ||
SET_MSG_RESULT(result, NULL); | ||
return SYSINFO_RET_FAIL; | ||
} | ||
|
||
ZBX_METRIC *zbx_module_item_list(void) | ||
{ | ||
static ZBX_METRIC keys[] = | ||
/* KEY FLAG FUNCTION TEST PARAMETERS */ | ||
{ | ||
{"web.certificate.get", CF_HAVEPARAMS, sheep_web_certificate_get, "https://www.zabbix.com"}, | ||
{NULL} | ||
}; | ||
|
||
return keys; | ||
} |