mirror of
https://github.com/monitoring-plugins/monitoring-plugins.git
synced 2026-04-15 22:00:06 -04:00
Bulk EOL cleanup
$ git diff --ignore-space-change|diffstat 0 files changed git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2087 f882894a-f735-0410-b71e-b25c423dba1c
This commit is contained in:
parent
16f53e0717
commit
caa8bd6423
35 changed files with 183 additions and 183 deletions
|
|
@ -82,7 +82,7 @@ static void parse_locator(const char *locator, const char *def_stanza, np_ini_in
|
|||
} else {
|
||||
i->file=strdup(&(locator[stanza_len+1]));
|
||||
}
|
||||
|
||||
|
||||
if(i->file==NULL || i->stanza==NULL){
|
||||
die(STATE_UNKNOWN, _("malloc() failed!\n"));
|
||||
}
|
||||
|
|
@ -110,7 +110,7 @@ np_arg_list* np_get_defaults(const char *locator, const char *default_section){
|
|||
if(inifile!=stdin) fclose(inifile);
|
||||
}
|
||||
free(i.stanza);
|
||||
return defaults;
|
||||
return defaults;
|
||||
}
|
||||
|
||||
/* read_defaults is where the meat of the parsing takes place.
|
||||
|
|
@ -161,7 +161,7 @@ static int read_defaults(FILE *f, const char *stanza, np_arg_list **opts){
|
|||
default:
|
||||
switch(stanzastate){
|
||||
/* we never found the start of the first stanza, so
|
||||
* we're dealing with a config error
|
||||
* we're dealing with a config error
|
||||
*/
|
||||
case NOSTANZA:
|
||||
die(STATE_UNKNOWN, _("Config file error"));
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ range
|
|||
set_range_end(temp_range, end);
|
||||
}
|
||||
|
||||
if (temp_range->start_infinity == TRUE ||
|
||||
if (temp_range->start_infinity == TRUE ||
|
||||
temp_range->end_infinity == TRUE ||
|
||||
temp_range->start <= temp_range->end) {
|
||||
return temp_range;
|
||||
|
|
@ -164,7 +164,7 @@ check_range(double value, range *my_range)
|
|||
{
|
||||
int no = FALSE;
|
||||
int yes = TRUE;
|
||||
|
||||
|
||||
if (my_range->alert_on == INSIDE) {
|
||||
no = TRUE;
|
||||
yes = FALSE;
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ np_del_parameter(struct parameter_list *item, struct parameter_list *prev)
|
|||
return next;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* returns a pointer to the struct found in the list */
|
||||
struct parameter_list *
|
||||
np_find_parameter(struct parameter_list *list, const char *name)
|
||||
|
|
@ -101,7 +101,7 @@ np_find_parameter(struct parameter_list *list, const char *name)
|
|||
if (! strcmp(temp_list->name, name))
|
||||
return temp_list;
|
||||
}
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -126,7 +126,7 @@ np_set_best_match(struct parameter_list *desired, struct mount_entry *mount_list
|
|||
if (! best_match) {
|
||||
for (me = mount_list; me; me = me->me_next) {
|
||||
size_t len = strlen (me->me_mountdir);
|
||||
if ((exact == FALSE && (best_match_len <= len && len <= name_len &&
|
||||
if ((exact == FALSE && (best_match_len <= len && len <= name_len &&
|
||||
(len == 1 || strncmp (me->me_mountdir, d->name, len) == 0)))
|
||||
|| (exact == TRUE && strcmp(me->me_mountdir, d->name)==0))
|
||||
{
|
||||
|
|
@ -175,7 +175,7 @@ np_seen_name(struct name_list *list, const char *name)
|
|||
}
|
||||
|
||||
int
|
||||
np_regex_match_mount_entry (struct mount_entry* me, regex_t* re)
|
||||
np_regex_match_mount_entry (struct mount_entry* me, regex_t* re)
|
||||
{
|
||||
if (regexec(re, me->me_devname, (size_t) 0, NULL, 0) == 0 ||
|
||||
regexec(re, me->me_mountdir, (size_t) 0, NULL, 0) == 0 ) {
|
||||
|
|
|
|||
|
|
@ -79,8 +79,8 @@ const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
|||
|
||||
#elif defined(__sun__) || defined(__solaris__) || defined(__hpux__)
|
||||
|
||||
#define INSAP 22
|
||||
#define OUTSAP 24
|
||||
#define INSAP 22
|
||||
#define OUTSAP 24
|
||||
|
||||
#include <signal.h>
|
||||
#include <ctype.h>
|
||||
|
|
@ -90,17 +90,17 @@ const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
|||
|
||||
#define bcopy(source, destination, length) memcpy(destination, source, length)
|
||||
|
||||
#define AREA_SZ 5000 /* buffer length in bytes */
|
||||
#define AREA_SZ 5000 /* buffer length in bytes */
|
||||
static u_long ctl_area[AREA_SZ];
|
||||
static u_long dat_area[AREA_SZ];
|
||||
static struct strbuf ctl = {AREA_SZ, 0, (char *)ctl_area};
|
||||
static struct strbuf dat = {AREA_SZ, 0, (char *)dat_area};
|
||||
|
||||
#define GOT_CTRL 1
|
||||
#define GOT_DATA 2
|
||||
#define GOT_BOTH 3
|
||||
#define GOT_INTR 4
|
||||
#define GOT_ERR 128
|
||||
#define GOT_CTRL 1
|
||||
#define GOT_DATA 2
|
||||
#define GOT_BOTH 3
|
||||
#define GOT_INTR 4
|
||||
#define GOT_ERR 128
|
||||
|
||||
#define u_int8_t uint8_t
|
||||
#define u_int16_t uint16_t
|
||||
|
|
@ -222,7 +222,7 @@ dhcp_offer *dhcp_offer_list=NULL;
|
|||
requested_server *requested_server_list=NULL;
|
||||
|
||||
int valid_responses=0; /* number of valid DHCPOFFERs we received */
|
||||
int requested_servers=0;
|
||||
int requested_servers=0;
|
||||
int requested_responses=0;
|
||||
|
||||
int request_specific_address=FALSE;
|
||||
|
|
@ -382,7 +382,7 @@ int get_hardware_address(int sock,char *interface_name){
|
|||
unit = atoi(p) ;
|
||||
*p = '\0' ;
|
||||
strncat(dev, interface_name, 6) ;
|
||||
}
|
||||
}
|
||||
else{
|
||||
printf(_("Error: can't find unit number in interface_name (%s) - expecting TypeNumber eg lnc0.\n"), interface_name);
|
||||
exit(STATE_UNKNOWN);
|
||||
|
|
@ -535,7 +535,7 @@ int send_dhcp_discover(int sock){
|
|||
/* send the DHCPDISCOVER packet out */
|
||||
send_dhcp_packet(&discover_packet,sizeof(discover_packet),sock,&sockaddr_broadcast);
|
||||
|
||||
if(verbose)
|
||||
if(verbose)
|
||||
printf("\n\n");
|
||||
|
||||
return OK;
|
||||
|
|
@ -564,7 +564,7 @@ int get_dhcp_offer(int sock){
|
|||
if((current_time-start_time)>=dhcpoffer_timeout)
|
||||
break;
|
||||
|
||||
if(verbose)
|
||||
if(verbose)
|
||||
printf("\n\n");
|
||||
|
||||
bzero(&source,sizeof(source));
|
||||
|
|
@ -581,7 +581,7 @@ int get_dhcp_offer(int sock){
|
|||
continue;
|
||||
}
|
||||
else{
|
||||
if(verbose)
|
||||
if(verbose)
|
||||
printf(_("Result=OK\n"));
|
||||
|
||||
responses++;
|
||||
|
|
@ -626,7 +626,7 @@ int get_dhcp_offer(int sock){
|
|||
printf("\n");
|
||||
|
||||
if(result==ERROR){
|
||||
if(verbose)
|
||||
if(verbose)
|
||||
printf(_("DHCPOFFER hardware address did not match our own - ignoring packet\n"));
|
||||
|
||||
continue;
|
||||
|
|
@ -660,7 +660,7 @@ int send_dhcp_packet(void *buffer, int buffer_size, int sock, struct sockaddr_in
|
|||
|
||||
result=sendto(sock,(char *)buffer,buffer_size,0,(struct sockaddr *)dest,sizeof(*dest));
|
||||
|
||||
if(verbose)
|
||||
if(verbose)
|
||||
printf(_("send_dhcp_packet result: %d\n"),result);
|
||||
|
||||
if(result<0)
|
||||
|
|
@ -853,7 +853,7 @@ int add_dhcp_offer(struct in_addr source,dhcp_packet *offer_packet){
|
|||
/* get option length */
|
||||
option_length=offer_packet->options[x++];
|
||||
|
||||
if(verbose)
|
||||
if(verbose)
|
||||
printf("Option: %d (0x%02X)\n",option_type,option_length);
|
||||
|
||||
/* get option data */
|
||||
|
|
@ -989,7 +989,7 @@ int get_results(void){
|
|||
if(verbose){
|
||||
printf(_("DHCP Server Match: Offerer=%s"),inet_ntoa(temp_offer->server_address));
|
||||
printf(_(" Requested=%s"),inet_ntoa(temp_server->server_address));
|
||||
if(temp_server->answered)
|
||||
if(temp_server->answered)
|
||||
printf(_(" (duplicate)"));
|
||||
printf(_("\n"));
|
||||
}
|
||||
|
|
@ -1090,7 +1090,7 @@ int call_getopt(int argc, char **argv){
|
|||
|
||||
int option_index = 0;
|
||||
static struct option long_options[] =
|
||||
{
|
||||
{
|
||||
{"serverip", required_argument,0,'s'},
|
||||
{"requestedip", required_argument,0,'r'},
|
||||
{"timeout", required_argument,0,'t'},
|
||||
|
|
@ -1306,7 +1306,7 @@ static int dl_bind(int fd, int sap, u_char *addr){
|
|||
|
||||
/***********************************************************************
|
||||
* interface:
|
||||
* function mac_addr_dlpi - get the mac address of the interface with
|
||||
* function mac_addr_dlpi - get the mac address of the interface with
|
||||
* type dev (eg lnc, hme) and unit (0, 1 ..)
|
||||
*
|
||||
* parameter: addr: an array of six bytes, has to be allocated by the caller
|
||||
|
|
|
|||
|
|
@ -1313,7 +1313,7 @@ print_help(void)
|
|||
printf (" %s",_("timeout value (seconds, currently "));
|
||||
printf ("%u)\n", timeout);
|
||||
printf (" %s\n", "-b");
|
||||
printf (" %s\n", _("Number of icmp data bytes to send"));
|
||||
printf (" %s\n", _("Number of icmp data bytes to send"));
|
||||
printf (" %s %u + %d)\n", _("Packet size will be data bytes + icmp header (currently"),icmp_data_size, ICMP_MINLEN);
|
||||
printf (" %s\n", "-v");
|
||||
printf (" %s\n", _("verbose"));
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
* Description:
|
||||
*
|
||||
* This file contains the pst3 executable. This is a replacement ps command
|
||||
* for Solaris to get output which provides a long argument listing, which
|
||||
* for Solaris to get output which provides a long argument listing, which
|
||||
* is not possible with the standard ps command (due to truncation). /usr/ucb/ps
|
||||
* also has issues where some fields run into each other.
|
||||
*
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
*
|
||||
* Originally written by R.W.Ingraham
|
||||
* Rewritten by Duncan Ferguson (Altinity Ltd, June 2008)
|
||||
* The rewrite was necessary as /dev/kmem is not available within
|
||||
* The rewrite was necessary as /dev/kmem is not available within
|
||||
* non-global zones on Solaris 10
|
||||
*
|
||||
* Details for rewrite came from
|
||||
|
|
@ -48,7 +48,7 @@
|
|||
#include <fcntl.h>
|
||||
#include <procfs.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types32.h>
|
||||
#include <sys/types32.h>
|
||||
|
||||
/*
|
||||
* Constants
|
||||
|
|
@ -125,8 +125,8 @@ int main (int argc, char **argv)
|
|||
char *procname;
|
||||
char *ptr;
|
||||
int argslen;
|
||||
uintptr_t args_addr;;
|
||||
uintptr_t *args_vecs;;
|
||||
uintptr_t args_addr;;
|
||||
uintptr_t *args_vecs;;
|
||||
int args_count;
|
||||
|
||||
if(proc->d_name[0] == '.')
|
||||
|
|
@ -146,8 +146,8 @@ try_again:
|
|||
close(ps_fd);
|
||||
close(as_fd);
|
||||
if(err == EAGAIN) goto try_again;
|
||||
if(err != ENOENT)
|
||||
fprintf(stderr, "%s: read() on %s: %s\n", szProg,
|
||||
if(err != ENOENT)
|
||||
fprintf(stderr, "%s: read() on %s: %s\n", szProg,
|
||||
ps_name, strerror(err));
|
||||
continue;
|
||||
}
|
||||
|
|
@ -185,7 +185,7 @@ try_again:
|
|||
);
|
||||
free(procname);
|
||||
|
||||
/*
|
||||
/*
|
||||
* and now for the command line stuff
|
||||
*/
|
||||
|
||||
|
|
@ -195,18 +195,18 @@ try_again:
|
|||
|
||||
if(psinfo.pr_dmodel == PR_MODEL_NATIVE) {
|
||||
/* this process matches target process */
|
||||
pread(as_fd,args_vecs, args_count * sizeof(uintptr_t),
|
||||
pread(as_fd,args_vecs, args_count * sizeof(uintptr_t),
|
||||
args_addr);
|
||||
} else {
|
||||
} else {
|
||||
/* this process is 64bit, target process is 32 bit*/
|
||||
caddr32_t *args_vecs32 = (caddr32_t *)args_vecs;
|
||||
pread(as_fd,args_vecs32,args_count * sizeof(caddr32_t),
|
||||
pread(as_fd,args_vecs32,args_count * sizeof(caddr32_t),
|
||||
args_addr);
|
||||
for (i=args_count-1;i>=0;--i)
|
||||
args_vecs[i]=args_vecs32[i];
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* now read in the args - if what we read in fills buffer
|
||||
* resize buffer and reread that bit again
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ int main (int argc, char **argv) {
|
|||
result = max_state(result, STATE_OK);
|
||||
}
|
||||
|
||||
printf(_("APT %s: %d packages available for %s (%d critical updates). %s%s%s%s\n"),
|
||||
printf(_("APT %s: %d packages available for %s (%d critical updates). %s%s%s%s\n"),
|
||||
state_text(result),
|
||||
packages_available,
|
||||
(upgrade==DIST_UPGRADE)?"dist-upgrade":"upgrade",
|
||||
|
|
@ -305,7 +305,7 @@ int run_upgrade(int *pkgcount, int *secpkgcount){
|
|||
}
|
||||
regfree(&ireg);
|
||||
regfree(&sreg);
|
||||
if(do_exclude!=NULL) regfree(&ereg);
|
||||
if(do_exclude!=NULL) regfree(&ereg);
|
||||
free(cmdline);
|
||||
return result;
|
||||
}
|
||||
|
|
@ -364,7 +364,7 @@ char* add_to_regexp(char *expr, const char *next){
|
|||
sprintf((char*)(re+strlen(re)-2), "|%s) ", next);
|
||||
}
|
||||
|
||||
return re;
|
||||
return re;
|
||||
}
|
||||
|
||||
char* construct_cmdline(upgrade_type u, const char *opts){
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ int main(int argc, char **argv){
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* return the status of the cluster */
|
||||
if(check_type==CHECK_SERVICES){
|
||||
|
|
@ -149,7 +149,7 @@ int main(int argc, char **argv){
|
|||
int process_arguments(int argc, char **argv){
|
||||
int c;
|
||||
int option=0;
|
||||
static struct option longopts[]={
|
||||
static struct option longopts[]={
|
||||
{"data", required_argument,0,'d'},
|
||||
{"warning", required_argument,0,'w'},
|
||||
{"critical", required_argument,0,'c'},
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ main (int argc, char **argv)
|
|||
/* If a list of paths has not been selected, find entire
|
||||
mount list and create list of paths
|
||||
*/
|
||||
if (path_selected == FALSE) {
|
||||
if (path_selected == FALSE) {
|
||||
for (me = mount_list; me; me = me->me_next) {
|
||||
if (! (path = np_find_parameter(path_select_list, me->me_mountdir))) {
|
||||
path = np_add_parameter(&path_select_list, me->me_mountdir);
|
||||
|
|
@ -293,8 +293,8 @@ main (int argc, char **argv)
|
|||
/* Skip excluded fstypes */
|
||||
} else if (fs_exclude_list && np_find_name (fs_exclude_list, me->me_type)) {
|
||||
continue;
|
||||
/* Skip excluded fs's */
|
||||
} else if (dp_exclude_list &&
|
||||
/* Skip excluded fs's */
|
||||
} else if (dp_exclude_list &&
|
||||
(np_find_name (dp_exclude_list, me->me_devname) ||
|
||||
np_find_name (dp_exclude_list, me->me_mountdir))) {
|
||||
continue;
|
||||
|
|
@ -327,7 +327,7 @@ main (int argc, char **argv)
|
|||
dfree_inodes_percent = 100 - dused_inodes_percent;
|
||||
|
||||
if (verbose >= 3) {
|
||||
printf ("For %s, used_pct=%g free_pct=%g used_units=%g free_units=%g total_units=%g used_inodes_pct=%g free_inodes_pct=%g fsp.fsu_blocksize=%llu mult=%llu\n",
|
||||
printf ("For %s, used_pct=%g free_pct=%g used_units=%g free_units=%g total_units=%g used_inodes_pct=%g free_inodes_pct=%g fsp.fsu_blocksize=%llu mult=%llu\n",
|
||||
me->me_mountdir, dused_pct, dfree_pct, dused_units, dfree_units, dtotal_units, dused_inodes_percent, dfree_inodes_percent, fsp.fsu_blocksize, mult);
|
||||
}
|
||||
|
||||
|
|
@ -430,7 +430,7 @@ double calculate_percent(uintmax_t value, uintmax_t total) {
|
|||
double pct = -1;
|
||||
/* I don't understand the below, but it is taken from coreutils' df */
|
||||
/* Seems to be calculating pct, in the best possible way */
|
||||
if (value <= TYPE_MAXIMUM(uintmax_t) / 100
|
||||
if (value <= TYPE_MAXIMUM(uintmax_t) / 100
|
||||
&& total != 0) {
|
||||
uintmax_t u100 = value * 100;
|
||||
pct = u100 / total + (u100 % total != 0);
|
||||
|
|
@ -546,7 +546,7 @@ process_arguments (int argc, char **argv)
|
|||
}
|
||||
break;
|
||||
|
||||
/* Awful mistake where the range values do not make sense. Normally,
|
||||
/* Awful mistake where the range values do not make sense. Normally,
|
||||
you alert if the value is within the range, but since we are using
|
||||
freespace, we have to alert if outside the range. Thus we artifically
|
||||
force @ at the beginning of the range, so that it is backwards compatible
|
||||
|
|
@ -620,10 +620,10 @@ process_arguments (int argc, char **argv)
|
|||
case 'L':
|
||||
stat_remote_fs = 1;
|
||||
case 'l':
|
||||
show_local_fs = 1;
|
||||
show_local_fs = 1;
|
||||
break;
|
||||
case 'p': /* select path */
|
||||
if (! (warn_freespace_units || crit_freespace_units || warn_freespace_percent ||
|
||||
if (! (warn_freespace_units || crit_freespace_units || warn_freespace_percent ||
|
||||
crit_freespace_percent || warn_usedspace_units || crit_usedspace_units ||
|
||||
warn_usedspace_percent || crit_usedspace_percent || warn_usedinodes_percent ||
|
||||
crit_usedinodes_percent || warn_freeinodes_percent || crit_freeinodes_percent )) {
|
||||
|
|
@ -714,7 +714,7 @@ process_arguments (int argc, char **argv)
|
|||
case 'R':
|
||||
cflags |= REG_ICASE;
|
||||
case 'r':
|
||||
if (! (warn_freespace_units || crit_freespace_units || warn_freespace_percent ||
|
||||
if (! (warn_freespace_units || crit_freespace_units || warn_freespace_percent ||
|
||||
crit_freespace_percent || warn_usedspace_units || crit_usedspace_units ||
|
||||
warn_usedspace_percent || crit_usedspace_percent || warn_usedinodes_percent ||
|
||||
crit_usedinodes_percent || warn_freeinodes_percent || crit_freeinodes_percent )) {
|
||||
|
|
@ -760,7 +760,7 @@ process_arguments (int argc, char **argv)
|
|||
if (path_selected == FALSE) {
|
||||
struct parameter_list *path;
|
||||
for (me = mount_list; me; me = me->me_next) {
|
||||
if (! (path = np_find_parameter(path_select_list, me->me_mountdir)))
|
||||
if (! (path = np_find_parameter(path_select_list, me->me_mountdir)))
|
||||
path = np_add_parameter(&path_select_list, me->me_mountdir);
|
||||
path->best_match = me;
|
||||
path->group = group;
|
||||
|
|
@ -819,7 +819,7 @@ process_arguments (int argc, char **argv)
|
|||
|
||||
|
||||
void
|
||||
print_path (const char *mypath)
|
||||
print_path (const char *mypath)
|
||||
{
|
||||
if (mypath == NULL)
|
||||
printf ("\n");
|
||||
|
|
@ -829,7 +829,7 @@ print_path (const char *mypath)
|
|||
|
||||
|
||||
void
|
||||
set_all_thresholds (struct parameter_list *path)
|
||||
set_all_thresholds (struct parameter_list *path)
|
||||
{
|
||||
if (path->freespace_units != NULL) free(path->freespace_units);
|
||||
set_thresholds(&path->freespace_units, warn_freespace_units, crit_freespace_units);
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ main (int argc, char **argv)
|
|||
|
||||
/* scan stdout */
|
||||
for(i = 0; i < chld_out.lines; i++) {
|
||||
if (addresses == NULL)
|
||||
if (addresses == NULL)
|
||||
addresses = malloc(sizeof(*addresses)*10);
|
||||
else if (!(n_addresses % 10))
|
||||
addresses = realloc(addresses,sizeof(*addresses) * (n_addresses + 10));
|
||||
|
|
@ -289,7 +289,7 @@ error_scan (char *input_buffer)
|
|||
strstr (input_buffer, ": REFUSED")))
|
||||
die (STATE_CRITICAL, _("Connection to DNS %s was refused\n"), dns_server);
|
||||
|
||||
/* Query refused (usually by an ACL in the namserver) */
|
||||
/* Query refused (usually by an ACL in the namserver) */
|
||||
else if (strstr (input_buffer, "Query refused"))
|
||||
die (STATE_CRITICAL, _("Query was refused by DNS server at %s\n"), dns_server);
|
||||
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ main (int argc, char **argv)
|
|||
return STATE_UNKNOWN;
|
||||
}
|
||||
|
||||
if (argc >= 3)
|
||||
if (argc >= 3)
|
||||
printf (": %s", argv[2]);
|
||||
|
||||
printf("\n");
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ main (int argc, char **argv)
|
|||
/* was thinking about running qstat without any options, capturing the
|
||||
-default line, parsing it & making an array of all know server types
|
||||
but thought this would be too much hassle considering this is a tool
|
||||
for intelligent sysadmins (ha). Could put a static array of known
|
||||
for intelligent sysadmins (ha). Could put a static array of known
|
||||
server types in a header file but then we'd be limiting ourselves
|
||||
|
||||
In the end, I figured I'd simply let an error occur & then trap it
|
||||
|
|
@ -139,10 +139,10 @@ main (int argc, char **argv)
|
|||
result = STATE_CRITICAL;
|
||||
}
|
||||
else {
|
||||
printf ("OK: %s/%s %s (%s), Ping: %s ms|%s %s\n",
|
||||
printf ("OK: %s/%s %s (%s), Ping: %s ms|%s %s\n",
|
||||
ret[qstat_game_players],
|
||||
ret[qstat_game_players_max],
|
||||
ret[qstat_game_field],
|
||||
ret[qstat_game_field],
|
||||
ret[qstat_map_field],
|
||||
ret[qstat_ping_field],
|
||||
perfdata ("players", atol(ret[qstat_game_players]), "",
|
||||
|
|
@ -345,7 +345,7 @@ print_usage (void)
|
|||
* Test Cases:
|
||||
*
|
||||
* ./check_game --players 7 -p 8 --map 5 qs 67.20.190.61 26000
|
||||
*
|
||||
*
|
||||
* qstat -raw , -qs 67.20.190.61
|
||||
* ==> QS,67.20.190.61,Nightmare.fintek.ca,67.20.190.61:26000,3,e2m1,6,0,83,0
|
||||
*
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ main (int argc, char **argv)
|
|||
HPJD_GD_DOOR_OPEN, HPJD_GD_PAPER_OUTPUT, HPJD_GD_STATUS_DISPLAY);
|
||||
|
||||
/* get the command to run */
|
||||
sprintf (command_line, "%s -OQa -m : -v 1 -c %s %s %s", PATH_TO_SNMPGET, community,
|
||||
sprintf (command_line, "%s -OQa -m : -v 1 -c %s %s %s", PATH_TO_SNMPGET, community,
|
||||
address, query_string);
|
||||
|
||||
/* run the command */
|
||||
|
|
@ -198,7 +198,7 @@ main (int argc, char **argv)
|
|||
strcpy (display_message, temp_buffer + 1);
|
||||
break;
|
||||
default: /* fold multiline message */
|
||||
strncat (display_message, input_buffer,
|
||||
strncat (display_message, input_buffer,
|
||||
sizeof (display_message) - strlen (display_message) - 1);
|
||||
}
|
||||
|
||||
|
|
@ -218,7 +218,7 @@ main (int argc, char **argv)
|
|||
sprintf (errmsg, "%s", input_buffer );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* close stderr */
|
||||
(void) fclose (child_stderr);
|
||||
|
||||
|
|
@ -232,7 +232,7 @@ main (int argc, char **argv)
|
|||
/* might not be the problem, but most likely is. */
|
||||
result = STATE_UNKNOWN ;
|
||||
asprintf (&errmsg, "%s : Timeout from host %s\n", errmsg, address );
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* if we had no read errors, check the printer status results... */
|
||||
|
|
@ -326,7 +326,7 @@ process_arguments (int argc, char **argv)
|
|||
if (argc < 2)
|
||||
return ERROR;
|
||||
|
||||
|
||||
|
||||
while (1) {
|
||||
c = getopt_long (argc, argv, "+hVH:C:", longopts, &option);
|
||||
|
||||
|
|
@ -365,7 +365,7 @@ process_arguments (int argc, char **argv)
|
|||
usage2 (_("Invalid hostname/address"), argv[c]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (community == NULL) {
|
||||
if (argv[c] != NULL )
|
||||
community = argv[c];
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ main (int argc, char **argv)
|
|||
usage4 (_("Could not parse arguments"));
|
||||
|
||||
if (display_html == TRUE)
|
||||
printf ("<A HREF=\"%s://%s:%d%s\" target=\"_blank\">",
|
||||
printf ("<A HREF=\"%s://%s:%d%s\" target=\"_blank\">",
|
||||
use_ssl ? "https" : "http", host_name ? host_name : server_address,
|
||||
server_port, server_url);
|
||||
|
||||
|
|
@ -314,7 +314,7 @@ process_arguments (int argc, char **argv)
|
|||
if (!strcmp (optarg, "critical"))
|
||||
onredirect = STATE_CRITICAL;
|
||||
if (verbose)
|
||||
printf(_("option f:%d \n"), onredirect);
|
||||
printf(_("option f:%d \n"), onredirect);
|
||||
break;
|
||||
/* Note: H, I, and u must be malloc'd or will fail on redirects */
|
||||
case 'H': /* Host Name (virtual host) */
|
||||
|
|
@ -417,7 +417,7 @@ process_arguments (int argc, char **argv)
|
|||
exit (STATE_WARNING);
|
||||
} else
|
||||
max_page_len = atoi(tmp);
|
||||
} else
|
||||
} else
|
||||
min_page_len = atoi (optarg);
|
||||
break;
|
||||
}
|
||||
|
|
@ -556,7 +556,7 @@ parse_time_string (const char *string)
|
|||
if (tm.tm_mon < 0 || tm.tm_mday < 1 || tm.tm_mday > 31)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
/*
|
||||
This is actually wrong: we need to subtract the local timezone
|
||||
offset from GMT from this value. But, that's ok in this usage,
|
||||
because we only comparing these two GMT dates against each other,
|
||||
|
|
@ -990,7 +990,7 @@ check_http (void)
|
|||
elapsed_time = (double)microsec / 1.0e6;
|
||||
die (onredirect,
|
||||
_(" - %s - %.3f second response time %s|%s %s\n"),
|
||||
status_line, elapsed_time,
|
||||
status_line, elapsed_time,
|
||||
(display_html ? "</A>" : ""),
|
||||
perfd_time (elapsed_time), perfd_size (pagesize));
|
||||
} /* end if (http_status >= 300) */
|
||||
|
|
@ -1006,7 +1006,7 @@ check_http (void)
|
|||
elapsed_time = (double)microsec / 1.0e6;
|
||||
asprintf (&msg,
|
||||
_(" - %s - %.3f second response time %s|%s %s\n"),
|
||||
status_line, elapsed_time,
|
||||
status_line, elapsed_time,
|
||||
(display_html ? "</A>" : ""),
|
||||
perfd_time (elapsed_time), perfd_size (pagesize));
|
||||
if (check_critical_time == TRUE && elapsed_time > critical_time)
|
||||
|
|
@ -1043,9 +1043,9 @@ check_http (void)
|
|||
exit (STATE_OK);
|
||||
}
|
||||
else if ((errcode == REG_NOMATCH && invert_regex == 0) || (errcode == 0 && invert_regex == 1)) {
|
||||
if (invert_regex == 0)
|
||||
if (invert_regex == 0)
|
||||
msg = strdup(_("pattern not found"));
|
||||
else
|
||||
else
|
||||
msg = strdup(_("pattern found"));
|
||||
printf (("%s - %s%s|%s %s\n"),
|
||||
_("HTTP CRITICAL"),
|
||||
|
|
@ -1118,7 +1118,7 @@ redir (char *pos, char *status_line)
|
|||
if (i == 0) {
|
||||
pos += (size_t) strcspn (pos, "\r\n");
|
||||
pos += (size_t) strspn (pos, "\r\n");
|
||||
if (strlen(pos) == 0)
|
||||
if (strlen(pos) == 0)
|
||||
die (STATE_UNKNOWN,
|
||||
_("HTTP UNKNOWN - Could not find redirect location - %s%s\n"),
|
||||
status_line, (display_html ? "</A>" : ""));
|
||||
|
|
@ -1151,7 +1151,7 @@ redir (char *pos, char *status_line)
|
|||
}
|
||||
|
||||
/* URI_HTTP URI_HOST URI_PATH */
|
||||
else if (sscanf (pos, HD2, type, addr, url) == 3 ) {
|
||||
else if (sscanf (pos, HD2, type, addr, url) == 3 ) {
|
||||
url = prepend_slash (url);
|
||||
use_ssl = server_type_check (type);
|
||||
i = server_port_check (use_ssl);
|
||||
|
|
@ -1181,7 +1181,7 @@ redir (char *pos, char *status_line)
|
|||
i = server_port;
|
||||
strcpy (type, server_type);
|
||||
strcpy (addr, host_name ? host_name : server_address);
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
die (STATE_UNKNOWN,
|
||||
|
|
|
|||
|
|
@ -87,15 +87,15 @@ main (int argc, char *argv[])
|
|||
LDAPMessage *result;
|
||||
|
||||
/* should be int result = STATE_UNKNOWN; */
|
||||
|
||||
|
||||
int status = STATE_UNKNOWN;
|
||||
long microsec;
|
||||
double elapsed_time;
|
||||
|
||||
|
||||
/* for ldap tls */
|
||||
|
||||
int tls;
|
||||
int version=3;
|
||||
|
||||
int tls;
|
||||
int version=3;
|
||||
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
|
|
@ -129,7 +129,7 @@ main (int argc, char *argv[])
|
|||
printf ("Could not connect to the server at port %i\n", ld_port);
|
||||
return STATE_CRITICAL;
|
||||
}
|
||||
#else
|
||||
#else
|
||||
if (!(ld = ldap_open (ld_host, ld_port))) {
|
||||
if (verbose)
|
||||
ldap_perror(ld, "ldap_open");
|
||||
|
|
@ -137,7 +137,7 @@ main (int argc, char *argv[])
|
|||
return STATE_CRITICAL;
|
||||
}
|
||||
#endif /* HAVE_LDAP_INIT */
|
||||
|
||||
|
||||
#ifdef HAVE_LDAP_SET_OPTION
|
||||
/* set ldap options */
|
||||
if (ldap_set_option (ld, LDAP_OPT_PROTOCOL_VERSION, &ld_protocol) !=
|
||||
|
|
@ -152,7 +152,7 @@ main (int argc, char *argv[])
|
|||
#if defined(HAVE_LDAP_SET_OPTION) && defined(LDAP_OPT_X_TLS)
|
||||
/* ldaps: set option tls */
|
||||
tls = LDAP_OPT_X_TLS_HARD;
|
||||
|
||||
|
||||
if (ldap_set_option (ld, LDAP_OPT_X_TLS, &tls) != LDAP_SUCCESS)
|
||||
{
|
||||
if (verbose)
|
||||
|
|
@ -179,7 +179,7 @@ main (int argc, char *argv[])
|
|||
/* call start_tls */
|
||||
if (ldap_start_tls_s(ld, NULL, NULL) != LDAP_SUCCESS)
|
||||
{
|
||||
if (verbose)
|
||||
if (verbose)
|
||||
ldap_perror(ld, "ldap_start_tls");
|
||||
printf (_("Could not init startTLS at port %i!\n"), ld_port);
|
||||
return STATE_CRITICAL;
|
||||
|
|
@ -189,7 +189,7 @@ main (int argc, char *argv[])
|
|||
return STATE_CRITICAL;
|
||||
#endif /* HAVE_LDAP_START_TLS_S */
|
||||
}
|
||||
|
||||
|
||||
/* bind to the ldap server */
|
||||
if (ldap_bind_s (ld, ld_binddn, ld_passwd, LDAP_AUTH_SIMPLE) !=
|
||||
LDAP_SUCCESS) {
|
||||
|
|
|
|||
|
|
@ -380,7 +380,7 @@ print_help (void)
|
|||
|
||||
|
||||
|
||||
/* original command line:
|
||||
/* original command line:
|
||||
<log_file> <expire_minutes> <AVG|MAX> <variable> <vwl> <vcl> <label> [units] */
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -71,9 +71,9 @@ main (int argc, char **argv)
|
|||
MYSQL mysql;
|
||||
MYSQL_RES *res;
|
||||
MYSQL_ROW row;
|
||||
|
||||
|
||||
/* should be status */
|
||||
|
||||
|
||||
char *result = NULL;
|
||||
char *error = NULL;
|
||||
char slaveresult[SLAVERESULTSIZE];
|
||||
|
|
@ -186,7 +186,7 @@ main (int argc, char **argv)
|
|||
mysql_close (&mysql);
|
||||
die (STATE_CRITICAL, "Slave status unavailable\n");
|
||||
}
|
||||
|
||||
|
||||
snprintf (slaveresult, SLAVERESULTSIZE, "Slave IO: %s Slave SQL: %s Seconds Behind Master: %s", row[slave_io_field], row[slave_sql_field], row[seconds_behind_field]);
|
||||
if (strcmp (row[slave_io_field], "Yes") != 0 || strcmp (row[slave_sql_field], "Yes") != 0) {
|
||||
mysql_free_result (res);
|
||||
|
|
|
|||
|
|
@ -187,8 +187,8 @@ main (int argc, char **argv)
|
|||
printf (ngettext ("%d process", "%d processes", proc_entries), proc_entries);
|
||||
printf (", ");
|
||||
printf (
|
||||
ngettext ("status log updated %d second ago",
|
||||
"status log updated %d seconds ago",
|
||||
ngettext ("status log updated %d second ago",
|
||||
"status log updated %d seconds ago",
|
||||
(int) (current_time - latest_entry_time) ),
|
||||
(int) (current_time - latest_entry_time) );
|
||||
printf ("\n");
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ typedef struct {
|
|||
|
||||
/* this structure holds data about results from querying offset from a peer */
|
||||
typedef struct {
|
||||
time_t waiting; /* ts set when we started waiting for a response */
|
||||
time_t waiting; /* ts set when we started waiting for a response */
|
||||
int num_responses; /* number of successfully recieved responses */
|
||||
uint8_t stratum; /* copied verbatim from the ntp_message */
|
||||
double rtdelay; /* converted from the ntp_message */
|
||||
|
|
@ -150,7 +150,7 @@ typedef struct {
|
|||
they are divided into halves, each being a 16-bit int in network byte order:
|
||||
- the first 16 bits are an int on the left side of a decimal point.
|
||||
- the second 16 bits represent a fraction n/(2^16)
|
||||
likewise for the 64-bit "fixed point" numbers with everything doubled :)
|
||||
likewise for the 64-bit "fixed point" numbers with everything doubled :)
|
||||
**/
|
||||
|
||||
/* macros to access the left/right 16 bits of a 32-bit ntp "fixed point"
|
||||
|
|
@ -265,7 +265,7 @@ void print_ntp_control_message(const ntp_control_message *p){
|
|||
if(p->op&REM_RESP && p->op&OP_READSTAT){
|
||||
peer=(ntp_assoc_status_pair*)p->data;
|
||||
for(i=0;i<numpeers;i++){
|
||||
printf("\tpeer id %.2x status %.2x",
|
||||
printf("\tpeer id %.2x status %.2x",
|
||||
ntohs(peer[i].assoc), ntohs(peer[i].status));
|
||||
if (PEER_SEL(peer[i].status) >= PEER_INCLUDED){
|
||||
if(PEER_SEL(peer[i].status) >= PEER_SYNCSOURCE){
|
||||
|
|
@ -353,7 +353,7 @@ int best_offset_server(const ntp_server_results *slist, int nservers){
|
|||
|
||||
/* do everything we need to get the total average offset
|
||||
* - we use a certain amount of parallelization with poll() to ensure
|
||||
* we don't waste time sitting around waiting for single packets.
|
||||
* we don't waste time sitting around waiting for single packets.
|
||||
* - we also "manually" handle resolving host names and connecting, because
|
||||
* we have to do it in a way that our lazy macros don't handle currently :( */
|
||||
double offset_request(const char *host, int *status){
|
||||
|
|
@ -667,7 +667,7 @@ int process_arguments(int argc, char **argv){
|
|||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
|
||||
|
||||
if (argc < 2)
|
||||
usage ("\n");
|
||||
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ void print_ntp_control_message(const ntp_control_message *p){
|
|||
if(p->op&REM_RESP && p->op&OP_READSTAT){
|
||||
peer=(ntp_assoc_status_pair*)p->data;
|
||||
for(i=0;i<numpeers;i++){
|
||||
printf("\tpeer id %.2x status %.2x",
|
||||
printf("\tpeer id %.2x status %.2x",
|
||||
ntohs(peer[i].assoc), ntohs(peer[i].status));
|
||||
if (PEER_SEL(peer[i].status) >= PEER_INCLUDED){
|
||||
if(PEER_SEL(peer[i].status) >= PEER_SYNCSOURCE){
|
||||
|
|
@ -477,7 +477,7 @@ int process_arguments(int argc, char **argv){
|
|||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
|
||||
|
||||
if (argc < 2)
|
||||
usage ("\n");
|
||||
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ typedef struct {
|
|||
|
||||
/* this structure holds data about results from querying offset from a peer */
|
||||
typedef struct {
|
||||
time_t waiting; /* ts set when we started waiting for a response */
|
||||
time_t waiting; /* ts set when we started waiting for a response */
|
||||
int num_responses; /* number of successfully recieved responses */
|
||||
uint8_t stratum; /* copied verbatim from the ntp_message */
|
||||
double rtdelay; /* converted from the ntp_message */
|
||||
|
|
@ -132,7 +132,7 @@ typedef struct {
|
|||
they are divided into halves, each being a 16-bit int in network byte order:
|
||||
- the first 16 bits are an int on the left side of a decimal point.
|
||||
- the second 16 bits represent a fraction n/(2^16)
|
||||
likewise for the 64-bit "fixed point" numbers with everything doubled :)
|
||||
likewise for the 64-bit "fixed point" numbers with everything doubled :)
|
||||
**/
|
||||
|
||||
/* macros to access the left/right 16 bits of a 32-bit ntp "fixed point"
|
||||
|
|
@ -299,7 +299,7 @@ int best_offset_server(const ntp_server_results *slist, int nservers){
|
|||
|
||||
/* do everything we need to get the total average offset
|
||||
* - we use a certain amount of parallelization with poll() to ensure
|
||||
* we don't waste time sitting around waiting for single packets.
|
||||
* we don't waste time sitting around waiting for single packets.
|
||||
* - we also "manually" handle resolving host names and connecting, because
|
||||
* we have to do it in a way that our lazy macros don't handle currently :( */
|
||||
double offset_request(const char *host, int *status){
|
||||
|
|
@ -461,7 +461,7 @@ int process_arguments(int argc, char **argv){
|
|||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
|
||||
|
||||
if (argc < 2)
|
||||
usage ("\n");
|
||||
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ main(int argc, char **argv) {
|
|||
|
||||
/* check CPU load */
|
||||
if (vars_to_check==LOAD1 || vars_to_check==LOAD5 || vars_to_check==LOAD15) {
|
||||
|
||||
|
||||
switch(vars_to_check) {
|
||||
case LOAD1:
|
||||
temp_buffer = strdup ("1");
|
||||
|
|
@ -249,7 +249,7 @@ main(int argc, char **argv) {
|
|||
temp_buffer,
|
||||
utilization,
|
||||
warning_value,
|
||||
critical_value);
|
||||
critical_value);
|
||||
|
||||
/* check number of user connections */
|
||||
} else if (vars_to_check==CONNS) {
|
||||
|
|
@ -457,7 +457,7 @@ main(int argc, char **argv) {
|
|||
critical_value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* check % free space on volume */
|
||||
} else if (vars_to_check==VPF) {
|
||||
|
||||
|
|
@ -568,11 +568,11 @@ main(int argc, char **argv) {
|
|||
result=STATE_WARNING;
|
||||
asprintf (&output_message,_("Warning - NRM Status is suspect!"));
|
||||
}
|
||||
|
||||
|
||||
asprintf (&output_message,_("OK - NRM Status is good!"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* check packet receive buffers */
|
||||
} else if (vars_to_check==UPRB || vars_to_check==PUPRB) {
|
||||
|
|
@ -827,7 +827,7 @@ main(int argc, char **argv) {
|
|||
open_files,
|
||||
warning_value,
|
||||
critical_value);
|
||||
|
||||
|
||||
|
||||
/* check # of abended threads (Netware > 5.x only) */
|
||||
} else if (vars_to_check==ABENDS) {
|
||||
|
|
@ -914,7 +914,7 @@ main(int argc, char **argv) {
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
/* check LRU sitting time in secondss */
|
||||
} else if (vars_to_check==LRUS) {
|
||||
|
||||
|
|
@ -977,7 +977,7 @@ main(int argc, char **argv) {
|
|||
total_cache_buffers,
|
||||
warning_value,
|
||||
critical_value);
|
||||
|
||||
|
||||
} else if (vars_to_check==DSVER) {
|
||||
|
||||
close(sd);
|
||||
|
|
@ -1005,7 +1005,7 @@ main(int argc, char **argv) {
|
|||
|
||||
recv_buffer[sizeof(recv_buffer)-1]=0;
|
||||
recv_buffer[strlen(recv_buffer)-1]=0;
|
||||
|
||||
|
||||
asprintf (&output_message,_("Up %s"),recv_buffer);
|
||||
|
||||
} else if (vars_to_check==NLM) {
|
||||
|
|
@ -1024,7 +1024,7 @@ main(int argc, char **argv) {
|
|||
} else {
|
||||
result=STATE_CRITICAL;
|
||||
asprintf (&output_message,_("Module %s is not loaded"),nlm_name);
|
||||
|
||||
|
||||
}
|
||||
} else if (vars_to_check==NRMP) {
|
||||
|
||||
|
|
@ -1313,7 +1313,7 @@ int process_arguments(int argc, char **argv) {
|
|||
|
||||
int option = 0;
|
||||
static struct option longopts[] =
|
||||
{
|
||||
{
|
||||
{"port", required_argument,0,'p'},
|
||||
{"timeout", required_argument,0,'t'},
|
||||
{"critical", required_argument,0,'c'},
|
||||
|
|
@ -1498,7 +1498,7 @@ int process_arguments(int argc, char **argv) {
|
|||
nrmm_name = strdup (optarg+4);
|
||||
if (!strcmp(nrmm_name,""))
|
||||
nrmm_name = strdup ("AVAILABLE_CACHE_MEMORY");
|
||||
|
||||
|
||||
}
|
||||
|
||||
else if (strncmp(optarg,"NRMS",4)==0) {
|
||||
|
|
@ -1506,7 +1506,7 @@ int process_arguments(int argc, char **argv) {
|
|||
nrms_name = strdup (optarg+4);
|
||||
if (!strcmp(nrms_name,""))
|
||||
nrms_name = strdup ("USED_SWAP_SPACE");
|
||||
|
||||
|
||||
}
|
||||
|
||||
else if (strncmp(optarg,"NSS1",4)==0) {
|
||||
|
|
@ -1514,7 +1514,7 @@ int process_arguments(int argc, char **argv) {
|
|||
nss1_name = strdup (optarg+4);
|
||||
if (!strcmp(nss1_name,""))
|
||||
nss1_name = strdup ("CURRENTBUFFERCACHESIZE");
|
||||
|
||||
|
||||
}
|
||||
|
||||
else if (strncmp(optarg,"NSS2",4)==0) {
|
||||
|
|
@ -1522,7 +1522,7 @@ int process_arguments(int argc, char **argv) {
|
|||
nss2_name = strdup (optarg+4);
|
||||
if (!strcmp(nss2_name,""))
|
||||
nss2_name = strdup ("CACHEHITS");
|
||||
|
||||
|
||||
}
|
||||
|
||||
else if (strncmp(optarg,"NSS3",4)==0) {
|
||||
|
|
@ -1530,7 +1530,7 @@ int process_arguments(int argc, char **argv) {
|
|||
nss3_name = strdup (optarg+4);
|
||||
if (!strcmp(nss3_name,""))
|
||||
nss3_name = strdup ("CACHEGITPERCENT");
|
||||
|
||||
|
||||
}
|
||||
|
||||
else if (strncmp(optarg,"NSS4",4)==0) {
|
||||
|
|
@ -1538,7 +1538,7 @@ int process_arguments(int argc, char **argv) {
|
|||
nss4_name = strdup (optarg+4);
|
||||
if (!strcmp(nss4_name,""))
|
||||
nss4_name = strdup ("CURRENTOPENCOUNT");
|
||||
|
||||
|
||||
}
|
||||
|
||||
else if (strncmp(optarg,"NSS5",4)==0) {
|
||||
|
|
@ -1546,7 +1546,7 @@ int process_arguments(int argc, char **argv) {
|
|||
nss5_name = strdup (optarg+4);
|
||||
if (!strcmp(nss5_name,""))
|
||||
nss5_name = strdup ("CACHEMISSES");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1555,7 +1555,7 @@ int process_arguments(int argc, char **argv) {
|
|||
nss6_name = strdup (optarg+4);
|
||||
if (!strcmp(nss6_name,""))
|
||||
nss6_name = strdup ("PENDINGWORKSCOUNT");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1564,7 +1564,7 @@ int process_arguments(int argc, char **argv) {
|
|||
nss7_name = strdup (optarg+4);
|
||||
if (!strcmp(nss7_name,""))
|
||||
nss7_name = strdup ("CACHESIZE");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@ main (int argc, char **argv)
|
|||
status = STATE_OK;
|
||||
}
|
||||
PQfinish (conn);
|
||||
printf (_(" %s - database %s (%d sec.)|%s\n"),
|
||||
printf (_(" %s - database %s (%d sec.)|%s\n"),
|
||||
state_text(status), dbName, elapsed_time,
|
||||
fperfdata("time", elapsed_time, "s",
|
||||
(int)twarn, twarn, (int)tcrit, tcrit, TRUE, 0, FALSE,0));
|
||||
|
|
@ -355,7 +355,7 @@ is_pg_dbname (char *dbname)
|
|||
|
||||
/**
|
||||
|
||||
the tango program should eventually create an entity here based on the
|
||||
the tango program should eventually create an entity here based on the
|
||||
function prototype
|
||||
|
||||
@@-
|
||||
|
|
@ -389,7 +389,7 @@ is_pg_logname (char *username)
|
|||
|
||||
/******************************************************************************
|
||||
@@-
|
||||
</sect2>
|
||||
</sect2>
|
||||
</sect1>
|
||||
</article>
|
||||
-@@
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ main (int argc, char **argv)
|
|||
#endif
|
||||
|
||||
for (i = 0 ; i < n_addresses ; i++) {
|
||||
|
||||
|
||||
#ifdef PING6_COMMAND
|
||||
if (address_family != AF_INET && is_inet6_addr(addresses[i]))
|
||||
rawcmd = strdup(PING6_COMMAND);
|
||||
|
|
@ -150,8 +150,8 @@ main (int argc, char **argv)
|
|||
else if (pl >= wpl || rta >= wrta)
|
||||
this_result = STATE_WARNING;
|
||||
else if (pl >= 0 && rta >= 0)
|
||||
this_result = max_state (STATE_OK, this_result);
|
||||
|
||||
this_result = max_state (STATE_OK, this_result);
|
||||
|
||||
if (n_addresses > 1 && this_result != STATE_UNKNOWN)
|
||||
die (STATE_OK, "%s is alive\n", addresses[i]);
|
||||
|
||||
|
|
@ -370,7 +370,7 @@ get_threshold (char *arg, float *trta, int *tpl)
|
|||
return OK;
|
||||
else if (strpbrk (arg, ",:") && strstr (arg, "%") && sscanf (arg, "%f%*[:,]%d%%", trta, tpl) == 2)
|
||||
return OK;
|
||||
else if (strstr (arg, "%") && sscanf (arg, "%d%%", tpl) == 1)
|
||||
else if (strstr (arg, "%") && sscanf (arg, "%d%%", tpl) == 1)
|
||||
return OK;
|
||||
|
||||
usage2 (_("%s: Warning threshold must be integer or percentage!\n\n"), arg);
|
||||
|
|
|
|||
|
|
@ -169,8 +169,8 @@ main (int argc, char **argv)
|
|||
(nasid==NULL || my_rc_avpair_add (&data.send_pairs, PW_NAS_IDENTIFIER, nasid, 0))))
|
||||
die (STATE_UNKNOWN, _("Out of Memory?"));
|
||||
|
||||
/*
|
||||
* Fill in NAS-IP-Address
|
||||
/*
|
||||
* Fill in NAS-IP-Address
|
||||
*/
|
||||
|
||||
if ((client_id = my_rc_own_ipaddress ()) == 0)
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ main (int argc, char **argv)
|
|||
|
||||
if (verbose && smtp_use_dummycmd)
|
||||
printf ("FROM CMD: %s", cmd_str);
|
||||
|
||||
|
||||
/* initialize alarm signal handling */
|
||||
(void) signal (SIGALRM, socket_timeout_alarm_handler);
|
||||
|
||||
|
|
@ -285,7 +285,7 @@ main (int argc, char **argv)
|
|||
# endif /* USE_OPENSSL */
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* sendmail will syslog a "NOQUEUE" error if session does not attempt
|
||||
* to do something useful. This can be prevented by giving a command
|
||||
* even if syntax is illegal (MAIL requires a FROM:<...> argument)
|
||||
|
|
@ -746,7 +746,7 @@ recvlines(char *buf, size_t bufsize)
|
|||
}
|
||||
|
||||
|
||||
int
|
||||
int
|
||||
my_close (void)
|
||||
{
|
||||
#ifdef HAVE_SSL
|
||||
|
|
|
|||
|
|
@ -199,10 +199,10 @@ main (int argc, char **argv)
|
|||
PATH_TO_SNMPGET, timeout_interval, retries, miblist, proto,
|
||||
"[authpriv]", server_address, port, oid);
|
||||
}
|
||||
|
||||
|
||||
if (verbose)
|
||||
printf ("%s\n", command_line);
|
||||
|
||||
|
||||
|
||||
/* run the command */
|
||||
child_process = spopen (command_line);
|
||||
|
|
@ -236,7 +236,7 @@ main (int argc, char **argv)
|
|||
if (copylen > sizeof(perfstr)-strlen(perfstr)-1)
|
||||
copylen = sizeof(perfstr)-strlen(perfstr)-1;
|
||||
ptr2 = ptr;
|
||||
ptr = foo;
|
||||
ptr = foo;
|
||||
|
||||
if (ptr == NULL)
|
||||
break;
|
||||
|
|
@ -309,7 +309,7 @@ main (int argc, char **argv)
|
|||
eval_method[i] & WARN_EQ ||
|
||||
eval_method[i] & WARN_NE) {
|
||||
p2 = strpbrk (p2, "0123456789");
|
||||
if (p2 == NULL)
|
||||
if (p2 == NULL)
|
||||
die (STATE_UNKNOWN,_("No valid data returned"));
|
||||
response_value[i] = strtoul (p2, NULL, 10);
|
||||
iresult = check_num (i);
|
||||
|
|
@ -346,7 +346,7 @@ main (int argc, char **argv)
|
|||
iresult = STATE_CRITICAL;
|
||||
else if (eval_method[i] & WARN_PRESENT)
|
||||
iresult = STATE_WARNING;
|
||||
else if (response && iresult == STATE_DEPENDENT)
|
||||
else if (response && iresult == STATE_DEPENDENT)
|
||||
iresult = STATE_OK;
|
||||
}
|
||||
|
||||
|
|
@ -473,7 +473,7 @@ process_arguments (int argc, char **argv)
|
|||
usage5 ();
|
||||
case 'h': /* help */
|
||||
print_help ();
|
||||
exit (STATE_OK);
|
||||
exit (STATE_OK);
|
||||
case 'V': /* version */
|
||||
print_revision (progname, revision);
|
||||
exit (STATE_OK);
|
||||
|
|
@ -571,7 +571,7 @@ process_arguments (int argc, char **argv)
|
|||
jj++;
|
||||
ii++;
|
||||
}
|
||||
if (c == 'E')
|
||||
if (c == 'E')
|
||||
eval_method[j+1] |= WARN_PRESENT;
|
||||
else if (c == 'e')
|
||||
eval_method[j+1] |= CRIT_PRESENT;
|
||||
|
|
@ -672,7 +672,7 @@ process_arguments (int argc, char **argv)
|
|||
|
||||
if (community == NULL)
|
||||
community = strdup (DEFAULT_COMMUNITY);
|
||||
|
||||
|
||||
|
||||
|
||||
return validate_arguments ();
|
||||
|
|
@ -687,8 +687,8 @@ process_arguments (int argc, char **argv)
|
|||
|
||||
<para>&PROTO_validate_arguments;</para>
|
||||
|
||||
<para>Checks to see if the default miblist needs to be loaded. Also verifies
|
||||
the authentication and authorization combinations based on protocol version
|
||||
<para>Checks to see if the default miblist needs to be loaded. Also verifies
|
||||
the authentication and authorization combinations based on protocol version
|
||||
selected.</para>
|
||||
|
||||
<para></para>
|
||||
|
|
@ -713,16 +713,16 @@ validate_arguments ()
|
|||
|
||||
|
||||
/* Need better checks to verify seclevel and authproto choices */
|
||||
|
||||
if (seclevel == NULL)
|
||||
|
||||
if (seclevel == NULL)
|
||||
asprintf (&seclevel, "noAuthNoPriv");
|
||||
|
||||
|
||||
if (authproto == NULL )
|
||||
if (authproto == NULL )
|
||||
asprintf(&authproto, DEFAULT_AUTH_PROTOCOL);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (proto == NULL || (strcmp(proto,DEFAULT_PROTOCOL) == 0) ) { /* default protocol version */
|
||||
asprintf(&proto, DEFAULT_PROTOCOL);
|
||||
asprintf(&authpriv, "%s%s", "-c ", community);
|
||||
|
|
@ -732,7 +732,7 @@ validate_arguments ()
|
|||
}
|
||||
else if ( strcmp (proto, "3") == 0 ) { /* snmpv3 args */
|
||||
asprintf(&proto, "%s", "3");
|
||||
|
||||
|
||||
if ( (strcmp(seclevel, "noAuthNoPriv") == 0) || seclevel == NULL ) {
|
||||
asprintf(&authpriv, "%s", "-l noAuthNoPriv" );
|
||||
}
|
||||
|
|
@ -752,12 +752,12 @@ validate_arguments ()
|
|||
}
|
||||
asprintf(&authpriv, "-l authPriv -a %s -u %s -A %s -x DES -X %s ", authproto, secname, authpasswd, privpasswd);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
usage2 (_("Invalid SNMP version"), proto);
|
||||
}
|
||||
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ main (int argc, char **argv)
|
|||
|
||||
/* initialize alarm signal handling */
|
||||
signal (SIGALRM, socket_timeout_alarm_handler);
|
||||
|
||||
|
||||
alarm (socket_timeout);
|
||||
|
||||
/* ssh_connect exits if error is found */
|
||||
|
|
@ -255,7 +255,7 @@ ssh_connect (char *haddr, int hport, char *remote_version)
|
|||
close(sd);
|
||||
exit (STATE_WARNING);
|
||||
}
|
||||
|
||||
|
||||
printf
|
||||
(_("SSH OK - %s (protocol %s)\n"),
|
||||
ssh_server, ssh_proto);
|
||||
|
|
@ -294,7 +294,7 @@ print_help (void)
|
|||
|
||||
printf (" %s\n", "-r, --remote-version=STRING");
|
||||
printf (" %s\n", _("Warn if string doesn't match expected server version (ex: OpenSSH_3.9p1)"));
|
||||
|
||||
|
||||
printf (_(UT_VERBOSE));
|
||||
|
||||
#ifdef NP_EXTRA_OPTS
|
||||
|
|
|
|||
|
|
@ -507,7 +507,7 @@ validate_arguments (void)
|
|||
return ERROR;
|
||||
}
|
||||
else if (warn_percent < crit_percent) {
|
||||
usage4
|
||||
usage4
|
||||
(_("Warning percentage should be more than critical percentage"));
|
||||
}
|
||||
else if (warn_size_bytes < crit_size_bytes) {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
|
@ -315,7 +315,7 @@ main (int argc, char **argv)
|
|||
}
|
||||
#ifdef HAVE_SSL
|
||||
np_net_ssl_cleanup();
|
||||
#endif
|
||||
#endif
|
||||
if (sd) close (sd);
|
||||
|
||||
microsec = deltime (tv);
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ main (int argc, char **argv)
|
|||
result = STATE_WARNING;
|
||||
else
|
||||
result = STATE_UNKNOWN;
|
||||
die (result,
|
||||
die (result,
|
||||
_("TIME UNKNOWN - could not send UDP request to server %s, port %d\n"),
|
||||
server_address, server_port);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -403,7 +403,7 @@ get_ups_variable (const char *varname, char *buf, size_t buflen)
|
|||
int len;
|
||||
|
||||
*buf=0;
|
||||
|
||||
|
||||
/* create the command string to send to the UPS daemon */
|
||||
/* Add LOGOUT to avoid read failure logs */
|
||||
sprintf (send_buffer, "GET VAR %s %s\nLOGOUT\n", ups_name, varname);
|
||||
|
|
@ -453,7 +453,7 @@ get_ups_variable (const char *varname, char *buf, size_t buflen)
|
|||
}
|
||||
|
||||
|
||||
/* Command line: CHECK_UPS -H <host_address> -u ups [-p port] [-v variable]
|
||||
/* Command line: CHECK_UPS -H <host_address> -u ups [-p port] [-v variable]
|
||||
[-wv warn_value] [-cv crit_value] [-to to_sec] */
|
||||
|
||||
|
||||
|
|
@ -508,7 +508,7 @@ process_arguments (int argc, char **argv)
|
|||
usage2 (_("Invalid hostname/address"), optarg);
|
||||
}
|
||||
break;
|
||||
case 'T': /* FIXME: to be improved (ie "-T C" for Celsius or "-T F" for Farenheit) */
|
||||
case 'T': /* FIXME: to be improved (ie "-T C" for Celsius or "-T F" for Farenheit) */
|
||||
temp_output_c = 1;
|
||||
break;
|
||||
case 'u': /* ups name */
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
#include "common.h"
|
||||
#include "netutils.h"
|
||||
|
||||
unsigned int socket_timeout = DEFAULT_SOCKET_TIMEOUT;
|
||||
unsigned int socket_timeout = DEFAULT_SOCKET_TIMEOUT;
|
||||
int econn_refuse_state = STATE_CRITICAL;
|
||||
int was_refused = FALSE;
|
||||
#if USE_IPV6
|
||||
|
|
@ -57,8 +57,8 @@ socket_timeout_alarm_handler (int sig)
|
|||
}
|
||||
|
||||
|
||||
/* connects to a host on a specified tcp port, sends a string, and gets a
|
||||
response. loops on select-recv until timeout or eof to get all of a
|
||||
/* connects to a host on a specified tcp port, sends a string, and gets a
|
||||
response. loops on select-recv until timeout or eof to get all of a
|
||||
multi-packet answer */
|
||||
int
|
||||
process_tcp_request2 (const char *server_address, int server_port,
|
||||
|
|
@ -106,7 +106,7 @@ process_tcp_request2 (const char *server_address, int server_port,
|
|||
}
|
||||
else { /* it has */
|
||||
recv_result =
|
||||
recv (sd, recv_buffer + recv_length,
|
||||
recv (sd, recv_buffer + recv_length,
|
||||
(size_t)recv_size - recv_length - 1, 0);
|
||||
if (recv_result == -1) {
|
||||
/* recv failed, bail out */
|
||||
|
|
@ -137,7 +137,7 @@ process_tcp_request2 (const char *server_address, int server_port,
|
|||
}
|
||||
|
||||
|
||||
/* connects to a host on a specified port, sends a string, and gets a
|
||||
/* connects to a host on a specified port, sends a string, and gets a
|
||||
response */
|
||||
int
|
||||
process_request (const char *server_address, int server_port, int proto,
|
||||
|
|
@ -229,7 +229,7 @@ np_net_connect (const char *host_name, int port, int *sd, int proto)
|
|||
r = r->ai_next;
|
||||
}
|
||||
freeaddrinfo (res);
|
||||
}
|
||||
}
|
||||
/* else the hostname is interpreted as a path to a unix socket */
|
||||
else {
|
||||
if(strlen(host_name) >= UNIX_PATH_MAX){
|
||||
|
|
@ -251,7 +251,7 @@ np_net_connect (const char *host_name, int port, int *sd, int proto)
|
|||
return STATE_OK;
|
||||
else if (was_refused) {
|
||||
switch (econn_refuse_state) { /* a user-defined expected outcome */
|
||||
case STATE_OK:
|
||||
case STATE_OK:
|
||||
case STATE_WARNING: /* user wants WARN or OK on refusal */
|
||||
return econn_refuse_state;
|
||||
break;
|
||||
|
|
@ -285,7 +285,7 @@ send_request (int sd, int proto, const char *send_buffer, char *recv_buffer, int
|
|||
result = STATE_WARNING;
|
||||
}
|
||||
|
||||
/* wait up to the number of seconds for socket timeout minus one
|
||||
/* wait up to the number of seconds for socket timeout minus one
|
||||
for data from the host */
|
||||
tv.tv_sec = socket_timeout - 1;
|
||||
tv.tv_usec = 0;
|
||||
|
|
@ -340,7 +340,7 @@ is_addr (const char *address)
|
|||
#ifdef USE_IPV6
|
||||
if (address_family == AF_INET && is_inet_addr (address))
|
||||
return TRUE;
|
||||
else if (address_family == AF_INET6 && is_inet6_addr (address))
|
||||
else if (address_family == AF_INET6 && is_inet6_addr (address))
|
||||
return TRUE;
|
||||
#else
|
||||
if (is_inet_addr (address))
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ spopen (const char *cmdstring)
|
|||
/* there cannot be more args than characters */
|
||||
argc = strlen (cmdstring) + 1; /* add 1 for NULL termination */
|
||||
argv = malloc (sizeof(char*)*argc);
|
||||
|
||||
|
||||
if (argv == NULL) {
|
||||
printf ("%s\n", _("Could not malloc argv array in popen()"));
|
||||
return NULL;
|
||||
|
|
@ -165,7 +165,7 @@ spopen (const char *cmdstring)
|
|||
}
|
||||
else if (strcspn(str,"'") < strcspn (str, " \t\r\n")) {
|
||||
/* handle --option='foo bar' strings */
|
||||
tmp = str + strcspn(str, "'") + 1;
|
||||
tmp = str + strcspn(str, "'") + 1;
|
||||
if (!strstr (tmp, "'"))
|
||||
return NULL; /* balanced? */
|
||||
tmp += strcspn(tmp,"'") + 1;
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ main (int argc, char **argv)
|
|||
|
||||
while (1) {
|
||||
c = getopt_long (argc, argv, "+hVu:", longopts, &option);
|
||||
|
||||
|
||||
if (c == -1 || c == EOF)
|
||||
break;
|
||||
|
||||
|
|
@ -144,7 +144,7 @@ main (int argc, char **argv)
|
|||
printf ("%s", nstr);
|
||||
printf ("</A>");
|
||||
nstr = strtok(NULL, PERF_CHARACTER);
|
||||
if (nstr != NULL)
|
||||
if (nstr != NULL)
|
||||
printf (" | %s", nstr);
|
||||
|
||||
/* close the pipe */
|
||||
|
|
|
|||
Loading…
Reference in a new issue