zabbix安装包
zabbix安装包...
代码片段和文件信息
/*
** Zabbix
** Copyright (C) 2001-2018 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not write to the Free Software
** Foundation Inc. 51 Franklin Street Fifth Floor Boston MA 02110-1301 USA.
**/
#include
#include
#include “zabbix_sender.h“
/*
* This is a simple Zabbix sender utility implemented with
* Zabbix sender dynamic link library to illustrate the
* library usage.
*
* See zabbix_sender.h header file for API specifications.
*
* This utility can be built in Microsoft Windows 32 bit build
* environment with the following command: nmake /f Makefile
*
* To run this utility ensure that zabbix_sender.dll is
* available (either in current directory or in windows/system
* directories or in a directory defined in PATH variable)
*/
int main(int argc char *argv[])
{
if (5 == argc)
{
char *result = NULL;
zabbix_sender_info_t info;
zabbix_sender_value_t value = {argv[2] argv[3] argv[4]};
int response;
/* send one value to the argv[1] IP address and the default trapper port 10051 */
if (-1 == zabbix_sender_send_values(argv[1] 10051 NULL &value 1 &result))
{
printf(“sending failed: %s
“ result);
}
else
{
printf(“sending succeeded:
“);
/* parse the server response */
if (0 == zabbix_sender_parse_result(result &response &info))
{
printf(“ response: %s
“ 0 == response ? “success“ : “failed“);
printf(“ info from server: “processed: %d; failed: %d; total: %d; seconds spent: %lf“
“
info.total - info.failed info.failed info.total info.time_spent);
}
else
printf(“ failed to parse server response
“);
}
/* free the server response */
zabbix_sender_free_result(result);
}
else
{
printf(“Simple zabbix_sender implementation with zabbix_sender library
“);
printf(“usage: %s
“ argv[0]);
printf(“Options:
“);
printf(“ Hostname or IP address of Zabbix server
“);
printf(“ Host name
“);
printf(“ Item key
“);
printf(“ Item value
“);
}
return EXIT_SUCCESS;
}
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)