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);
char result);`{.c}

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

  1. typedef struct
  2. {
  3. /* host name, must match the name of target host in Zabbix */
  4. char *host;
  5. /* the item key */
  6. char *key;
  7. /* the item value */
  8. char *value;
  9. }
  10. zabbix_sender_value_t;
  11. typedef struct
  12. {
  13. /* number of total values processed */
  14. int total;
  15. /* number of failed values */
  16. int failed;
  17. /* time in seconds the server spent processing the sent values */
  18. double time_spent;
  19. }
  20. zabbix_sender_info_t;