check_remote_nagios_status.pl 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666
  1. #!/usr/bin/perl -w
  2. # check_status.pl Nagios Plugin - Version 1.3
  3. # Last Updated: 1/9/2003
  4. #
  5. # Report any bugs/questions to Russell Scibetti at russell@quadrix.com
  6. #
  7. # check_status Change Log:
  8. #
  9. # To do for 1.4
  10. # - Better help and documentation (separate doc?)
  11. # - Take argument (patterns to match) from a separate spec file
  12. #
  13. # New Addition to 1.3
  14. # - Added ChangeLog information and updated --help output
  15. # - hostdown (hd) argument for how a service check should respond
  16. # when its host is Down/Unreachable
  17. # (--hostdown="ok|warning|critical|unknown")
  18. # - Changed name from check_state to check_status
  19. # - Set hostdown to default to OK when the argument isn't specified
  20. # - Number of Hosts checked is now output in OK result
  21. #
  22. # Version 1.2 additions:
  23. #
  24. # - Added ability to handle ack'd and downtimed services differently
  25. # depending on argument provided
  26. # (--ack="ok|warning|critical|unknown|down|unreachable"
  27. # --dt="ok|warning|critical|unknown|down|unreachable")
  28. #
  29. # Version 1.1 additions:
  30. #
  31. # - Added --host=<regex>, --servhost=<regex> to allow for specific field
  32. # matching (host for matching hostname in host checks, servhost for
  33. # matching the hostname in service checks, service for matching the
  34. # service name in service checks)
  35. # - Output the number of OK services for an OK output
  36. #
  37. # Version 1.0 features:
  38. #
  39. # - Freshness check of status.log (timestamp)
  40. # - Match service or host checks
  41. # - Can ignore acknowledged or downtimes services/hosts (--ack, --dt)
  42. # - Can output different levels of detail dependent on # of problems
  43. # - Can check for number of critical, warning, or unknowns
  44. #
  45. #############################################################
  46. use Getopt::Long;
  47. use File::stat;
  48. Getopt::Long::Configure('bundling');
  49. GetOptions
  50. ("V" => \$version, "version" => \$version,
  51. "h" => \$help, "help" => \$help,
  52. "v" => \$verbose, "verbose" => \$verbose,
  53. "w=s" => \$warning, "warning=s" => \$warning,
  54. "c=s" => \$critical, "critical=s" => \$critical,
  55. "u=s" => \$unknown, "unknown=s" => \$unknown,
  56. "p=s" => \$pattern, "pattern=s" => \$pattern,
  57. "S:s" => \$service, "service:s" => \$service,
  58. "s=s" => \$status, "status=s" => \$status,
  59. "d=s" => \$dir, "dir=s" => \$dir,
  60. "D=s" => \$details, "details=s" => \$details,
  61. "H:s" => \$host, "host:s" => \$host,
  62. "f=s" => \$freshness, "freshness=s" => \$freshness,
  63. "servhost=s" => \$servhost,
  64. "a:s" => \$ack, "ack:s" => \$ack,
  65. "dt:s"=> \$dt, "downtime:s" => \$dt,
  66. "hd:s"=> \$hdown, "hostdown:s" => \$hdown,
  67. "ok" => \$ok);
  68. #Constants:
  69. my $OK = 0;
  70. my $WARNING = 1;
  71. my $CRITICAL = 2;
  72. my $UNKNOWN = 3;
  73. my $crit="CRITICAL";
  74. my $warn="WARNING";
  75. my $unk="UNKNOWN";
  76. my $down="DOWN";
  77. my $unreach="UNREACHABLE";
  78. # Print out Help information
  79. if ($help) {
  80. printVersion();
  81. printHelp();
  82. exitcheck($UNKNOWN);
  83. }
  84. # Print out version information
  85. if ($version) {
  86. printVersion();
  87. exitcheck($UNKNOWN);
  88. }
  89. # Check for status log or directory argument or print usage
  90. if (!$status) {
  91. if (!$dir) {
  92. print "Usage: $0 -s <status file> | -d <Nagios log dir>\n";
  93. print "Use the --help option for full list of arguments\n";
  94. exitcheck($UNKNOWN);
  95. }
  96. elsif ($dir =~ m#[^/]/$#) {
  97. $status = $dir . "status.log";
  98. }
  99. else {
  100. $status = $dir . "/status.log";
  101. }
  102. }
  103. if (defined $host) {
  104. if (!$host) {
  105. $host="[^\\s]*";
  106. }
  107. }
  108. if (!$host && !$servhost) {
  109. $servhost="[^\\s]*";
  110. }
  111. if (!$host && !$service) {
  112. $service="[^\\s]*";
  113. }
  114. if (defined $ack) {
  115. if (!$ack) {
  116. $ack="ok";
  117. }
  118. elsif (!($ack =~ "ok|critical|warning|unknown|down|unreachable")) {
  119. print "Invalid value for ack\n";
  120. exitcheck($UNKNOWN);
  121. }
  122. }
  123. if (defined $dt) {
  124. if (!$dt) {
  125. $dt="ok";
  126. }
  127. elsif (!($dt =~ "ok|critical|warning|unknown|down|unreachable")) {
  128. print "Invalid value for dt\n";
  129. exitcheck($UNKNOWN);
  130. }
  131. }
  132. if (defined $hdown) {
  133. if (!$hdown) {
  134. $hdown="ok";
  135. }
  136. elsif (!($hdown =~ "ok|critical|warning|unknown|down|unreachable")) {
  137. print "Invalid value for hostdown\n";
  138. exitcheck($UNKNOWN);
  139. }
  140. }
  141. my $much_details = 0;
  142. my $ServiceNotOK = "CRITICAL|WARNING|UNKNOWN";
  143. my $HostNotOK = "DOWN|UNREACHABLE";
  144. my %numprob = ("WARNING",0,"CRITICAL",0,"UNKNOWN",0,"DOWN",0,"UNREACHABLE",0);
  145. my $CritOnly = 0;
  146. my $WarnOnly = 0;
  147. my $UnkOnly = 0;
  148. my @wlev;
  149. my @clev;
  150. my @ulev;
  151. my %warnlevel = ("WARNING",0,"CRITICAL",0,"UNKNOWN",0);
  152. my %critlevel = ("WARNING",0,"CRITICAL",0,"UNKNOWN",0);
  153. my %unklevel = ("WARNING",0,"CRITICAL",0,"UNKNOWN",0);
  154. my %hostlevel = ("DOWN",0,"UNREACHABLE",0);
  155. # Store Hosts in downtime
  156. my @hostdowntime;
  157. my $numdowntime = 0;
  158. # Store Hosts in a Down/Unreachable state
  159. my @hostdown;
  160. my $numdown = 0;
  161. # Hash for storing state-change to OK times for hosts:
  162. my %hostoktimes;
  163. # Number of matches in parsing
  164. my $nummatch = 0;
  165. if ($warning) {
  166. if ($warning =~ /,/) {
  167. @wlev = split /,/,$warning;
  168. $warnlevel{"WARNING"} = $wlev[0];
  169. $warnlevel{"CRITICAL"} = $wlev[1];
  170. if ($wlev[2] ) {
  171. $warnlevel{"UNKNOWN"} = $wlev[2];
  172. }
  173. }
  174. else {
  175. $WarnOnly = $warning;
  176. }
  177. }
  178. else {
  179. $WarnOnly = 1;
  180. }
  181. if ($critical) {
  182. if ($critical =~ /,/) {
  183. @clev = split /,/,$critical;
  184. $critlevel{"WARNING"} = $clev[0];
  185. $critlevel{"CRITICAL"} = $clev[1];
  186. if ($clev[2] ) {
  187. $critlevel{"UNKNOWN"} = $clev[2];
  188. }
  189. }
  190. else {
  191. $CritOnly = $critical;
  192. }
  193. }
  194. else {
  195. $CritOnly = 1;
  196. }
  197. if ($unknown) {
  198. if ($unknown =~ /,/) {
  199. @ulev = split /,/,$unknown;
  200. $unklevel{"WARNING"} = $ulev[0];
  201. $unklevel{"CRITICAL"} = $ulev[1];
  202. if ($ulev[2] ) {
  203. $unklevel{"UNKNOWN"} = $ulev[2];
  204. }
  205. }
  206. else {
  207. $UnkOnly = $unknown;
  208. }
  209. }
  210. else {
  211. $UnkOnly = 1;
  212. }
  213. if (!$freshness) {
  214. $freshness = 30 * 60;
  215. }
  216. else {
  217. $freshness = $freshness * 60;
  218. }
  219. my %ct = ("CRITICAL",0,"WARNING",0,"UNKNOWN",0,"DOWN",0,"UNREACHABLE",0);
  220. my %much_ct = ("CRITICAL",0,"WARNING",0,"UNKNOWN",0,"DOWN",0,"UNREACHABLE",0);
  221. my %output = ("CRITICAL","","WARNING","","UNKNOWN","","DOWN","","UNREACHABLE","");
  222. my %much_output = ("CRITICAL","","WARNING","","UNKNOWN","","DOWN","","UNREACHABLE","");
  223. if ($details) {
  224. if ($details =~ /,/) {
  225. my @tempv = split /,/,$details;
  226. $much_details = $tempv[0];
  227. $details = $tempv[1];
  228. }
  229. }
  230. open("sta","$status") || die "Cannot open status file $status!";
  231. $curr_time = time;
  232. $file_time = stat($status)->mtime;
  233. if ($curr_time - $file_time > $freshness) {
  234. printf "State CRITICAL - Status file is stale!!!\n";
  235. exitcheck($CRITICAL);
  236. }
  237. while(<sta>) {
  238. chomp;
  239. if (/^[^\s]+[\s]+HOST;/) {
  240. @hdata = split /;/,$_;
  241. # If you care about matching hosts (not services):
  242. if ($host && $hdata[1] =~ /$host/) {
  243. $nummatch++;
  244. if ( $hdata[2] =~ /$HostNotOK/ ) {
  245. addproblem($_,$hdata[2]);
  246. }
  247. }
  248. # If you are matching services, gather host information:
  249. else {
  250. if ( $hdata[2] =~ /$HostNotOK/ ) {
  251. $hostdown[$numdown] = $hdata[1];
  252. $numdown++;
  253. }
  254. else {
  255. $hostoktimes{$hdata[1]} = $hdata[4];
  256. }
  257. if ( $hdata[17] ne "0" ) {
  258. $hostdowntime[$numdowntime] = $hdata[1];
  259. $numdowntime++;
  260. }
  261. }
  262. }
  263. elsif (!$host && /^[^\s]+[\s]+SERVICE;/) {
  264. @servdata = split /;/,$_;
  265. if ( ( $pattern && ($_ =~ /$pattern/)) ||
  266. (($servdata[1] =~ /$servhost/) && ($servdata[2] =~ /$service/)) ){
  267. $nummatch++;
  268. if (($servdata[5] eq "HARD") && ($servdata[3] =~ /$ServiceNotOK/)) {
  269. addproblem($_,$servdata[3]);
  270. }
  271. }
  272. }
  273. }
  274. close("sta");
  275. if ($nummatch==0) {
  276. print "Nothing Matches your criteria!\n";
  277. exitcheck($UNKNOWN);
  278. }
  279. # Count the number of problems (for reference):
  280. if ($host) {
  281. $total = $numprob{"DOWN"} + $numprob{"UNREACHABLE"};
  282. }
  283. else {
  284. $total = $numprob{"WARNING"} + $numprob{"CRITICAL"} + $numprob{"UNKNOWN"};
  285. }
  286. my $numok = $nummatch - $total;
  287. # If this is a host state check:
  288. if ($host) {
  289. if ($numprob{"DOWN"}>0 || $numprob{"UNREACHABLE"}>0 ) {
  290. if ($details && ($total <= $details)) {
  291. print "State CRITICAL - $total Host Problems: $output{$down} $output{$unreach}\n";
  292. exitcheck($CRITICAL);
  293. }
  294. else {
  295. print "State CRITICAL - $numprob{$down} Hosts Down, $numprob{$unreach} Hosts Unreachable\n";
  296. exitcheck($CRITICAL);
  297. }
  298. }
  299. else {
  300. print "State OK - $numok Hosts Up, $total Problems\n";
  301. exitcheck($OK);
  302. }
  303. }
  304. #If you only defined a Critical level in terms of # of criticals...
  305. elsif ($CritOnly && ($numprob{"CRITICAL"} >= $CritOnly)) {
  306. countAndPrint($crit,$numprob{$crit},0);
  307. exitcheck($CRITICAL);
  308. }
  309. #Critical in terms on # criticals and # warnings...
  310. elsif (!$CritOnly && ($numprob{"WARNING"} >= $critlevel{"WARNING"} ||
  311. $numprob{"CRITICAL"} >= $critlevel{"CRITICAL"} ||
  312. $numprob{"UNKNOWN"} >= $critlevel{"UNKNOWN"} )) {
  313. countAndPrint($crit,$total,1);
  314. exitcheck($CRITICAL);
  315. }
  316. #Warning in terms of # warnings only...
  317. elsif ($WarnOnly && ($numprob{"WARNING"} >= $WarnOnly)) {
  318. countAndPrint($warn,$numprob{$warn},0);
  319. exitcheck($WARNING);
  320. }
  321. #Warning in terms of # warnings and # criticals...
  322. elsif (!$WarnOnly && ($numprob{"WARNING"} >= $warnlevel{"WARNING"} ||
  323. $numprob{"CRITICAL"} >= $warnlevel{"CRITICAL"} ||
  324. $numprob{"UNKNOWN"} >= $warnlevel{"UNKNOWN"})) {
  325. countAndPrint($warn,$total,1);
  326. exitcheck($WARNING);
  327. }
  328. #Unknown in terms on # unknown only...
  329. elsif ( $UnkOnly && ($numprob{"UNKNOWN"}>=$UnkOnly) ) {
  330. countAndPrint($unk,$numprob{$unk},0);
  331. exitcheck($UNKNOWN);
  332. }
  333. #Unknown in terms of # warning, critical, and unknown...
  334. elsif (!$UnkOnly && ($numprob{"WARNING"} >= $unklevel{"WARNING"} ||
  335. $numprob{"CRITICAL"} >= $unklevel{"CRITICAL"} ||
  336. $numprob{"UNKNOWN"} >= $unklevel{"UNKNOWN"})) {
  337. countAndPrint($unk,$total,1);
  338. exitcheck($UNKNOWN);
  339. }
  340. # Everything is OK!
  341. else {
  342. print "State OK - $numok OK, $total problems\n";
  343. exitcheck($OK);
  344. }
  345. ############################
  346. # Subroutines
  347. ############################
  348. # Return the proper exit code for Critical, Warning, Unknown, or OK
  349. sub exitcheck {
  350. if ($ok) {
  351. exit 0;
  352. }
  353. else {
  354. exit $_[0];
  355. }
  356. }
  357. # Decide what to print for services:
  358. sub countAndPrint {
  359. my $state = $_[0];
  360. my $count = $_[1];
  361. my $alltypes = $_[2];
  362. my $output = "State $state - ";
  363. if ($details) {
  364. if ($count<=$much_details) {
  365. if ($alltypes) {
  366. $output .= "$count problems: $much_output{$crit} $much_output{$warn} $much_output{$unk}";
  367. }
  368. else {
  369. $output .= "$count \L$state\E: $much_output{$state}";
  370. }
  371. }
  372. elsif ($count<=$details) {
  373. if ($alltypes) {
  374. $output .= "$count problems: $output{$crit} $output{$warn} $output{$unk}";
  375. }
  376. else {
  377. $output .= "$count \L$state\E: $output{$state}";
  378. }
  379. }
  380. else {
  381. if ($alltypes) {
  382. $output .= "$numprob{$crit} critical, $numprob{$warn} warning, $numprob{$unk} unknown";
  383. }
  384. else {
  385. $output .= "$count \L$state\E";
  386. }
  387. }
  388. }
  389. else {
  390. $output .= "$count problems";
  391. }
  392. print "$output\n";
  393. }
  394. # Add-in the problem found in the status log
  395. sub addproblem {
  396. $test = 1;
  397. $type = $_[1];
  398. my $diffout = "";
  399. my @values = split /;/,$_[0];
  400. if (!$host) {
  401. my $namehold = $values[1];
  402. if ($ack && ($values[13] eq "1")) {
  403. if ($ack =~ "ok") {
  404. $test = 0;
  405. }
  406. else {
  407. $type = "\U$ack";
  408. }
  409. }
  410. elsif ($hdown && grep /$namehold/, @hostdown) {
  411. if ($hdown =~ "ok") {
  412. $test = 0;
  413. }
  414. else {
  415. $type = "\U$hdown";
  416. $diffout = "$values[1] is down";
  417. }
  418. }
  419. elsif ($dt && (($values[27] ne "0") || (grep /$namehold/, @hostdowntime))){
  420. if ($dt =~ "ok") {
  421. $test = 0;
  422. }
  423. else {
  424. $type = "\U$dt";
  425. }
  426. }
  427. elsif (exists $hostoktimes{$namehold}) {
  428. # If the state change time of the host is more recent than the last
  429. # service check, must wait until the next service check runs!
  430. if ($hostoktimes{$namehold} > $values[6]) {
  431. $test = 0;
  432. }
  433. }
  434. }
  435. else {
  436. if ($ack && $values[5]) {
  437. if ($ack =~ "ok") {
  438. $test = 0;
  439. }
  440. else {
  441. $type = "\U$ack";
  442. }
  443. }
  444. elsif ($dt && ($values[17] ne "0")) {
  445. if ($dt =~ "ok") {
  446. $test = 0;
  447. }
  448. else {
  449. $type = "\U$dt";
  450. }
  451. }
  452. }
  453. if ($details && $test) {
  454. if (!$host) {
  455. if ($diffout) {
  456. $much_output{$type} .= " $diffout;";
  457. $output{$type} .= "$diffout;";
  458. $much_ct{$type}++;
  459. $ct{$type}++;
  460. }
  461. else {
  462. if ($much_details && $much_ct{$type}<$much_details) {
  463. $much_output{$type} .= " $values[2] on $values[1] $values[31];";
  464. $much_ct{$type}++;
  465. }
  466. if ($ct{$type} < $details) {
  467. $output{$type} .= " $values[2] on $values[1];";
  468. $ct{$type}++;
  469. }
  470. }
  471. }
  472. else {
  473. $much_output{$type} .= " $values[1] $_[1] $values[20],";
  474. $much_ct{type}++;
  475. $output{$type} .= " $values[1] HOST $_[1],";
  476. $ct{$type}++;
  477. }
  478. }
  479. if ($test) {
  480. $numprob{$type}++;
  481. }
  482. }
  483. ################################
  484. #
  485. # Version and Help Information
  486. #
  487. ################################
  488. sub printVersion {
  489. printf <<EndVersion;
  490. $0 (nagios-plugins) 1.3
  491. The nagios plugins come with ABSOLUTELY NO WARRANTY. You may redistribute
  492. copies of the plugins under the terms of the GNU General Public License.
  493. For more information about these matters, see the file named COPYING.
  494. EndVersion
  495. }
  496. sub printHelp {
  497. printf <<EOF;
  498. This plugin parses through the Nagios status log and will return a
  499. Critical, Warning, or Unknown state depending on the number of
  500. Critical, Warning, and/or Unknown services found in the log
  501. (or Down/Unreachable hosts when matching against hosts)
  502. Usage: $0 -s <Status File> | -d <Nagios Log Directory>
  503. [-w #[,#][,#]] [-c #[,#][,#]] [-u #[,#][,#]]
  504. [--service=<RegEx> | --servhost=<RegEx> | --pattern=<RegEx> |
  505. --host | --host=<RegEx>]
  506. [--ack[=string]] [--dt[=string]] [--hostdown[=string]]
  507. [-D #[,#]] [--ok] [-f <Log freshness in # minutes>]
  508. $0 --help
  509. $0 --version
  510. NOTE: One of -s and -d must be specified
  511. Options:
  512. -s, --status=FILE_NAME
  513. Location and name of status log (e.g. /usr/local/nagios/var/status.log)
  514. -d, --dir=DIRECTORY_NAME
  515. Directory that contains the nagios logs (e.g. /usr/local/nagios/var/)
  516. -w, --warning=INTEGER[,INTEGER][,INTEGER]
  517. #: Number of warnings to result in a WARNING state
  518. OR
  519. #,#: Warning,Criticals to result in a WARNING state
  520. OR
  521. #,#,#: Warning,Critical,Unknown to result in a WARNING state
  522. Default: -w=1
  523. -c, --critical=INTEGER[,INTEGER][,INTEGER]
  524. #: Number of criticals to result in a CRITICAL state
  525. OR
  526. #,#: Warning,Criticals to result in a CRITICAL state
  527. OR
  528. #,#,#: Warning,Critical,Unknown to result in a CRITICAL state
  529. Default: -c=1
  530. -u, --unknown=INTEGER[,INTEGER][,INTEGER]
  531. #: Number of unknowns to result in a UNKNOWN state
  532. OR
  533. #,#: Warning,Criticals to result in a UNKNOWN state
  534. OR
  535. #,#,#: Warning,Critical,Unknown to result in a UNKNOWN state
  536. Default: -u=1
  537. -r, --service[=REGEX]
  538. Only match services [that match the RegEx]
  539. (--service is default setting if no other matching arguments provided)
  540. --servhost=REGEX
  541. Only match services whose host match the RegEx
  542. -p, --pattern=REGEX
  543. Only parse for this regular expression (services only, not hosts)
  544. --host[=REGEX]
  545. Report on the state of hosts (whose name matches the RegEx if provided)
  546. -a, --ack[=ok|warning|critical|unknown|down|unreachable]
  547. Handle Acknowledged problems [--ack defaults to ok]
  548. --dt, --downtime[=ok|warning|critical|unknown|down|unreachable]
  549. Handle problems in scheduled downtime [--dt defaults to ok]
  550. --hd, --hostdown[=ok|warning|critical|unknown|down|unreachable]
  551. Handle services whose Host is down [--hd defaults to ok]
  552. -D, --details=INTEGER[,INTEGER]
  553. Amount of verbosity to output
  554. If # problems:
  555. <= 1st integer, return full details (each plugin's output)
  556. <= 2nd integer, return some details (list each service host pair)
  557. > 2nd integer, return the # of problems
  558. -f, --freshness=INTEGER
  559. Number of minutes old the log can be to make sure Nagios is running
  560. (Default = 30 minutes)
  561. --ok
  562. Return an OK exit code, regardless of number of problems found
  563. -h, --help
  564. Print detailed help screen
  565. -V, --version
  566. Print version information
  567. For service checking (use --service and/or --servhost):
  568. 1. The values of warning, critical, and unknown default to 1, i.e.
  569. $0 will return CRITICAL if there is at least 1 critical service,
  570. WARNING if there is at least 1 warning service, and UNKNOWN if there is
  571. at least one unknown service.
  572. 2. If a service's host is DOWN or UNREACHABLE, $0 will use the
  573. value of --hostdown to determine how to treat the service. Without that
  574. argument, $0 will count the service as OK.
  575. 3. If a service's host is OK, but the last host-state change occurred more
  576. recently than the last service check, $0 will ignore that service
  577. (want to wait until the service has been checked after a host has recovered
  578. or you may get service alert for services that still need to be checked)
  579. 4. If the --dt, --ack, or --hd tags are used, $0 will use the value
  580. of the arguments to determine how to handle services in downtime, acknowledged,
  581. or with down hosts (default=OK). For service checks, --dt will also check
  582. if the service's host is in a downtime.
  583. For host checking (use --host):
  584. 1. Using the --host argument, $0 will look for DOWN and UNREACHABLE
  585. hosts. If any are found, $0 will return a CRITICAL. You can provide
  586. an REGEX for --host to only check hosts with matching host names.
  587. 2. If the --dt or --ack tags are used, $0 will use the value of the
  588. --dt/--ack arguments to determine the state of the host (default is OK)
  589. EOF
  590. }