summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Makefile.am6
-rw-r--r--lib/extra_opts.c4
-rw-r--r--lib/extra_opts.h2
-rw-r--r--lib/parse_ini.c4
-rw-r--r--lib/parse_ini.h2
-rw-r--r--lib/tests/Makefile.am2
-rw-r--r--lib/tests/test_utils.c48
-rw-r--r--lib/utils_base.c100
-rw-r--r--lib/utils_base.h4
-rw-r--r--lib/utils_cmd.c4
-rw-r--r--lib/utils_cmd.h2
-rw-r--r--lib/utils_disk.c2
-rw-r--r--lib/utils_tcp.c2
13 files changed, 91 insertions, 91 deletions
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 99fa591..1515312 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -2,15 +2,15 @@
2 2
3SUBDIRS = . tests 3SUBDIRS = . tests
4 4
5noinst_LIBRARIES = libnagiosplug.a 5noinst_LIBRARIES = libmonitoringplug.a
6 6
7AM_CPPFLAGS = -DNP_STATE_DIR_PREFIX=\"$(localstatedir)\" 7AM_CPPFLAGS = -DNP_STATE_DIR_PREFIX=\"$(localstatedir)\"
8 8
9libnagiosplug_a_SOURCES = utils_base.c utils_disk.c utils_tcp.c utils_cmd.c 9libmonitoringplug_a_SOURCES = utils_base.c utils_disk.c utils_tcp.c utils_cmd.c
10EXTRA_DIST = utils_base.h utils_disk.h utils_tcp.h utils_cmd.h parse_ini.h extra_opts.h 10EXTRA_DIST = utils_base.h utils_disk.h utils_tcp.h utils_cmd.h parse_ini.h extra_opts.h
11 11
12if USE_PARSE_INI 12if USE_PARSE_INI
13libnagiosplug_a_SOURCES += parse_ini.c extra_opts.c 13libmonitoringplug_a_SOURCES += parse_ini.c extra_opts.c
14endif USE_PARSE_INI 14endif USE_PARSE_INI
15 15
16INCLUDES = -I$(srcdir) -I$(top_srcdir)/gl -I$(top_srcdir)/intl -I$(top_srcdir)/plugins 16INCLUDES = -I$(srcdir) -I$(top_srcdir)/gl -I$(top_srcdir)/intl -I$(top_srcdir)/plugins
diff --git a/lib/extra_opts.c b/lib/extra_opts.c
index 2939c7a..70e7dd2 100644
--- a/lib/extra_opts.c
+++ b/lib/extra_opts.c
@@ -1,9 +1,9 @@
1/***************************************************************************** 1/*****************************************************************************
2* 2*
3* Nagios-plugins extra_opts library 3* Monitoring-plugins extra_opts library
4* 4*
5* License: GPL 5* License: GPL
6* Copyright (c) 2007 Nagios Plugins Development Team 6* Copyright (c) 2007 Monitoring Plugins Development Team
7* 7*
8* This program is free software: you can redistribute it and/or modify 8* This program is free software: you can redistribute it and/or modify
9* it under the terms of the GNU General Public License as published by 9* it under the terms of the GNU General Public License as published by
diff --git a/lib/extra_opts.h b/lib/extra_opts.h
index 4bb7b73..8ff14a1 100644
--- a/lib/extra_opts.h
+++ b/lib/extra_opts.h
@@ -2,7 +2,7 @@
2#define _EXTRA_OPTS_H_ 2#define _EXTRA_OPTS_H_
3 3
4/* 4/*
5 * extra_opts.h: routines for loading nagios-plugin defaults from ini 5 * extra_opts.h: routines for loading monitoring-plugin defaults from ini
6 * configuration files. 6 * configuration files.
7 */ 7 */
8 8
diff --git a/lib/parse_ini.c b/lib/parse_ini.c
index 004396f..dfa72d9 100644
--- a/lib/parse_ini.c
+++ b/lib/parse_ini.c
@@ -1,9 +1,9 @@
1/***************************************************************************** 1/*****************************************************************************
2* 2*
3* Nagios-plugins parse_ini library 3* Monitoring-plugins parse_ini library
4* 4*
5* License: GPL 5* License: GPL
6* Copyright (c) 2007 Nagios Plugins Development Team 6* Copyright (c) 2007 Monitoring Plugins Development Team
7* 7*
8* This program is free software: you can redistribute it and/or modify 8* This program is free software: you can redistribute it and/or modify
9* it under the terms of the GNU General Public License as published by 9* it under the terms of the GNU General Public License as published by
diff --git a/lib/parse_ini.h b/lib/parse_ini.h
index e0ba816..a3a494e 100644
--- a/lib/parse_ini.h
+++ b/lib/parse_ini.h
@@ -2,7 +2,7 @@
2#define _PARSE_INI_H_ 2#define _PARSE_INI_H_
3 3
4/* 4/*
5 * parse_ini.h: routines for loading nagios-plugin defaults from ini 5 * parse_ini.h: routines for loading monitoring-plugin defaults from ini
6 * configuration files. 6 * configuration files.
7 */ 7 */
8 8
diff --git a/lib/tests/Makefile.am b/lib/tests/Makefile.am
index 1af5891..c0411ac 100644
--- a/lib/tests/Makefile.am
+++ b/lib/tests/Makefile.am
@@ -28,7 +28,7 @@ endif
28 28
29AM_CFLAGS = -g -I$(top_srcdir)/lib -I$(top_srcdir)/gl $(tap_cflags) 29AM_CFLAGS = -g -I$(top_srcdir)/lib -I$(top_srcdir)/gl $(tap_cflags)
30AM_LDFLAGS = $(tap_ldflags) -ltap 30AM_LDFLAGS = $(tap_ldflags) -ltap
31LDADD = $(top_srcdir)/lib/libnagiosplug.a $(top_srcdir)/gl/libgnu.a 31LDADD = $(top_srcdir)/lib/libmonitoringplug.a $(top_srcdir)/gl/libgnu.a
32 32
33SOURCES = test_utils.c test_disk.c test_tcp.c test_cmd.c test_base64.c test_ini1.c test_ini3.c test_opts1.c test_opts2.c test_opts3.c 33SOURCES = test_utils.c test_disk.c test_tcp.c test_cmd.c test_base64.c test_ini1.c test_ini3.c test_opts1.c test_opts2.c test_opts3.c
34 34
diff --git a/lib/tests/test_utils.c b/lib/tests/test_utils.c
index 79e1110..7a1a1fa 100644
--- a/lib/tests/test_utils.c
+++ b/lib/tests/test_utils.c
@@ -40,20 +40,20 @@ main (int argc, char **argv)
40 40
41 plan_tests(150); 41 plan_tests(150);
42 42
43 ok( this_nagios_plugin==NULL, "nagios_plugin not initialised"); 43 ok( this_monitoring_plugin==NULL, "monitoring_plugin not initialised");
44 44
45 np_init( "check_test", argc, argv ); 45 np_init( "check_test", argc, argv );
46 46
47 ok( this_nagios_plugin!=NULL, "nagios_plugin now initialised"); 47 ok( this_monitoring_plugin!=NULL, "monitoring_plugin now initialised");
48 ok( !strcmp(this_nagios_plugin->plugin_name, "check_test"), "plugin name initialised" ); 48 ok( !strcmp(this_monitoring_plugin->plugin_name, "check_test"), "plugin name initialised" );
49 49
50 ok( this_nagios_plugin->argc==argc, "Argc set" ); 50 ok( this_monitoring_plugin->argc==argc, "Argc set" );
51 ok( this_nagios_plugin->argv==argv, "Argv set" ); 51 ok( this_monitoring_plugin->argv==argv, "Argv set" );
52 52
53 np_set_args(0,0); 53 np_set_args(0,0);
54 54
55 ok( this_nagios_plugin->argc==0, "argc changed" ); 55 ok( this_monitoring_plugin->argc==0, "argc changed" );
56 ok( this_nagios_plugin->argv==0, "argv changed" ); 56 ok( this_monitoring_plugin->argv==0, "argv changed" );
57 57
58 np_set_args(argc, argv); 58 np_set_args(argc, argv);
59 59
@@ -296,11 +296,11 @@ main (int argc, char **argv)
296 diag( "You are probably running in wrong directory. Must run as ./test_utils" ); 296 diag( "You are probably running in wrong directory. Must run as ./test_utils" );
297 297
298 298
299 this_nagios_plugin->argc=4; 299 this_monitoring_plugin->argc=4;
300 this_nagios_plugin->argv[0] = "./test_utils"; 300 this_monitoring_plugin->argv[0] = "./test_utils";
301 this_nagios_plugin->argv[1] = "here"; 301 this_monitoring_plugin->argv[1] = "here";
302 this_nagios_plugin->argv[2] = "--and"; 302 this_monitoring_plugin->argv[2] = "--and";
303 this_nagios_plugin->argv[3] = "now"; 303 this_monitoring_plugin->argv[3] = "now";
304 temp_string = (char *) _np_state_generate_key(); 304 temp_string = (char *) _np_state_generate_key();
305 ok(!strcmp(temp_string, "94b5e17bf5abf51cb15aff5f69b96f2f8dac5ecd"), "Got based on expected argv" ); 305 ok(!strcmp(temp_string, "94b5e17bf5abf51cb15aff5f69b96f2f8dac5ecd"), "Got based on expected argv" );
306 306
@@ -320,16 +320,16 @@ main (int argc, char **argv)
320 320
321 ok(temp_state_key==NULL, "temp_state_key initially empty"); 321 ok(temp_state_key==NULL, "temp_state_key initially empty");
322 322
323 this_nagios_plugin->argc=1; 323 this_monitoring_plugin->argc=1;
324 this_nagios_plugin->argv[0] = "./test_utils"; 324 this_monitoring_plugin->argv[0] = "./test_utils";
325 np_enable_state(NULL, 51); 325 np_enable_state(NULL, 51);
326 temp_state_key = this_nagios_plugin->state; 326 temp_state_key = this_monitoring_plugin->state;
327 ok( !strcmp(temp_state_key->plugin_name, "check_test"), "Got plugin name" ); 327 ok( !strcmp(temp_state_key->plugin_name, "check_test"), "Got plugin name" );
328 ok( !strcmp(temp_state_key->name, "83d877b6cdfefb5d6f06101fd6fe76762f21792c"), "Got generated filename" ); 328 ok( !strcmp(temp_state_key->name, "83d877b6cdfefb5d6f06101fd6fe76762f21792c"), "Got generated filename" );
329 329
330 330
331 np_enable_state("allowedchars_in_keyname", 77); 331 np_enable_state("allowedchars_in_keyname", 77);
332 temp_state_key = this_nagios_plugin->state; 332 temp_state_key = this_monitoring_plugin->state;
333 ok( !strcmp(temp_state_key->plugin_name, "check_test"), "Got plugin name" ); 333 ok( !strcmp(temp_state_key->plugin_name, "check_test"), "Got plugin name" );
334 ok( !strcmp(temp_state_key->name, "allowedchars_in_keyname"), "Got key name with valid chars" ); 334 ok( !strcmp(temp_state_key->name, "allowedchars_in_keyname"), "Got key name with valid chars" );
335 ok( !strcmp(temp_state_key->_filename, "/usr/local/nagios/var/check_test/allowedchars_in_keyname"), "Got internal filename" ); 335 ok( !strcmp(temp_state_key->_filename, "/usr/local/nagios/var/check_test/allowedchars_in_keyname"), "Got internal filename" );
@@ -338,12 +338,12 @@ main (int argc, char **argv)
338 /* Don't do this test just yet. Will die */ 338 /* Don't do this test just yet. Will die */
339 /* 339 /*
340 np_enable_state("bad^chars$in@here", 77); 340 np_enable_state("bad^chars$in@here", 77);
341 temp_state_key = this_nagios_plugin->state; 341 temp_state_key = this_monitoring_plugin->state;
342 ok( !strcmp(temp_state_key->name, "bad_chars_in_here"), "Got key name with bad chars replaced" ); 342 ok( !strcmp(temp_state_key->name, "bad_chars_in_here"), "Got key name with bad chars replaced" );
343 */ 343 */
344 344
345 np_enable_state("funnykeyname", 54); 345 np_enable_state("funnykeyname", 54);
346 temp_state_key = this_nagios_plugin->state; 346 temp_state_key = this_monitoring_plugin->state;
347 ok( !strcmp(temp_state_key->plugin_name, "check_test"), "Got plugin name" ); 347 ok( !strcmp(temp_state_key->plugin_name, "check_test"), "Got plugin name" );
348 ok( !strcmp(temp_state_key->name, "funnykeyname"), "Got key name" ); 348 ok( !strcmp(temp_state_key->name, "funnykeyname"), "Got key name" );
349 349
@@ -367,9 +367,9 @@ main (int argc, char **argv)
367 367
368 temp_state_key->_filename="var/statefile"; 368 temp_state_key->_filename="var/statefile";
369 temp_state_data = np_state_read(); 369 temp_state_data = np_state_read();
370 ok( this_nagios_plugin->state->state_data!=NULL, "Got state data now" ) || diag("Are you running in right directory? Will get coredump next if not"); 370 ok( this_monitoring_plugin->state->state_data!=NULL, "Got state data now" ) || diag("Are you running in right directory? Will get coredump next if not");
371 ok( this_nagios_plugin->state->state_data->time==1234567890, "Got time" ); 371 ok( this_monitoring_plugin->state->state_data->time==1234567890, "Got time" );
372 ok( !strcmp((char *)this_nagios_plugin->state->state_data->data, "String to read"), "Data as expected" ); 372 ok( !strcmp((char *)this_monitoring_plugin->state->state_data->data, "String to read"), "Data as expected" );
373 373
374 temp_state_key->data_version=53; 374 temp_state_key->data_version=53;
375 temp_state_data = np_state_read(); 375 temp_state_data = np_state_read();
@@ -379,7 +379,7 @@ main (int argc, char **argv)
379 temp_state_key->_filename="var/nonexistant"; 379 temp_state_key->_filename="var/nonexistant";
380 temp_state_data = np_state_read(); 380 temp_state_data = np_state_read();
381 ok( temp_state_data==NULL, "Missing file gives NULL" ); 381 ok( temp_state_data==NULL, "Missing file gives NULL" );
382 ok( this_nagios_plugin->state->state_data==NULL, "No state information" ); 382 ok( this_monitoring_plugin->state->state_data==NULL, "No state information" );
383 383
384 temp_state_key->_filename="var/oldformat"; 384 temp_state_key->_filename="var/oldformat";
385 temp_state_data = np_state_read(); 385 temp_state_data = np_state_read();
@@ -426,7 +426,7 @@ main (int argc, char **argv)
426 temp_state_data = np_state_read(); 426 temp_state_data = np_state_read();
427 /* Check time is set to current_time */ 427 /* Check time is set to current_time */
428 ok(system("cmp var/generated var/statefile > /dev/null")!=0, "Generated file should be different this time"); 428 ok(system("cmp var/generated var/statefile > /dev/null")!=0, "Generated file should be different this time");
429 ok(this_nagios_plugin->state->state_data->time-current_time<=1, "Has time generated from current time"); 429 ok(this_monitoring_plugin->state->state_data->time-current_time<=1, "Has time generated from current time");
430 430
431 431
432 /* Don't know how to automatically test this. Need to be able to redefine die and catch the error */ 432 /* Don't know how to automatically test this. Need to be able to redefine die and catch the error */
@@ -438,7 +438,7 @@ main (int argc, char **argv)
438 438
439 np_cleanup(); 439 np_cleanup();
440 440
441 ok( this_nagios_plugin==NULL, "Free'd this_nagios_plugin" ); 441 ok( this_monitoring_plugin==NULL, "Free'd this_monitoring_plugin" );
442 442
443 return exit_status(); 443 return exit_status();
444} 444}
diff --git a/lib/utils_base.c b/lib/utils_base.c
index 54463e9..57d01e2 100644
--- a/lib/utils_base.c
+++ b/lib/utils_base.c
@@ -3,7 +3,7 @@
3* utils_base.c 3* utils_base.c
4* 4*
5* License: GPL 5* License: GPL
6* Copyright (c) 2006 Nagios Plugins Development Team 6* Copyright (c) 2006 Monitoring Plugins Development Team
7* 7*
8* Library of useful functions for plugins 8* Library of useful functions for plugins
9* 9*
@@ -33,53 +33,53 @@
33 33
34#define np_free(ptr) { if(ptr) { free(ptr); ptr = NULL; } } 34#define np_free(ptr) { if(ptr) { free(ptr); ptr = NULL; } }
35 35
36nagios_plugin *this_nagios_plugin=NULL; 36monitoring_plugin *this_monitoring_plugin=NULL;
37 37
38int _np_state_read_file(FILE *); 38int _np_state_read_file(FILE *);
39 39
40void np_init( char *plugin_name, int argc, char **argv ) { 40void np_init( char *plugin_name, int argc, char **argv ) {
41 if (this_nagios_plugin==NULL) { 41 if (this_monitoring_plugin==NULL) {
42 this_nagios_plugin = calloc(1, sizeof(nagios_plugin)); 42 this_monitoring_plugin = calloc(1, sizeof(monitoring_plugin));
43 if (this_nagios_plugin==NULL) { 43 if (this_monitoring_plugin==NULL) {
44 die(STATE_UNKNOWN, _("Cannot allocate memory: %s"), 44 die(STATE_UNKNOWN, _("Cannot allocate memory: %s"),
45 strerror(errno)); 45 strerror(errno));
46 } 46 }
47 this_nagios_plugin->plugin_name = strdup(plugin_name); 47 this_monitoring_plugin->plugin_name = strdup(plugin_name);
48 if (this_nagios_plugin->plugin_name==NULL) 48 if (this_monitoring_plugin->plugin_name==NULL)
49 die(STATE_UNKNOWN, _("Cannot execute strdup: %s"), strerror(errno)); 49 die(STATE_UNKNOWN, _("Cannot execute strdup: %s"), strerror(errno));
50 this_nagios_plugin->argc = argc; 50 this_monitoring_plugin->argc = argc;
51 this_nagios_plugin->argv = argv; 51 this_monitoring_plugin->argv = argv;
52 } 52 }
53} 53}
54 54
55void np_set_args( int argc, char **argv ) { 55void np_set_args( int argc, char **argv ) {
56 if (this_nagios_plugin==NULL) 56 if (this_monitoring_plugin==NULL)
57 die(STATE_UNKNOWN, _("This requires np_init to be called")); 57 die(STATE_UNKNOWN, _("This requires np_init to be called"));
58 58
59 this_nagios_plugin->argc = argc; 59 this_monitoring_plugin->argc = argc;
60 this_nagios_plugin->argv = argv; 60 this_monitoring_plugin->argv = argv;
61} 61}
62 62
63 63
64void np_cleanup() { 64void np_cleanup() {
65 if (this_nagios_plugin!=NULL) { 65 if (this_monitoring_plugin!=NULL) {
66 if(this_nagios_plugin->state!=NULL) { 66 if(this_monitoring_plugin->state!=NULL) {
67 if(this_nagios_plugin->state->state_data) { 67 if(this_monitoring_plugin->state->state_data) {
68 np_free(this_nagios_plugin->state->state_data->data); 68 np_free(this_monitoring_plugin->state->state_data->data);
69 np_free(this_nagios_plugin->state->state_data); 69 np_free(this_monitoring_plugin->state->state_data);
70 } 70 }
71 np_free(this_nagios_plugin->state->name); 71 np_free(this_monitoring_plugin->state->name);
72 np_free(this_nagios_plugin->state); 72 np_free(this_monitoring_plugin->state);
73 } 73 }
74 np_free(this_nagios_plugin->plugin_name); 74 np_free(this_monitoring_plugin->plugin_name);
75 np_free(this_nagios_plugin); 75 np_free(this_monitoring_plugin);
76 } 76 }
77 this_nagios_plugin=NULL; 77 this_monitoring_plugin=NULL;
78} 78}
79 79
80/* Hidden function to get a pointer to this_nagios_plugin for testing */ 80/* Hidden function to get a pointer to this_monitoring_plugin for testing */
81void _get_nagios_plugin( nagios_plugin **pointer ){ 81void _get_monitoring_plugin( monitoring_plugin **pointer ){
82 *pointer = this_nagios_plugin; 82 *pointer = this_monitoring_plugin;
83} 83}
84 84
85void 85void
@@ -89,7 +89,7 @@ die (int result, const char *fmt, ...)
89 va_start (ap, fmt); 89 va_start (ap, fmt);
90 vprintf (fmt, ap); 90 vprintf (fmt, ap);
91 va_end (ap); 91 va_end (ap);
92 if(this_nagios_plugin!=NULL) { 92 if(this_monitoring_plugin!=NULL) {
93 np_cleanup(); 93 np_cleanup();
94 } 94 }
95 exit (result); 95 exit (result);
@@ -375,14 +375,14 @@ char *np_extract_value(const char *varlist, const char *name, char sep) {
375char *_np_state_generate_key() { 375char *_np_state_generate_key() {
376 struct sha1_ctx ctx; 376 struct sha1_ctx ctx;
377 int i; 377 int i;
378 char **argv = this_nagios_plugin->argv; 378 char **argv = this_monitoring_plugin->argv;
379 unsigned char result[20]; 379 unsigned char result[20];
380 char keyname[41]; 380 char keyname[41];
381 char *p=NULL; 381 char *p=NULL;
382 382
383 sha1_init_ctx(&ctx); 383 sha1_init_ctx(&ctx);
384 384
385 for(i=0; i<this_nagios_plugin->argc; i++) { 385 for(i=0; i<this_monitoring_plugin->argc; i++) {
386 sha1_process_bytes(argv[i], strlen(argv[i]), &ctx); 386 sha1_process_bytes(argv[i], strlen(argv[i]), &ctx);
387 } 387 }
388 388
@@ -401,9 +401,9 @@ char *_np_state_generate_key() {
401} 401}
402 402
403void _cleanup_state_data() { 403void _cleanup_state_data() {
404 if (this_nagios_plugin->state->state_data!=NULL) { 404 if (this_monitoring_plugin->state->state_data!=NULL) {
405 np_free(this_nagios_plugin->state->state_data->data); 405 np_free(this_monitoring_plugin->state->state_data->data);
406 np_free(this_nagios_plugin->state->state_data); 406 np_free(this_monitoring_plugin->state->state_data);
407 } 407 }
408} 408}
409 409
@@ -432,7 +432,7 @@ void np_enable_state(char *keyname, int expected_data_version) {
432 char *temp_keyname = NULL; 432 char *temp_keyname = NULL;
433 char *p=NULL; 433 char *p=NULL;
434 434
435 if(this_nagios_plugin==NULL) 435 if(this_monitoring_plugin==NULL)
436 die(STATE_UNKNOWN, _("This requires np_init to be called")); 436 die(STATE_UNKNOWN, _("This requires np_init to be called"));
437 437
438 this_state = (state_key *) calloc(1, sizeof(state_key)); 438 this_state = (state_key *) calloc(1, sizeof(state_key));
@@ -456,15 +456,15 @@ void np_enable_state(char *keyname, int expected_data_version) {
456 p++; 456 p++;
457 } 457 }
458 this_state->name=temp_keyname; 458 this_state->name=temp_keyname;
459 this_state->plugin_name=this_nagios_plugin->plugin_name; 459 this_state->plugin_name=this_monitoring_plugin->plugin_name;
460 this_state->data_version=expected_data_version; 460 this_state->data_version=expected_data_version;
461 this_state->state_data=NULL; 461 this_state->state_data=NULL;
462 462
463 /* Calculate filename */ 463 /* Calculate filename */
464 asprintf(&temp_filename, "%s/%s/%s", _np_state_calculate_location_prefix(), this_nagios_plugin->plugin_name, this_state->name); 464 asprintf(&temp_filename, "%s/%s/%s", _np_state_calculate_location_prefix(), this_monitoring_plugin->plugin_name, this_state->name);
465 this_state->_filename=temp_filename; 465 this_state->_filename=temp_filename;
466 466
467 this_nagios_plugin->state = this_state; 467 this_monitoring_plugin->state = this_state;
468} 468}
469 469
470/* 470/*
@@ -479,11 +479,11 @@ state_data *np_state_read() {
479 FILE *statefile; 479 FILE *statefile;
480 int rc = FALSE; 480 int rc = FALSE;
481 481
482 if(this_nagios_plugin==NULL) 482 if(this_monitoring_plugin==NULL)
483 die(STATE_UNKNOWN, _("This requires np_init to be called")); 483 die(STATE_UNKNOWN, _("This requires np_init to be called"));
484 484
485 /* Open file. If this fails, no previous state found */ 485 /* Open file. If this fails, no previous state found */
486 statefile = fopen( this_nagios_plugin->state->_filename, "r" ); 486 statefile = fopen( this_monitoring_plugin->state->_filename, "r" );
487 if(statefile!=NULL) { 487 if(statefile!=NULL) {
488 488
489 this_state_data = (state_data *) calloc(1, sizeof(state_data)); 489 this_state_data = (state_data *) calloc(1, sizeof(state_data));
@@ -492,7 +492,7 @@ state_data *np_state_read() {
492 strerror(errno)); 492 strerror(errno));
493 493
494 this_state_data->data=NULL; 494 this_state_data->data=NULL;
495 this_nagios_plugin->state->state_data = this_state_data; 495 this_monitoring_plugin->state->state_data = this_state_data;
496 496
497 rc = _np_state_read_file(statefile); 497 rc = _np_state_read_file(statefile);
498 498
@@ -503,10 +503,10 @@ state_data *np_state_read() {
503 _cleanup_state_data(); 503 _cleanup_state_data();
504 } 504 }
505 505
506 return this_nagios_plugin->state->state_data; 506 return this_monitoring_plugin->state->state_data;
507} 507}
508 508
509/* 509/*
510 * Read the state file 510 * Read the state file
511 */ 511 */
512int _np_state_read_file(FILE *f) { 512int _np_state_read_file(FILE *f) {
@@ -544,7 +544,7 @@ int _np_state_read_file(FILE *f) {
544 break; 544 break;
545 case STATE_DATA_VERSION: 545 case STATE_DATA_VERSION:
546 i=atoi(line); 546 i=atoi(line);
547 if(i != this_nagios_plugin->state->data_version) 547 if(i != this_monitoring_plugin->state->data_version)
548 failure++; 548 failure++;
549 else 549 else
550 expected=STATE_DATA_TIME; 550 expected=STATE_DATA_TIME;
@@ -555,13 +555,13 @@ int _np_state_read_file(FILE *f) {
555 if(data_time > current_time) 555 if(data_time > current_time)
556 failure++; 556 failure++;
557 else { 557 else {
558 this_nagios_plugin->state->state_data->time = data_time; 558 this_monitoring_plugin->state->state_data->time = data_time;
559 expected=STATE_DATA_TEXT; 559 expected=STATE_DATA_TEXT;
560 } 560 }
561 break; 561 break;
562 case STATE_DATA_TEXT: 562 case STATE_DATA_TEXT:
563 this_nagios_plugin->state->state_data->data = strdup(line); 563 this_monitoring_plugin->state->state_data->data = strdup(line);
564 if(this_nagios_plugin->state->state_data->data==NULL) 564 if(this_monitoring_plugin->state->state_data->data==NULL)
565 die(STATE_UNKNOWN, _("Cannot execute strdup: %s"), strerror(errno)); 565 die(STATE_UNKNOWN, _("Cannot execute strdup: %s"), strerror(errno));
566 expected=STATE_DATA_END; 566 expected=STATE_DATA_END;
567 status=TRUE; 567 status=TRUE;
@@ -596,8 +596,8 @@ void np_state_write_string(time_t data_time, char *data_string) {
596 current_time=data_time; 596 current_time=data_time;
597 597
598 /* If file doesn't currently exist, create directories */ 598 /* If file doesn't currently exist, create directories */
599 if(access(this_nagios_plugin->state->_filename,F_OK)!=0) { 599 if(access(this_monitoring_plugin->state->_filename,F_OK)!=0) {
600 asprintf(&directories, "%s", this_nagios_plugin->state->_filename); 600 asprintf(&directories, "%s", this_monitoring_plugin->state->_filename);
601 if(directories==NULL) 601 if(directories==NULL)
602 die(STATE_UNKNOWN, _("Cannot allocate memory: %s"), 602 die(STATE_UNKNOWN, _("Cannot allocate memory: %s"),
603 strerror(errno)); 603 strerror(errno));
@@ -607,7 +607,7 @@ void np_state_write_string(time_t data_time, char *data_string) {
607 *p='\0'; 607 *p='\0';
608 if((access(directories,F_OK)!=0) && (mkdir(directories, S_IRWXU)!=0)) { 608 if((access(directories,F_OK)!=0) && (mkdir(directories, S_IRWXU)!=0)) {
609 /* Can't free this! Otherwise error message is wrong! */ 609 /* Can't free this! Otherwise error message is wrong! */
610 /* np_free(directories); */ 610 /* np_free(directories); */
611 die(STATE_UNKNOWN, _("Cannot create directory: %s"), directories); 611 die(STATE_UNKNOWN, _("Cannot create directory: %s"), directories);
612 } 612 }
613 *p='/'; 613 *p='/';
@@ -616,7 +616,7 @@ void np_state_write_string(time_t data_time, char *data_string) {
616 np_free(directories); 616 np_free(directories);
617 } 617 }
618 618
619 asprintf(&temp_file,"%s.XXXXXX",this_nagios_plugin->state->_filename); 619 asprintf(&temp_file,"%s.XXXXXX",this_monitoring_plugin->state->_filename);
620 if(temp_file==NULL) 620 if(temp_file==NULL)
621 die(STATE_UNKNOWN, _("Cannot allocate memory: %s"), 621 die(STATE_UNKNOWN, _("Cannot allocate memory: %s"),
622 strerror(errno)); 622 strerror(errno));
@@ -636,7 +636,7 @@ void np_state_write_string(time_t data_time, char *data_string) {
636 636
637 fprintf(fp,"# NP State file\n"); 637 fprintf(fp,"# NP State file\n");
638 fprintf(fp,"%d\n",NP_STATE_FORMAT_VERSION); 638 fprintf(fp,"%d\n",NP_STATE_FORMAT_VERSION);
639 fprintf(fp,"%d\n",this_nagios_plugin->state->data_version); 639 fprintf(fp,"%d\n",this_monitoring_plugin->state->data_version);
640 fprintf(fp,"%lu\n",current_time); 640 fprintf(fp,"%lu\n",current_time);
641 fprintf(fp,"%s\n",data_string); 641 fprintf(fp,"%s\n",data_string);
642 642
@@ -654,7 +654,7 @@ void np_state_write_string(time_t data_time, char *data_string) {
654 die(STATE_UNKNOWN, _("Error writing temp file")); 654 die(STATE_UNKNOWN, _("Error writing temp file"));
655 } 655 }
656 656
657 if(rename(temp_file, this_nagios_plugin->state->_filename)!=0) { 657 if(rename(temp_file, this_monitoring_plugin->state->_filename)!=0) {
658 unlink(temp_file); 658 unlink(temp_file);
659 np_free(temp_file); 659 np_free(temp_file);
660 die(STATE_UNKNOWN, _("Cannot rename state temp file")); 660 die(STATE_UNKNOWN, _("Cannot rename state temp file"));
diff --git a/lib/utils_base.h b/lib/utils_base.h
index 0cb371f..3b00da5 100644
--- a/lib/utils_base.h
+++ b/lib/utils_base.h
@@ -1,6 +1,6 @@
1#ifndef _UTILS_BASE_ 1#ifndef _UTILS_BASE_
2#define _UTILS_BASE_ 2#define _UTILS_BASE_
3/* Header file for nagios plugins utils_base.c */ 3/* Header file for monitoring plugins utils_base.c */
4 4
5#include "sha1.h" 5#include "sha1.h"
6 6
@@ -52,7 +52,7 @@ typedef struct np_struct {
52 state_key *state; 52 state_key *state;
53 int argc; 53 int argc;
54 char **argv; 54 char **argv;
55 } nagios_plugin; 55 } monitoring_plugin;
56 56
57range *parse_range_string (char *); 57range *parse_range_string (char *);
58int _set_thresholds(thresholds **, char *, char *); 58int _set_thresholds(thresholds **, char *, char *);
diff --git a/lib/utils_cmd.c b/lib/utils_cmd.c
index 0c853dc..4c6d0be 100644
--- a/lib/utils_cmd.c
+++ b/lib/utils_cmd.c
@@ -1,9 +1,9 @@
1/***************************************************************************** 1/*****************************************************************************
2* 2*
3* Nagios run command utilities 3* Monitoring run command utilities
4* 4*
5* License: GPL 5* License: GPL
6* Copyright (c) 2005-2006 Nagios Plugins Development Team 6* Copyright (c) 2005-2006 Monitoring Plugins Development Team
7* 7*
8* Description : 8* Description :
9* 9*
diff --git a/lib/utils_cmd.h b/lib/utils_cmd.h
index 8ebb589..36a6ff0 100644
--- a/lib/utils_cmd.h
+++ b/lib/utils_cmd.h
@@ -2,7 +2,7 @@
2#define _UTILS_CMD_ 2#define _UTILS_CMD_
3 3
4/* 4/*
5 * Header file for nagios plugins utils_cmd.c 5 * Header file for monitoring plugins utils_cmd.c
6 * 6 *
7 * 7 *
8 */ 8 */
diff --git a/lib/utils_disk.c b/lib/utils_disk.c
index 5be2b2c..efe35fc 100644
--- a/lib/utils_disk.c
+++ b/lib/utils_disk.c
@@ -3,7 +3,7 @@
3* Library for check_disk 3* Library for check_disk
4* 4*
5* License: GPL 5* License: GPL
6* Copyright (c) 1999-2007 Nagios Plugins Development Team 6* Copyright (c) 1999-2007 Monitoring Plugins Development Team
7* 7*
8* Description: 8* Description:
9* 9*
diff --git a/lib/utils_tcp.c b/lib/utils_tcp.c
index 46ad7f7..b37c446 100644
--- a/lib/utils_tcp.c
+++ b/lib/utils_tcp.c
@@ -3,7 +3,7 @@
3* Library for check_tcp 3* Library for check_tcp
4* 4*
5* License: GPL 5* License: GPL
6* Copyright (c) 1999-2013 Nagios Plugins Development Team 6* Copyright (c) 1999-2013 Monitoring Plugins Development Team
7* 7*
8* Description: 8* Description:
9* 9*