PROXY  WHOIS  RQUOTE  TEXTS  SOFT  FOREX  BBOARD
 Music  Philosophy  Code  Literature  Russian

= ROOT|Technical|Code_Examples|C|nagios-plugins-1.4.10|contrib|check_cluster.c =

page 1 of 4



/*****************************************************************************
 *
 * CHECK_CLUSTER.C - Host and Service Cluster Plugin for NetSaint
 *
 * Copyright (c) 2000 Ethan Galstad (netsaint@netsaint.org)
 * License: GPL
 * Last Modified:   07-08-2000
 *
 * License:
 *
 * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 *****************************************************************************/


#include <stdio.h>
#include <stdlib.h>

#define OK		0
#define ERROR		-1

#define TRUE		1
#define FALSE		0

#define CHECK_SERVICES	1
#define CHECK_HOSTS	2

#define MAX_INPUT_BUFFER	1024

#define STATE_OK	0
#define STATE_WARNING	1
#define STATE_CRITICAL	2
#define STATE_UNKNOWN	3

typedef struct clustermember_struct{
	char *host_name;
	char *svc_description;
	struct clustermember_struct *next;
        }clustermember;


int check_cluster_status(void);
int add_clustermember(char *,char *);
void free_memory(void);

clustermember *clustermember_list=NULL;

int total_services_ok=0;
int total_services_warning=0;
int total_services_unknown=0;
int total_services_critical=0;

int total_hosts_up=0;
int total_hosts_down=0;
int total_hosts_unreachable=0;

char status_log[MAX_INPUT_BUFFER]="";
int warning_threshold=0;
int critical_threshold=0;

int check_type=CHECK_SERVICES;


int main(int argc, char **argv){
	char input_buffer[MAX_INPUT_BUFFER];
	char *host_name;
	char *svc_description;
	int return_code=STATE_OK;
	int error=FALSE;

	if(argc!=5){

		printf("Invalid arguments supplied\n");
		printf("\n");

		printf("Host/Service Cluster Plugin for NetSaint\n");
		printf("Copyright (c) 2000 Ethan Galstad (netsaint@netsaint.org)\n");
		printf("Last Modified: 07-08-2000\n");
		printf("License: GPL\n");
		printf("\n");
		printf("Usage: %s <--service | --host> <status_log> <warn_threshold> <crit_threshold>\n",argv[0]);
		printf("\n");
		printf("Options:\n");
		printf("   --service        = Check service cluster status\n");
		printf("   --host           = Check host cluster status\n");
		printf("   <status_log>     = This is the location of the NetSaint status log\n");
		printf("   <warn_threshold> = This is the number of hosts or services in\n");
		printf("                      the cluster that must be in a non-OK state\n");
=1=

= PAGE 1 = NEXT > |2|3|4

UP TO ROOT | UP TO DIR

Google
 


E-mail Facebook Google Digg del.icio.us BlinkList Fark Furl Ma.gnolia Netscape NewsVine Reddit Slashdot Spurl StumbleUpon Technorati YahooMyWeb LiveJournal Blogmarks TwitThis Live News2.ru BobrDobr.ru Memori.ru MoeMesto.ru

0.035202 wallclock secs ( 0.01 usr + 0.00 sys = 0.01 CPU)