Zabbix sender Windows动态链接库:In a Windows environment applications can send data to Zabbix server/proxy directly by using the Zabbix sender dynamic link library (zabbix_sender.dll) instead of having to launch an external process (zabbix_sender.exe).

在 Windows环境中,应用程序可以直接通过Zabbix sender 动态链接库向Zabbix server/proxy发送数据,而不用使用外部程序 (zabbix_sender.exe).The dynamic link library with the development files is located in bin\winXX\dev folders. To use it, include the zabbix_sender.h header file and link with the zabbix_sender.lib library. An example file with Zabbix sender API usage can be found in build\win32\examples\zabbix_sender folder.动态链接库和开发源文件的位置是bin\winXX\dev文件夹。要使用的话,需要加入zabbix_sender.h页眉文件并且链接zabbix_sender.lib库。使用Zabbix sender API的示例文件请查看:build\win32\examples\zabbix_sender 文件夹。The following functionality is provided by the Zabbix sender dynamic link library:以下列出了一些Zabbix sender动态链接库可以提供的的功能点



  1. int zabbixsender_send_values(const char address, unsigned short port,
    const char
    source, const zabbix_sender_value_t values, int count,
    char result);


Description
Sends an array of value structures to the proxy/server. A value structure contains host name, item key and item value.
Parameters
address* - [in] the server/proxy addressport - [in] the trapper port on the server/proxysource - [in] the source IP (optional)values - [in] an array of values to sendcount - [in] the number of items in values arrayresult - [out] the server response or an error message (optional)
Return value
0 - operation completed successfully-1 - operation failed
Comments
If the result variable is specified this function allocates the necessary memory to store server response/error message. It must be always freed afterwards with zabbix_sender_free_result() function.If operation was successful the result contains server response which can be parsed with zabbix_sender_parse_result() function. In the case of error the error message will be stored into result instead.


  1. int zabbix_sender_parse_result(const char result, int response,
    zabbix_sender_info_t info);


Description
Parses the result returned from zabbix_sender_send_values() function.
Parameters
*result - [in] the result returned by zabbix_sender_send_values() function.response - [out] the operation response: 0 - success, -1 failed.info - [out]_ the detailed information about operation, optional.
Return value
0 - operation completed successfully-1 - operation failed
Comments
If info parameter was specified, but the function failed to parse the result info field, then the info structure field total is set to -1.


  1. void zabbix_sender_free_result(void result);


Description
Frees data allocated by zabbix_sender_send_values() function.
Parameters
*result - the result returned by zabbix_sender_send_values() function.

The following data structures are used by the Zabbix sender dynamic link library:

  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.  
  12. typedef struct
  13. {
  14. /* number of total values processed */
  15. int total;
  16. /* number of failed values */
  17. int failed;
  18. /* time in seconds the server spent processing the sent values */
  19. double time_spent;
  20. }
  21. zabbix_sender_info_t;