check_ups.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649
  1. /******************************************************************************
  2. check_ups
  3. Program: Network UPS Tools plugin for Nagios
  4. License: GPL
  5. Copyright (c) 2000 Tom Shields
  6. 2004 Alain Richard <alain.richard@equation.fr>
  7. 2004 Arnaud Quette <arnaud.quette@mgeups.com>
  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
  10. the Free Software Foundation; either version 2 of the License, or (at
  11. your option) any later version.
  12. This program is distributed in the hope that it will be useful, but
  13. WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. General Public License for more details.
  16. You should have received a copy of the GNU General Public License
  17. along with this program; if not, write to the Free Software
  18. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19. $Id$
  20. ******************************************************************************/
  21. const char *progname = "check_ups";
  22. const char *revision = "$Revision$";
  23. const char *copyright = "2000-2004";
  24. const char *email = "nagiosplug-devel@lists.sourceforge.net";
  25. #include "common.h"
  26. #include "netutils.h"
  27. #include "utils.h"
  28. enum {
  29. PORT = 3493
  30. };
  31. #define CHECK_NONE 0
  32. #define UPS_NONE 0 /* no supported options */
  33. #define UPS_UTILITY 1 /* supports utility line voltage */
  34. #define UPS_BATTPCT 2 /* supports percent battery remaining */
  35. #define UPS_STATUS 4 /* supports UPS status */
  36. #define UPS_TEMP 8 /* supports UPS temperature */
  37. #define UPS_LOADPCT 16 /* supports load percent */
  38. #define UPSSTATUS_NONE 0
  39. #define UPSSTATUS_OFF 1
  40. #define UPSSTATUS_OL 2
  41. #define UPSSTATUS_OB 4
  42. #define UPSSTATUS_LB 8
  43. #define UPSSTATUS_CAL 16
  44. #define UPSSTATUS_RB 32 /*Replace Battery */
  45. #define UPSSTATUS_BYPASS 64
  46. #define UPSSTATUS_OVER 128
  47. #define UPSSTATUS_TRIM 256
  48. #define UPSSTATUS_BOOST 512
  49. #define UPSSTATUS_CHRG 1024
  50. #define UPSSTATUS_DISCHRG 2048
  51. #define UPSSTATUS_UNKOWN 4096
  52. enum { NOSUCHVAR = ERROR-1 };
  53. int server_port = PORT;
  54. char *server_address;
  55. char *ups_name = NULL;
  56. double warning_value = 0.0;
  57. double critical_value = 0.0;
  58. int check_warn = FALSE;
  59. int check_crit = FALSE;
  60. int check_variable = UPS_NONE;
  61. int supported_options = UPS_NONE;
  62. int status = UPSSTATUS_NONE;
  63. double ups_utility_voltage = 0.0;
  64. double ups_battery_percent = 0.0;
  65. double ups_load_percent = 0.0;
  66. double ups_temperature = 0.0;
  67. char *ups_status;
  68. int temp_output_c = 0;
  69. int determine_status (void);
  70. int get_ups_variable (const char *, char *, size_t);
  71. int process_arguments (int, char **);
  72. int validate_arguments (void);
  73. void print_help (void);
  74. void print_usage (void);
  75. int
  76. main (int argc, char **argv)
  77. {
  78. int result = STATE_UNKNOWN;
  79. char *message;
  80. char *data;
  81. char *tunits;
  82. char temp_buffer[MAX_INPUT_BUFFER];
  83. double ups_utility_deviation = 0.0;
  84. int res;
  85. setlocale (LC_ALL, "");
  86. bindtextdomain (PACKAGE, LOCALEDIR);
  87. textdomain (PACKAGE);
  88. ups_status = strdup ("N/A");
  89. data = strdup ("");
  90. message = strdup ("");
  91. if (process_arguments (argc, argv) == ERROR)
  92. usage4 (_("Could not parse arguments"));
  93. /* initialize alarm signal handling */
  94. signal (SIGALRM, socket_timeout_alarm_handler);
  95. /* set socket timeout */
  96. alarm (socket_timeout);
  97. /* get the ups status if possible */
  98. if (determine_status () != OK)
  99. return STATE_CRITICAL;
  100. if (supported_options & UPS_STATUS) {
  101. ups_status = strdup ("");
  102. result = STATE_OK;
  103. if (status & UPSSTATUS_OFF) {
  104. asprintf (&ups_status, "Off");
  105. result = STATE_CRITICAL;
  106. }
  107. else if ((status & (UPSSTATUS_OB | UPSSTATUS_LB)) ==
  108. (UPSSTATUS_OB | UPSSTATUS_LB)) {
  109. asprintf (&ups_status, _("On Battery, Low Battery"));
  110. result = STATE_CRITICAL;
  111. }
  112. else {
  113. if (status & UPSSTATUS_OL) {
  114. asprintf (&ups_status, "%s%s", ups_status, _("Online"));
  115. }
  116. if (status & UPSSTATUS_OB) {
  117. asprintf (&ups_status, "%s%s", ups_status, _("On Battery"));
  118. result = STATE_WARNING;
  119. }
  120. if (status & UPSSTATUS_LB) {
  121. asprintf (&ups_status, "%s%s", ups_status, _(", Low Battery"));
  122. result = STATE_WARNING;
  123. }
  124. if (status & UPSSTATUS_CAL) {
  125. asprintf (&ups_status, "%s%s", ups_status, _(", Calibrating"));
  126. }
  127. if (status & UPSSTATUS_RB) {
  128. asprintf (&ups_status, "%s%s", ups_status, _(", Replace Battery"));
  129. result = STATE_WARNING;
  130. }
  131. if (status & UPSSTATUS_BYPASS) {
  132. asprintf (&ups_status, "%s%s", ups_status, _(", On Bypass"));
  133. }
  134. if (status & UPSSTATUS_OVER) {
  135. asprintf (&ups_status, "%s%s", ups_status, _(", Overload"));
  136. }
  137. if (status & UPSSTATUS_TRIM) {
  138. asprintf (&ups_status, "%s%s", ups_status, _(", Trimming"));
  139. }
  140. if (status & UPSSTATUS_BOOST) {
  141. asprintf (&ups_status, "%s%s", ups_status, _(", Boosting"));
  142. }
  143. if (status & UPSSTATUS_CHRG) {
  144. asprintf (&ups_status, "%s%s", ups_status, _(", Charging"));
  145. }
  146. if (status & UPSSTATUS_DISCHRG) {
  147. asprintf (&ups_status, "%s%s", ups_status, _(", Discharging"));
  148. }
  149. if (status & UPSSTATUS_UNKOWN) {
  150. asprintf (&ups_status, "%s%s", ups_status, _(", Unknown"));
  151. }
  152. }
  153. asprintf (&message, "%sStatus=%s ", message, ups_status);
  154. }
  155. /* get the ups utility voltage if possible */
  156. res=get_ups_variable ("input.voltage", temp_buffer, sizeof (temp_buffer));
  157. if (res == NOSUCHVAR) supported_options &= ~UPS_UTILITY;
  158. else if (res != OK)
  159. return STATE_CRITICAL;
  160. else {
  161. supported_options |= UPS_UTILITY;
  162. ups_utility_voltage = atof (temp_buffer);
  163. asprintf (&message, "%sUtility=%3.1fV ", message, ups_utility_voltage);
  164. if (ups_utility_voltage > 120.0)
  165. ups_utility_deviation = 120.0 - ups_utility_voltage;
  166. else
  167. ups_utility_deviation = ups_utility_voltage - 120.0;
  168. if (check_variable == UPS_UTILITY) {
  169. if (check_crit==TRUE && ups_utility_deviation>=critical_value) {
  170. result = STATE_CRITICAL;
  171. }
  172. else if (check_warn==TRUE && ups_utility_deviation>=warning_value) {
  173. result = max_state (result, STATE_WARNING);
  174. }
  175. asprintf (&data, "%s",
  176. perfdata ("voltage", (long)(1000*ups_utility_voltage), "mV",
  177. check_warn, (long)(1000*warning_value),
  178. check_crit, (long)(1000*critical_value),
  179. TRUE, 0, FALSE, 0));
  180. } else {
  181. asprintf (&data, "%s",
  182. perfdata ("voltage", (long)(1000*ups_utility_voltage), "mV",
  183. FALSE, 0, FALSE, 0, TRUE, 0, FALSE, 0));
  184. }
  185. }
  186. /* get the ups battery percent if possible */
  187. res=get_ups_variable ("battery.charge", temp_buffer, sizeof (temp_buffer));
  188. if (res == NOSUCHVAR) supported_options &= ~UPS_BATTPCT;
  189. else if ( res != OK)
  190. return STATE_CRITICAL;
  191. else {
  192. supported_options |= UPS_BATTPCT;
  193. ups_battery_percent = atof (temp_buffer);
  194. asprintf (&message, "%sBatt=%3.1f%% ", message, ups_battery_percent);
  195. if (check_variable == UPS_BATTPCT) {
  196. if (check_crit==TRUE && ups_battery_percent <= critical_value) {
  197. result = STATE_CRITICAL;
  198. }
  199. else if (check_warn==TRUE && ups_battery_percent<=warning_value) {
  200. result = max_state (result, STATE_WARNING);
  201. }
  202. asprintf (&data, "%s %s", data,
  203. perfdata ("battery", (long)ups_battery_percent, "%",
  204. check_warn, (long)(1000*warning_value),
  205. check_crit, (long)(1000*critical_value),
  206. TRUE, 0, TRUE, 100));
  207. } else {
  208. asprintf (&data, "%s %s", data,
  209. perfdata ("battery", (long)ups_battery_percent, "%",
  210. FALSE, 0, FALSE, 0, TRUE, 0, TRUE, 100));
  211. }
  212. }
  213. /* get the ups load percent if possible */
  214. res=get_ups_variable ("ups.load", temp_buffer, sizeof (temp_buffer));
  215. if ( res == NOSUCHVAR ) supported_options &= ~UPS_LOADPCT;
  216. else if ( res != OK)
  217. return STATE_CRITICAL;
  218. else {
  219. supported_options |= UPS_LOADPCT;
  220. ups_load_percent = atof (temp_buffer);
  221. asprintf (&message, "%sLoad=%3.1f%% ", message, ups_load_percent);
  222. if (check_variable == UPS_LOADPCT) {
  223. if (check_crit==TRUE && ups_load_percent>=critical_value) {
  224. result = STATE_CRITICAL;
  225. }
  226. else if (check_warn==TRUE && ups_load_percent>=warning_value) {
  227. result = max_state (result, STATE_WARNING);
  228. }
  229. asprintf (&data, "%s %s", data,
  230. perfdata ("load", (long)ups_load_percent, "%",
  231. check_warn, (long)(1000*warning_value),
  232. check_crit, (long)(1000*critical_value),
  233. TRUE, 0, TRUE, 100));
  234. } else {
  235. asprintf (&data, "%s %s", data,
  236. perfdata ("load", (long)ups_load_percent, "%",
  237. FALSE, 0, FALSE, 0, TRUE, 0, TRUE, 100));
  238. }
  239. }
  240. /* get the ups temperature if possible */
  241. res=get_ups_variable ("ups.temperature", temp_buffer, sizeof (temp_buffer));
  242. if ( res == NOSUCHVAR ) supported_options &= ~UPS_TEMP;
  243. else if ( res != OK)
  244. return STATE_CRITICAL;
  245. else {
  246. supported_options |= UPS_TEMP;
  247. if (temp_output_c) {
  248. tunits="degC";
  249. ups_temperature = atof (temp_buffer);
  250. asprintf (&message, "%sTemp=%3.1fC", message, ups_temperature);
  251. }
  252. else {
  253. tunits="degF";
  254. ups_temperature = (atof (temp_buffer) * 1.8) + 32;
  255. asprintf (&message, "%sTemp=%3.1fF", message, ups_temperature);
  256. }
  257. if (check_variable == UPS_TEMP) {
  258. if (check_crit==TRUE && ups_temperature>=critical_value) {
  259. result = STATE_CRITICAL;
  260. }
  261. else if (check_warn == TRUE && ups_temperature>=warning_value) {
  262. result = max_state (result, STATE_WARNING);
  263. }
  264. asprintf (&data, "%s %s", data,
  265. perfdata ("temp", (long)ups_temperature, tunits,
  266. check_warn, (long)(1000*warning_value),
  267. check_crit, (long)(1000*critical_value),
  268. TRUE, 0, FALSE, 0));
  269. } else {
  270. asprintf (&data, "%s %s", data,
  271. perfdata ("temp", (long)ups_temperature, tunits,
  272. FALSE, 0, FALSE, 0, TRUE, 0, FALSE, 0));
  273. }
  274. }
  275. /* if the UPS does not support any options we are looking for, report an error */
  276. if (supported_options == UPS_NONE) {
  277. result = STATE_CRITICAL;
  278. asprintf (&message, _("UPS does not support any available options\n"));
  279. }
  280. /* reset timeout */
  281. alarm (0);
  282. printf ("UPS %s - %s|%s\n", state_text(result), message, data);
  283. return result;
  284. }
  285. /* determines what options are supported by the UPS */
  286. int
  287. determine_status (void)
  288. {
  289. char recv_buffer[MAX_INPUT_BUFFER];
  290. char temp_buffer[MAX_INPUT_BUFFER];
  291. char *ptr;
  292. int res;
  293. res=get_ups_variable ("ups.status", recv_buffer, sizeof (recv_buffer));
  294. if (res == NOSUCHVAR) return OK;
  295. if (res != STATE_OK) {
  296. printf (_("Invalid response received from host\n"));
  297. return ERROR;
  298. }
  299. supported_options |= UPS_STATUS;
  300. strcpy (temp_buffer, recv_buffer);
  301. for (ptr = (char *) strtok (temp_buffer, " "); ptr != NULL;
  302. ptr = (char *) strtok (NULL, " ")) {
  303. if (!strcmp (ptr, "OFF"))
  304. status |= UPSSTATUS_OFF;
  305. else if (!strcmp (ptr, "OL"))
  306. status |= UPSSTATUS_OL;
  307. else if (!strcmp (ptr, "OB"))
  308. status |= UPSSTATUS_OB;
  309. else if (!strcmp (ptr, "LB"))
  310. status |= UPSSTATUS_LB;
  311. else if (!strcmp (ptr, "CAL"))
  312. status |= UPSSTATUS_CAL;
  313. else if (!strcmp (ptr, "RB"))
  314. status |= UPSSTATUS_RB;
  315. else if (!strcmp (ptr, "BYPASS"))
  316. status |= UPSSTATUS_BYPASS;
  317. else if (!strcmp (ptr, "OVER"))
  318. status |= UPSSTATUS_OVER;
  319. else if (!strcmp (ptr, "TRIM"))
  320. status |= UPSSTATUS_TRIM;
  321. else if (!strcmp (ptr, "BOOST"))
  322. status |= UPSSTATUS_BOOST;
  323. else if (!strcmp (ptr, "CHRG"))
  324. status |= UPSSTATUS_CHRG;
  325. else if (!strcmp (ptr, "DISCHRG"))
  326. status |= UPSSTATUS_DISCHRG;
  327. else
  328. status |= UPSSTATUS_UNKOWN;
  329. }
  330. return OK;
  331. }
  332. /* gets a variable value for a specific UPS */
  333. int
  334. get_ups_variable (const char *varname, char *buf, size_t buflen)
  335. {
  336. /* char command[MAX_INPUT_BUFFER]; */
  337. char temp_buffer[MAX_INPUT_BUFFER];
  338. char send_buffer[MAX_INPUT_BUFFER];
  339. char *ptr;
  340. int len;
  341. *buf=0;
  342. /* create the command string to send to the UPS daemon */
  343. sprintf (send_buffer, "GET VAR %s %s\n", ups_name, varname);
  344. /* send the command to the daemon and get a response back */
  345. if (process_tcp_request
  346. (server_address, server_port, send_buffer, temp_buffer,
  347. sizeof (temp_buffer)) != STATE_OK) {
  348. printf (_("Invalid response received from host\n"));
  349. return ERROR;
  350. }
  351. ptr = temp_buffer;
  352. len = strlen(ptr);
  353. if (len > 0 && ptr[len-1] == '\n') ptr[len-1]=0;
  354. if (strcmp (ptr, "ERR UNKNOWN-UPS") == 0) {
  355. printf (_("CRITICAL - no such ups '%s' on that host\n"), ups_name);
  356. return ERROR;
  357. }
  358. if (strcmp (ptr, "ERR VAR-NOT-SUPPORTED") == 0) {
  359. /*printf ("Error: Variable '%s' is not supported\n", varname);*/
  360. return NOSUCHVAR;
  361. }
  362. if (strcmp (ptr, "ERR DATA-STALE") == 0) {
  363. printf (_("CRITICAL - UPS data is stale\n"));
  364. return ERROR;
  365. }
  366. if (strncmp (ptr, "ERR", 3) == 0) {
  367. printf (_("Unknown error: %s\n"), ptr);
  368. return ERROR;
  369. }
  370. ptr = temp_buffer + strlen (varname) + strlen (ups_name) + 6;
  371. len = strlen(ptr);
  372. if (len < 2 || ptr[0] != '"' || ptr[len-1] != '"') {
  373. printf (_("Error: unable to parse variable\n"));
  374. return ERROR;
  375. }
  376. strncpy (buf, ptr+1, len - 2);
  377. buf[len - 2] = 0;
  378. return OK;
  379. }
  380. /* Command line: CHECK_UPS -H <host_address> -u ups [-p port] [-v variable]
  381. [-wv warn_value] [-cv crit_value] [-to to_sec] */
  382. /* process command-line arguments */
  383. int
  384. process_arguments (int argc, char **argv)
  385. {
  386. int c;
  387. int option = 0;
  388. static struct option longopts[] = {
  389. {"hostname", required_argument, 0, 'H'},
  390. {"ups", required_argument, 0, 'u'},
  391. {"port", required_argument, 0, 'p'},
  392. {"critical", required_argument, 0, 'c'},
  393. {"warning", required_argument, 0, 'w'},
  394. {"timeout", required_argument, 0, 't'},
  395. {"temperature", no_argument, 0, 'T'},
  396. {"variable", required_argument, 0, 'v'},
  397. {"version", no_argument, 0, 'V'},
  398. {"help", no_argument, 0, 'h'},
  399. {0, 0, 0, 0}
  400. };
  401. if (argc < 2)
  402. return ERROR;
  403. for (c = 1; c < argc; c++) {
  404. if (strcmp ("-to", argv[c]) == 0)
  405. strcpy (argv[c], "-t");
  406. else if (strcmp ("-wt", argv[c]) == 0)
  407. strcpy (argv[c], "-w");
  408. else if (strcmp ("-ct", argv[c]) == 0)
  409. strcpy (argv[c], "-c");
  410. }
  411. while (1) {
  412. c = getopt_long (argc, argv, "hVTH:u:p:v:c:w:t:", longopts,
  413. &option);
  414. if (c == -1 || c == EOF)
  415. break;
  416. switch (c) {
  417. case '?': /* help */
  418. usage2 (_("Unknown argument"), optarg);
  419. case 'H': /* hostname */
  420. if (is_host (optarg)) {
  421. server_address = optarg;
  422. }
  423. else {
  424. usage2 (_("Invalid hostname/address"), optarg);
  425. }
  426. break;
  427. case 'T': /* FIXME: to be improved (ie "-T C" for Celsius or "-T F" for Farenheit) */
  428. temp_output_c = 1;
  429. break;
  430. case 'u': /* ups name */
  431. ups_name = optarg;
  432. break;
  433. case 'p': /* port */
  434. if (is_intpos (optarg)) {
  435. server_port = atoi (optarg);
  436. }
  437. else {
  438. usage2 (_("Port must be a positive integer"), optarg);
  439. }
  440. break;
  441. case 'c': /* critical time threshold */
  442. if (is_intnonneg (optarg)) {
  443. critical_value = atoi (optarg);
  444. check_crit = TRUE;
  445. }
  446. else {
  447. usage2 (_("Critical time must be a positive integer"), optarg);
  448. }
  449. break;
  450. case 'w': /* warning time threshold */
  451. if (is_intnonneg (optarg)) {
  452. warning_value = atoi (optarg);
  453. check_warn = TRUE;
  454. }
  455. else {
  456. usage2 (_("Warning time must be a positive integer"), optarg);
  457. }
  458. break;
  459. case 'v': /* variable */
  460. if (!strcmp (optarg, "LINE"))
  461. check_variable = UPS_UTILITY;
  462. else if (!strcmp (optarg, "TEMP"))
  463. check_variable = UPS_TEMP;
  464. else if (!strcmp (optarg, "BATTPCT"))
  465. check_variable = UPS_BATTPCT;
  466. else if (!strcmp (optarg, "LOADPCT"))
  467. check_variable = UPS_LOADPCT;
  468. else
  469. usage2 (_("Unrecognized UPS variable"), optarg);
  470. break;
  471. case 't': /* timeout */
  472. if (is_intnonneg (optarg)) {
  473. socket_timeout = atoi (optarg);
  474. }
  475. else {
  476. usage4 (_("Timeout interval must be a positive integer"));
  477. }
  478. break;
  479. case 'V': /* version */
  480. print_revision (progname, revision);
  481. exit (STATE_OK);
  482. case 'h': /* help */
  483. print_help ();
  484. exit (STATE_OK);
  485. }
  486. }
  487. if (server_address == NULL && argc > optind) {
  488. if (is_host (argv[optind]))
  489. server_address = argv[optind++];
  490. else
  491. usage2 (_("Invalid hostname/address"), optarg);
  492. }
  493. if (server_address == NULL)
  494. server_address = strdup("127.0.0.1");
  495. return validate_arguments();
  496. }
  497. int
  498. validate_arguments (void)
  499. {
  500. if (! ups_name) {
  501. printf (_("Error : no ups indicated\n"));
  502. return ERROR;
  503. }
  504. return OK;
  505. }
  506. void
  507. print_help (void)
  508. {
  509. char *myport;
  510. asprintf (&myport, "%d", PORT);
  511. print_revision (progname, revision);
  512. printf ("Copyright (c) 2000 Tom Shields");
  513. printf ("Copyright (c) 2004 Alain Richard <alain.richard@equation.fr>\n");
  514. printf ("Copyright (c) 2004 Arnaud Quette <arnaud.quette@mgeups.com>\n");
  515. printf (COPYRIGHT, copyright, email);
  516. printf (_("This plugin tests the UPS service on the specified host.\n\
  517. Network UPS Tools from www.networkupstools.org must be running for this\n\
  518. plugin to work.\n\n"));
  519. print_usage ();
  520. printf (_(UT_HELP_VRSN));
  521. printf (_(UT_HOST_PORT), 'p', myport);
  522. printf (_("\
  523. -u, --ups=STRING\n\
  524. Name of UPS\n"));
  525. printf (_("\
  526. -T, --temperature\n\
  527. Output of temperatures in Celsius\n"));
  528. printf (_(UT_WARN_CRIT));
  529. printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
  530. printf (_(UT_VERBOSE));
  531. printf (_("\
  532. This plugin attempts to determine the status of a UPS (Uninterruptible Power\n\
  533. Supply) on a local or remote host. If the UPS is online or calibrating, the\n\
  534. plugin will return an OK state. If the battery is on it will return a WARNING\n\
  535. state. If the UPS is off or has a low battery the plugin will return a CRITICAL\n\
  536. state.\n\n"));
  537. printf (_("\
  538. You may also specify a variable to check [such as temperature, utility voltage,\n\
  539. battery load, etc.] as well as warning and critical thresholds for the value of\n\
  540. that variable. If the remote host has multiple UPS that are being monitored you\n\
  541. will have to use the [ups] option to specify which UPS to check.\n\n"));
  542. printf (_("Notes:\n\n\
  543. This plugin requires that the UPSD daemon distributed with Russel Kroll's\n\
  544. Smart UPS Tools be installed on the remote host. If you do not have the\n\
  545. package installed on your system, you can download it from\n\
  546. http://www.networkupstools.org\n\n"));
  547. printf (_(UT_SUPPORT));
  548. }
  549. void
  550. print_usage (void)
  551. {
  552. printf ("\
  553. Usage: %s -H host -u ups [-p port] [-v variable]\n\
  554. [-wv warn_value] [-cv crit_value] [-to to_sec] [-T]\n", progname);
  555. }