[Nagiosplug-checkins] nagiosplug/plugins check_swap.c,1.47,1.48
M. Sean Finney
seanius at users.sourceforge.net
Sat Jun 25 18:25:49 CEST 2005
- Previous message: [Nagiosplug-checkins] nagiosplug/plugins check_tcp.c,1.65,1.66
- Next message: [Nagiosplug-checkins] nagiosplug/contrib/tarballs berger-ping.tar.gz,1.2,NONE check_memory.tgz,1.1,NONE check_spread.tar,1.1,NONE radius.tar.gz,1.2,NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20465
Modified Files:
check_swap.c
Log Message:
"asprintf madness" fix from andreas' patch to np-d, minus the comments.
Index: check_swap.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_swap.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- check_swap.c 19 Jan 2005 21:14:47 -0000 1.47
+++ check_swap.c 26 Jun 2005 01:23:47 -0000 1.48
@@ -79,14 +79,13 @@
# endif
#endif
char str[32];
- char *status, *tmp_status;
+ char *status;
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
status = strdup ("");
- tmp_status = strdup ("");
perf = strdup ("");
if (process_arguments (argc, argv) == ERROR)
@@ -313,17 +312,16 @@
percent_used = 100 * ((double) used_swap) / ((double) total_swap);
result = max_state (result, check_swap (percent_used, free_swap));
- /* broken into two steps because of funkiness with builtin asprintf */
- asprintf (&tmp_status, _(" %d%% free (%.0f MB out of %.0f MB)"),
- (100 - percent_used), free_swap, total_swap);
- asprintf (&status, "%s%s", tmp_status, status);
+ printf (_("SWAP %s - %d%% free (%.0f MB out of %.0f MB) %s|"),
+ state_text (result),
+ (100 - percent_used), free_swap, total_swap, status);
+
+ puts (perfdata ("swap", (long) free_swap, "MB",
+ TRUE, (long) max (warn_size/1024, warn_percent/100.0*total_swap),
+ TRUE, (long) max (crit_size/1024, crit_percent/100.0*total_swap),
+ TRUE, 0,
+ TRUE, (long) total_swap));
- asprintf (&perf, "%s", perfdata ("swap", (long) free_swap, "MB",
- TRUE, (long) max (warn_size/1024, warn_percent/100.0*total_swap),
- TRUE, (long) max (crit_size/1024, crit_percent/100.0*total_swap),
- TRUE, 0,
- TRUE, (long) total_swap));
- printf ("SWAP %s:%s |%s\n", state_text (result), status, perf);
return result;
}
- Previous message: [Nagiosplug-checkins] nagiosplug/plugins check_tcp.c,1.65,1.66
- Next message: [Nagiosplug-checkins] nagiosplug/contrib/tarballs berger-ping.tar.gz,1.2,NONE check_memory.tgz,1.1,NONE check_spread.tar,1.1,NONE radius.tar.gz,1.2,NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Commits
mailing list