13 Zabbix sender Windows 动态链接库

在 Windows 环境中,应用程序可以通过使用 Zabbix sender 动态链接库(zabbix_sender.dll)直接将数据发送到 Zabbix server/proxy,而不必启动外部进程(zabbix_sender.exe)。

包含开发文件的动态链接库位于bin\winXX\dev 文件夹中。要使用它,请包含 zabbix_sender.h 头文件并与 zabbix_sender.lib 库链接。可以在build\win32\examples\zabbix_sender 文件夹中找到使用Zabbix sender API 的示例文件。

Zabbix sender动态链接库提供以下函数:

int zabbix_sender_send_values(const char *address, unsigned short port,const char *source, const zabbix_sender_value_t *values, int count,char **result);{.c}
char **result);`{.c}

Zabbix sender 动态链接库使用以下数据结构:

typedef struct
{
    /* host name, must match the name of target host in Zabbix */
    char    *host;
    /* the item key */
    char    *key;
    /* the item value */
    char    *value;
}
zabbix_sender_value_t;

typedef struct
{
    /* number of total values processed */
    int total;
    /* number of failed values */
    int failed;
    /* time in seconds the server spent processing the sent values */
    double  time_spent;
}
zabbix_sender_info_t;