Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37040475
en ru br
Репозитории ALT
S:4.3.30-alt2
5.1: 4.3.16-alt0.M51.1
www.altlinux.org/Changes

Группа :: Мониторинг
Пакет: xymon

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: xymon.xymonmsg.patch
Скачать


--- common/xymon.c.xymonmsg	2011-07-31 14:01:52.000000000 -0700
+++ common/xymon.c	2012-05-04 11:37:26.322406917 -0700
@@ -86,6 +86,11 @@
 		}
 		else {
-			/* No more options - pickup recipient and msg */
-			if (recipient == NULL) {
+			/* No more options - pickup recipient and/or msg */
+			/* If only a single arg, and XYMMSG isn't in the environment */
+			/* then we're given a message */
+			if (recipient == NULL && (argi+1 == argc) && !getenv("XYMMSG")) {
+				msg = dupstrbuffer(argv[argi]);			
+			}
+			else if (recipient == NULL) {
 				recipient = argv[argi];
 			}
@@ -93,7 +97,17 @@
 				msg = dupstrbuffer(argv[argi]);
 			}
-			else {
-				showhelp=1;
-			}
+		}
+	}
+
+	if ((STRBUFLEN(msg) == 0) && getenv("XYMMSG")) {
+		msg = dupstrbuffer(xgetenv("XYMMSG"));
+		if (debug) printf("Using XYMMSG from the environment\n");
+	}
+	if (recipient == NULL) {
+		if (getenv("XYMSRV") && (strcmp(xgetenv("XYMSRV"), "") != 0)) recipient = xgetenv("XYMSRV");
+		else if (getenv("XYMSERVERS") && (strcmp(xgetenv("XYMSERVERS"), "") != 0)) recipient = "0.0.0.0";
+		else {
+			recipient = "127.0.0.1";
+			if (debug) printf("Assuming localhost recipient\n");
 		}
 	}
@@ -103,2 +117,2 @@
-		fprintf(stderr, "Usage: %s [--debug] [--merge] [--proxy=http://ip.of.the.proxy:port/] RECIPIENT DATA\n", argv[0]);
-		fprintf(stderr, "  RECIPIENT: IP-address, hostname or URL\n");
+		fprintf(stderr, "Usage: %s [--debug] [--merge] [--proxy=http://ip.of.the.proxy:port/] [RECIPIENT] \"DATA\"\n", argv[0]);
+		fprintf(stderr, "  RECIPIENT: IP-address, hostname or URL (default: localhost)\n");
--- common/xymon.1.xymonmsg	2012-05-04 09:57:21.624678573 -0700
+++ common/xymon.1	2012-05-04 11:44:01.077487337 -0700
@@ -2,7 +2,7 @@
 .SH NAME
 xymon \- Xymon client communication program
 .SH SYNOPSIS
-.B "xymon [options] RECIPIENT message"
+.B "xymon [options] [RECIPIENT] \"message\""
 
 .SH DESCRIPTION
 .I xymon(1)
@@ -57,6 +57,10 @@
 .I xymoncgimsg.cgi(8)
 CGI tool (included in Xymon) must be installed on the webserver 
 for the HTTP transport to work.
+
+If RECIPIENT is not given, first "$XYMSRV" and then "$XYMSERVERS"
+will be checked. If neither environment variable is set, localhost
+will be assumed.
 .br
 
 .IP MESSAGE
@@ -70,6 +74,8 @@
 as the message: xymon will then read the status message from its
 stdin.
 
+If no message is given, the "$XYMMSG" variable will checked and,
+if present, used as the message.
 .SH XYMON MESSAGE SYNTAX
 
 This section lists the most commonly used messages in the Xymon
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin