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

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

page 1 of 5



/*
   check_cpqarray, an extension for Netsaint / Nagios to check the
   status of a Compaq SmartArray controller from the commandline.
   Copyright (C) 2003  Guenther Mair

   based on the work and using main parts of

   CpqArray Deamon, a program to monitor and remotely configure a 
   SmartArray controller.
   Copyright (C) 1999  Hugo Trippaers

   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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/utsname.h>
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>

#include "/usr/src/linux/drivers/block/ida_ioctl.h"
#include "/usr/src/linux/drivers/block/ida_cmd.h"
#include "/usr/src/linux/drivers/block/cpqarray.h"


const char *controllers[] =
{
  "/dev/ida/c0d0",
  "/dev/ida/c1d0",
  "/dev/ida/c2d0",
  "/dev/ida/c3d0",
  "/dev/ida/c4d0",
  "/dev/ida/c5d0",
  "/dev/ida/c6d0",
  "/dev/ida/c7d0"
};

const char *statusstr[] = {
        "Logical drive /dev/ida/c%dd%d: OK\n",
        "Logical drive /dev/ida/c%dd%d: FAILED\n",
        "Logical drive /dev/ida/c%dd%d: not configured.\n",
        "Logical drive /dev/ida/c%dd%d: using interim recovery mode, %3.2f%% done.\n",
        "Logical drive /dev/ida/c%dd%d: ready for recovery operation.\n",
        "Logical drive /dev/ida/c%dd%d: is currently recovering, %3.2f%% done.\n",
        "Wrong physical drive was replaced.\n",
        "A physical drive is not properly connected.\n",
        "Hardware is overheating.\n",
        "Hardware has overheated.\n",
        "Logical drive /dev/ida/c%dd%d: currently expanding, %3.2f%% done.\n",
        "Logical drive /dev/ida/c%dd%d: not yet available.\n",
        "Logical drive /dev/ida/c%dd%d: queued for expansion.\n",
};

extern char *optarg;
extern int optind, opterr, optopt;

int ctrls_found_num;
int exit_code = 0;
struct controller ctrls_found[8];

#define DEBUG(x)  fprintf(stderr, x)

struct opts 
{
  char debug;
};

struct slog_disk
{
  int status;
  float pvalue;
};

struct controller 
{
  char ctrl_devicename[20];
  int num_logd_found;
  struct slog_disk log_disk[16];
};



int status_check (struct opts opts) 
{
  int devicefd;
  int ctrl_cntr;
=1=

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

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.112657 wallclock secs ( 0.00 usr + 0.00 sys = 0.00 CPU)