/*****************************************************************************
*
* 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= |