/**************************************************************************
*
* STATUS.C - Nagios Status CGI
*
*
* License:
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* 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 Tthis program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*************************************************************************/
#include "../include/config.h"
#include "../include/common.h"
#include "../include/objects.h"
#include "../include/comments.h"
#include "../include/macros.h"
#include "../include/statusdata.h"
#include "../include/cgiutils.h"
#include "../include/getcgi.h"
#include "../include/cgiauth.h"
extern int refresh_rate;
extern int result_limit;
extern char main_config_file[MAX_FILENAME_LENGTH];
extern char url_html_path[MAX_FILENAME_LENGTH];
extern char url_docs_path[MAX_FILENAME_LENGTH];
extern char url_images_path[MAX_FILENAME_LENGTH];
extern char url_stylesheets_path[MAX_FILENAME_LENGTH];
extern char url_logo_images_path[MAX_FILENAME_LENGTH];
extern char url_media_path[MAX_FILENAME_LENGTH];
extern char url_js_path[MAX_FILENAME_LENGTH];
extern char *service_critical_sound;
extern char *service_warning_sound;
extern char *service_unknown_sound;
extern char *host_down_sound;
extern char *host_unreachable_sound;
extern char *normal_sound;
extern char *notes_url_target;
extern char *action_url_target;
extern int suppress_alert_window;
extern int enable_splunk_integration;
extern int navbar_search_addresses;
extern int navbar_search_aliases;
extern hoststatus *hoststatus_list;
extern servicestatus *servicestatus_list;
static nagios_macros *mac;
#define MAX_MESSAGE_BUFFER 4096
#define DISPLAY_HOSTS 0
#define DISPLAY_HOSTGROUPS 1
#define DISPLAY_SERVICEGROUPS 2
#define STYLE_OVERVIEW 0
#define STYLE_DETAIL 1
#define STYLE_SUMMARY 2
#define STYLE_GRID 3
#define STYLE_HOST_DETAIL 4
/* HOSTSORT structure */
typedef struct hostsort_struct {
hoststatus *hststatus;
struct hostsort_struct *next;
} hostsort;
/* SERVICESORT structure */
typedef struct servicesort_struct {
servicestatus *svcstatus;
struct servicesort_struct *next;
} servicesort;
hostsort *hostsort_list = NULL;
servicesort *servicesort_list = NULL;
int sort_services(int, int); /* sorts services */
int sort_hosts(int, int); /* sorts hosts */
int compare_servicesort_entries(int, int, servicesort *, servicesort *); /* compares service sort entries */
int compare_hostsort_entries(int, int, hostsort *, hostsort *); /* compares host sort entries */
void free_servicesort_list(void);
void free_hostsort_list(void);
void show_host_status_totals(void);
void show_service_status_totals(void);
void show_service_detail(void);
void show_host_detail(void);
void show_servicegroup_overviews(void);
void show_servicegroup_overview(servicegroup *);
void show_servicegroup_summaries(void);
void show_servicegroup_summary(servicegroup *, int);
void show_servicegroup_host_totals_summary(servicegroup *);
void show_servicegroup_service_totals_summary(servicegroup *);
void show_servicegroup_grids(void);
void show_servicegroup_grid(servicegroup *);
void show_hostgroup_overviews(void);
void show_hostgroup_overview(hostgroup *);
void show_servicegroup_hostgroup_member_overview(hoststatus *, int, void *);
void show_servicegroup_hostgroup_member_service_status_totals(char *, void *);
void show_hostgroup_summaries(void);
void show_hostgroup_summary(hostgroup *, int);
void show_hostgroup_host_totals_summary(hostgroup *);
void show_hostgroup_service_totals_summary(hostgroup *);
void show_hostgroup_grids(void);
void show_hostgroup_grid(hostgroup *);
void show_filters(void);
void create_pagenumbers(int total_entries, char *temp_url,int type_service);
void create_page_limiter(int result_limit,char *temp_url);
int passes_host_properties_filter(hoststatus *);
int passes_service_properties_filter(servicestatus *);
void document_header(int);
void document_footer(void);
int process_cgivars(void);
authdata current_authdata;
time_t current_time;
char alert_message[MAX_MESSAGE_BUFFER];
char *host_name = NULL;
char *host_address = NULL;
char *host_filter = NULL;
char *hostgroup_name = NULL;
char *servicegroup_name = NULL;
char *service_filter = NULL;
int host_alert = FALSE;
int show_all_hosts = TRUE;
int show_all_hostgroups = TRUE;
int show_all_servicegroups = TRUE;
int display_type = DISPLAY_HOSTS;
int overview_columns = 3;
int max_grid_width = 8;
int group_style_type = STYLE_OVERVIEW;
int navbar_search = FALSE;
/* experimental paging feature */
int temp_result_limit;
int page_start;
int limit_results = TRUE;
int service_status_types = SERVICE_PENDING | SERVICE_OK | SERVICE_UNKNOWN | SERVICE_WARNING | SERVICE_CRITICAL;
int all_service_status_types = SERVICE_PENDING | SERVICE_OK | SERVICE_UNKNOWN | SERVICE_WARNING | SERVICE_CRITICAL;
int host_status_types = HOST_PENDING | SD_HOST_UP | SD_HOST_DOWN | SD_HOST_UNREACHABLE;
int all_host_status_types = HOST_PENDING | SD_HOST_UP | SD_HOST_DOWN | SD_HOST_UNREACHABLE;
int all_service_problems = SERVICE_UNKNOWN | SERVICE_WARNING | SERVICE_CRITICAL;
int all_host_problems = SD_HOST_DOWN | SD_HOST_UNREACHABLE;
unsigned long host_properties = 0L;
unsigned long service_properties = 0L;
int sort_type = SORT_NONE;
int sort_option = SORT_HOSTNAME;
int problem_hosts_down = 0;
int problem_hosts_unreachable = 0;
int problem_services_critical = 0;
int problem_services_warning = 0;
int problem_services_unknown = 0;
int embedded = FALSE;
int display_header = TRUE;
int main(void) {
char *sound = NULL;
host *temp_host = NULL;
hostgroup *temp_hostgroup = NULL;
servicegroup *temp_servicegroup = NULL;
int regex_i = 1, i = 0;
int len;
mac = get_global_macros();
time(¤t_time);
/* get the arguments passed in the URL */
process_cgivars();
/* reset internal variables */
reset_cgi_vars();
cgi_init(document_header, document_footer, READ_ALL_OBJECT_DATA, READ_ALL_STATUS_DATA);
/* initialize macros */
init_macros();
document_header(TRUE);
/* get authentication information */
get_authentication_information(¤t_authdata);
/* if a navbar search was performed, find the host by name, address or partial name */
if(navbar_search == TRUE) {
if(host_name != NULL && NULL != strstr(host_name, "*")) {
/* allocate for 3 extra chars, ^, $ and \0 */
host_filter = malloc(sizeof(char) * (strlen(host_name) * 2 + 3));
len = strlen(host_name);
for(i = 0; i < len; i++, regex_i++) {
if(host_name[i] == '*') {
host_filter[regex_i++] = '.';
host_filter[regex_i] = '*';
}
else
host_filter[regex_i] = host_name[i];
}
host_filter[0] = '^';
host_filter[regex_i++] = '$';
host_filter[regex_i] = '\0';
}
else {
if((temp_host = find_host(host_name)) == NULL) {
for(temp_host = host_list; temp_host != NULL; temp_host = temp_host->next) {
if(is_authorized_for_host(temp_host, ¤t_authdata) == FALSE)
continue;
if(!strcmp(host_name, temp_host->address)) {
host_address = strdup(temp_host->address);
host_filter = malloc(sizeof(char) * (strlen(host_address) * 2 + 3));
len = strlen(host_address);
for(i = 0; i < len; i++, regex_i++) {
host_filter[regex_i] = host_address[i];
}
host_filter[0] = '^';
host_filter[regex_i++] = '$';
host_filter[regex_i] = '\0';
break;
}
}
if(temp_host =
没有合适的资源?快使用搜索试试~ 我知道了~
nagios core4.0.7的汉化包
共27个文件
c:25个
gitignore:1个
in:1个
3星 · 超过75%的资源 需积分: 50 44 下载量 30 浏览量
2014-08-27
11:51:58
上传
评论 2
收藏 288KB RAR 举报
温馨提示
nagios-4.0.7的汉化包,没有安装之前在linux环境下把cgi中的.c文件直接替换掉你下载的nagios安装包里面的cgi。然后在linux下重新安装一遍就可以看见汉字了。
资源推荐
资源详情
资源评论
收起资源包目录
CGI-4.0.7.rar (27个子文件)
CGI-4.0.7
config.c 86KB
histogram.c 81KB
statusjson.c 166KB
cmd.c 108KB
trends.c 95KB
status.c 202KB
archiveutils.c 45KB
avail.c 184KB
archivejson.c 150KB
history.c 29KB
tac.c 56KB
notifications.c 25KB
outages.c 19KB
statusmap.c 91KB
cgiauth.c 19KB
jsonutils.c 37KB
extinfo.c 150KB
Makefile.in 6KB
extcmd_list.c 9KB
.gitignore 19B
statuswml.c 49KB
objectjson.c 200KB
summary.c 90KB
statuswrl.c 35KB
cgiutils.c 61KB
showlog.c 15KB
getcgi.c 14KB
共 27 条
- 1
资源评论
- scwangxu2015-03-18谢谢分享,看了源文件,是中文的,现找到最新4.08的了,不过还是要谢谢的!
- wangyang_4292014-12-01替换后编译根本通过不了,骗分啊伪文艺小青年2014-12-08我在虚拟机里面跑过,是可以的 要不要给你截图你看看?
- cjdhds2014-11-27编译安装的时候总是出错怎么办伪文艺小青年2014-12-08、你先安装一个刚刚下载过的,然后在虚拟机安装之后把下载的cgi文件替换掉,在从新启动虚拟机。 你试试一个一个的替换看看。
伪文艺小青年
- 粉丝: 2
- 资源: 6
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功