check_snmp_printer.pl 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605
  1. #!/usr/local/bin/perl -w
  2. # check_snmp_printer - check for printer status via snmp
  3. # Supports both standard PRINT-MIB (RFC-1759) and HP Enterprise print-mib
  4. # that is supported by some of the older JetDirect interfaces
  5. # Acknowledgements:
  6. # the JetDirect code is taken from check_hpjd.c by Ethan Galstad
  7. #
  8. # The idea for the plugin (as well as some code) were taken from Jim
  9. # Trocki's pinter alert script in his "mon" utility, found at
  10. # http://www.kernel.org/software/mon
  11. #
  12. # Notes:
  13. # 'JetDirect' is copyrighted by Hewlett-Packard
  14. #
  15. #
  16. # License Information:
  17. # This program is free software; you can redistribute it and/or modify
  18. # it under the terms of the GNU General Public License as published by
  19. # the Free Software Foundation; either version 2 of the License, or
  20. # (at your option) any later version.
  21. #
  22. # This program is distributed in the hope that it will be useful,
  23. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  24. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  25. # GNU General Public License for more details.
  26. #
  27. # You should have received a copy of the GNU General Public License
  28. # along with this program; if not, write to the Free Software
  29. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  30. #
  31. ############################################################################
  32. #
  33. # TODO: Query HOST-RESOURCE MIB for a quick status
  34. #
  35. # hrPrinterStatus = .1.3.6.1.2.1.25.3.5.1;
  36. # hrPrinterDetectedErrorState = .1.3.6.1.2.1.25.3.5.1.2
  37. #
  38. # hrPrinterStatus OBJECT-TYPE
  39. # SYNTAX INTEGER {
  40. # other(1),
  41. # unknown(2),
  42. # idle(3),
  43. # printing(4),
  44. # warmup(5)
  45. # }
  46. #
  47. # hrPrinterDetectedErrorState OBJECT-TYPE
  48. # SYNTAX OCTET STRING
  49. # MAX-ACCESS read-only
  50. # STATUS current
  51. # DESCRIPTION
  52. # "This object represents any error conditions detected
  53. # by the printer. The error conditions are encoded as
  54. # bits in an octet string, with the following
  55. # definitions:
  56. #
  57. # Condition Bit #
  58. #
  59. # lowPaper 0
  60. #
  61. # noPaper 1
  62. # lowToner 2
  63. # noToner 3
  64. # doorOpen 4
  65. # jammed 5
  66. # offline 6
  67. # serviceRequested 7
  68. # inputTrayMissing 8
  69. # outputTrayMissing 9
  70. # markerSupplyMissing 10
  71. # outputNearFull 11
  72. # outputFull 12
  73. # inputTrayEmpty 13
  74. # overduePreventMaint 14
  75. #
  76. #
  77. #
  78. use strict;
  79. use Getopt::Long;
  80. use vars qw($opt_V $opt_h $opt_H $opt_P $opt_t $opt_d $session $error $answer $key
  81. $response $PROGNAME $port $hostname );
  82. use lib "utils.pm";
  83. use utils qw(%ERRORS &print_revision &support &usage );
  84. use Net::SNMP;
  85. sub print_help ();
  86. sub print_usage ();
  87. $ENV{'PATH'}='';
  88. $ENV{'BASH_ENV'}='';
  89. $ENV{'ENV'}='';
  90. # defaults
  91. my $ptype = 1; # to standard RFC printer type
  92. my $state = $ERRORS{'UNKNOWN'};
  93. my $community = "public";
  94. my $snmp_version = 1;
  95. my $port = 161;
  96. Getopt::Long::Configure('bundling');
  97. GetOptions
  98. ("d" => \$opt_d, "debug" => \$opt_d,
  99. "V" => \$opt_V, "version" => \$opt_V,
  100. "P=s" => \$opt_P, "Printer=s" => \$opt_P, # printer type - HP or RFC
  101. "v=i" => \$snmp_version, "snmp_version=i" => \$snmp_version,
  102. "p=i" => \$port, "port=i" => \$port,
  103. "C=s" => \$community,"community=s" => \$community,
  104. "h" => \$opt_h, "help" => \$opt_h,
  105. "H=s" => \$opt_H, "hostname=s" => \$opt_H);
  106. $PROGNAME = "check_snmp_printer";
  107. if ($opt_V) {
  108. print_revision($PROGNAME,'$Revision: 795 $');
  109. exit $ERRORS{'OK'};
  110. }
  111. if ($opt_h) {print_help(); exit $ERRORS{'OK'};}
  112. unless (defined $opt_H) {
  113. print "No target hostname specified\n";
  114. exit $ERRORS{"UNKNOWN"};
  115. }
  116. $hostname = $opt_H;
  117. if (! utils::is_hostname($hostname)){
  118. usage(" $hostname did not match pattern\n");
  119. exit $ERRORS{"UNKNOWN"};
  120. }
  121. if (defined $opt_P) {
  122. if ($opt_P eq "HP" ) {
  123. $ptype = 2;
  124. }elsif ($opt_P eq "RFC" ) {
  125. $ptype = 1;
  126. }else{
  127. print "Only \"HP\" and \"RFC\" are supported as printer options at this time.\n";
  128. exit $ERRORS{"UNKNOWN"};
  129. }
  130. }
  131. if ( $snmp_version =~ /[12]/ ) {
  132. ($session, $error) = Net::SNMP->session(
  133. -hostname => $hostname,
  134. -community => $community,
  135. -port => $port,
  136. -version => $snmp_version
  137. );
  138. if (!defined($session)) {
  139. $state='UNKNOWN';
  140. $answer=$error;
  141. print ("$state: no session - $answer\n");
  142. exit $ERRORS{$state};
  143. }
  144. print "Opened session|" if (defined ($opt_d));
  145. }elsif ( $snmp_version =~ /3/ ) {
  146. $state='UNKNOWN';
  147. print ("$state: No support for SNMP v3 yet\n");
  148. exit $ERRORS{$state};
  149. }else{
  150. $state='UNKNOWN';
  151. print ("$state: No support for SNMP v$snmp_version yet\n");
  152. exit $ERRORS{$state};
  153. }
  154. ### main logic
  155. if ( $ptype == 1 ) { # STD MIB
  156. print "STD-MIB|" if (defined ($opt_d));
  157. my %snmp_response;
  158. my $snmp_index;
  159. my $col_oid;
  160. my %std_mib_inst_count ;
  161. my %std_mib_instances;
  162. my $display;
  163. my $inst;
  164. my $group;
  165. #### RFC1759 MIB OIDS
  166. # sub-unit status - textual convention
  167. my $subunit_status; # integer from 0-126
  168. # column oid - not instances
  169. my %std_mib = (
  170. std_mib_input_status => ".1.3.6.1.2.1.43.8.2.1.11", # 2 element index
  171. std_mib_input_name => ".1.3.6.1.2.1.43.8.2.1.13",
  172. std_mib_output_remaining_capacity => ".1.3.6.1.2.1.43.9.2.1.5",
  173. std_mib_output_status => ".1.3.6.1.2.1.43.9.2.1.6",
  174. std_mib_marker_tech => ".1.3.6.1.2.1.43.10.2.1.2",
  175. std_mib_marker_counter_unit => ".1.3.6.1.2.1.43.10.2.1.3",
  176. std_mib_marker_life_count => ".1.3.6.1.2.1.43.10.2.1.4",
  177. std_mib_marker_status => ".1.3.6.1.2.1.43.10.2.1.15",
  178. std_mib_supplies_type => ".1.3.6.1.2.1.43.11.1.1.5",
  179. std_mib_supplies_level => ".1.3.6.1.2.1.43.11.1.1.9",
  180. std_mib_media_path_type => ".1.3.6.1.2.1.43.13.4.1.9",
  181. std_mib_media_path_status => ".1.3.6.1.2.1.43.13.4.1.11",
  182. std_mib_status_display => ".1.3.6.1.2.1.43.16.5.1.2", # 2 element index
  183. std_mib_alert_sev_level => ".1.3.6.1.2.1.43.18.1.1.2",
  184. std_mib_alert_grp => ".1.3.6.1.2.1.43.18.1.1.4",
  185. std_mib_alert_location => ".1.3.6.1.2.1.43.18.1.1.5",
  186. );
  187. my %std_mib_marker_tech = (
  188. 1 => "other",
  189. 2 => "unknown",
  190. 3 => "electrophotographicLED",
  191. 4 => "electrophotographicLaser",
  192. 5 => "electrophotographicOther",
  193. 6 => "impactMovingHeadDotMatrix9pin",
  194. 7 => "impactMovingHeadDotMatrix24pin",
  195. 8 => "impactMovingHeadDotMatrixOther",
  196. 9 => "impactMovingHeadFullyFormed",
  197. 10 => "impactBand",
  198. 11 => "impactOther",
  199. 12 => "inkjectAqueous",
  200. 13 => "inkjetSolid",
  201. 14 => "inkjetOther",
  202. 15 => "pen",
  203. 16 => "thermalTransfer",
  204. 17 => "thermalSensitive",
  205. 18 => "thermalDiffusion",
  206. 19 => "thermalOther",
  207. 20 => "electroerosion",
  208. 21 => "electrostatic",
  209. 22 => "photographicMicrofiche",
  210. 23 => "photographicImagesetter",
  211. 24 => "photographicOther",
  212. 25 => "ionDeposition",
  213. 26 => "eBeam",
  214. 27 => "typesetter",
  215. );
  216. my %std_mib_marker_counter_units = (
  217. 3 => "tenThousandthsOfInches",
  218. 4 => "micrometers",
  219. 5 => "characters",
  220. 6 => "lines",
  221. 7 => "impressions",
  222. 8 => "sheets",
  223. 9 => "dotRow",
  224. 11 => "hours",
  225. 16 => "feet",
  226. 17 => "meters",
  227. );
  228. my %std_mib_alert_groups = (
  229. 1 => "unspecifiedOther",
  230. 3 => "printerStorageMemory", # hostResourcesMIBStorageTable
  231. 4 => "internalDevice", # hostResourcesMIBDeviceTable
  232. 5 => "generalPrinter",
  233. 6 => "cover",
  234. 7 => "localization",
  235. 8 => "input",
  236. 9 => "output",
  237. 10 => "marker",
  238. 11 => "markerSupplies",
  239. 12 => "markerColorant",
  240. 13 => "mediaPath",
  241. 14 => "connectionChannel",
  242. 15 => "interpreter",
  243. 16 => "consoleDisplayBuffer",
  244. 17 => "consoleLights",
  245. );
  246. my %std_mib_prt_alert_code = (
  247. 1 => "other", # ok if on power save
  248. 2 => "unknown",
  249. # -- codes common to serveral groups
  250. 3 => "coverOpen",
  251. 4 => "coverClosed",
  252. 5 => "interlockOpen",
  253. 6 => "interlockClosed",
  254. 7 => "configurationChange",
  255. 8 => "jam", # critical
  256. # -- general Printer group
  257. 501 => "doorOpen",
  258. 502 => "doorClosed",
  259. 503 => "powerUp",
  260. 504 => "powerDown",
  261. # -- Input Group
  262. 801 => "inputMediaTrayMissing",
  263. 802 => "inputMediaSizeChange",
  264. 803 => "inputMediaWeightChange",
  265. 804 => "inputMediaTypeChange",
  266. 805 => "inputMediaColorChange",
  267. 806 => "inputMediaFormPartsChange",
  268. 807 => "inputMediaSupplyLow",
  269. 808 => "inputMediaSupplyEmpty",
  270. # -- Output Group
  271. 901 => "outputMediaTrayMissing",
  272. 902 => "outputMediaTrayAlmostFull",
  273. 903 => "outputMediaTrayFull",
  274. # -- Marker group
  275. 1001 => "markerFuserUnderTemperature",
  276. 1002 => "markerFuserOverTemperature",
  277. # -- Marker Supplies group
  278. 1101 => "markerTonerEmpty",
  279. 1102 => "markerInkEmpty",
  280. 1103 => "markerPrintRibbonEmpty",
  281. 1104 => "markerTonerAlmostEmpty",
  282. 1105 => "markerInkAlmostEmpty",
  283. 1106 => "markerPrintRibbonAlmostEmpty",
  284. 1107 => "markerWasteTonerReceptacleAlmostFull",
  285. 1108 => "markerWasteInkReceptacleAlmostFull",
  286. 1109 => "markerWasteTonerReceptacleFull",
  287. 1110 => "markerWasteInkReceptacleFull",
  288. 1111 => "markerOpcLifeAlmostOver",
  289. 1112 => "markerOpcLifeOver",
  290. 1113 => "markerDeveloperAlmostEmpty",
  291. 1114 => "markerDeveloperEmpty",
  292. # -- Media Path Device Group
  293. 1301 => "mediaPathMediaTrayMissing",
  294. 1302 => "mediaPathMediaTrayAlmostFull",
  295. 1303 => "mediaPathMediaTrayFull",
  296. # -- interpreter Group
  297. 1501 => "interpreterMemoryIncrease",
  298. 1502 => "interpreterMemoryDecrease",
  299. 1503 => "interpreterCartridgeAdded",
  300. 1504 => "interpreterCartridgeDeleted",
  301. 1505 => "interpreterResourceAdded",
  302. 1506 => "interpreterResourceDeleted",
  303. );
  304. ## Need multiple passes as oids are all part of tables
  305. foreach $col_oid (sort keys %std_mib ){
  306. if ( !defined( $response = $session->get_table($std_mib{$col_oid}) ) ) {
  307. print "Error col_oid $col_oid|" if (defined ($opt_d));
  308. if (! ($col_oid =~ m/std_mib_alert/ ) ) { # alerts don't have to exist all the time!
  309. $answer=$session->error;
  310. $session->close;
  311. $state = 'CRITICAL';
  312. print ("$state: $answer for $std_mib{$col_oid}\n");
  313. exit $ERRORS{$state};
  314. }
  315. }
  316. print "NoError col_oid $col_oid|" if (defined ($opt_d));
  317. foreach $key (keys %{$response}) {
  318. $key =~ /.*\.(\d+)\.(\d+)$/; # all oids have a two part index appended
  319. $snmp_index = $1 . "." . $2;
  320. print "\n$key => $col_oid.$snmp_index = $response->{$key} \n" if (defined ($opt_d));
  321. $snmp_response{$key} = $response->{$key} ;
  322. $std_mib_inst_count{$col_oid} += 1 ; # count how many instances
  323. $std_mib_instances{$col_oid} .= $snmp_index .":" ;
  324. }
  325. }
  326. #foreach $key ( keys %std_mib_inst_count) {
  327. # print "$key = $std_mib_inst_count{$key} $std_mib_instances{$key} \n";
  328. #}
  329. # get (total) "page count" - perfdata
  330. #print "\n \n $std_mib_instances{'std_mib_marker_tech'} \n";
  331. # how many marker technologies are in use?
  332. my ($pg, $pt, $pfd);
  333. my @mark_tech = split(/:/, $std_mib_instances{'std_mib_marker_tech'});
  334. foreach $inst (sort @mark_tech){
  335. $pfd = $std_mib_marker_tech{$snmp_response{$std_mib{'std_mib_marker_tech'}."." .$inst}} ;
  336. $pfd .= ",".$snmp_response{$std_mib{'std_mib_marker_life_count'}.".".$inst};
  337. $pfd .= ",".$std_mib_marker_counter_units{$snmp_response{$std_mib{'std_mib_marker_counter_unit'}.".".$inst}};
  338. $pfd .= ";"; #perf data separator for multiple marker tech
  339. print "pfd = $pfd\n" if (defined ($opt_d));
  340. };
  341. # combine all lines of status display into one line
  342. #$std_mib_instances{'std_mib_status_display'} = substr($std_mib_instances{'std_mib_status_display'}, 1);
  343. my @display_index = split(/:/, $std_mib_instances{'std_mib_status_display'} );
  344. foreach $inst ( sort @display_index) {
  345. $display .= $snmp_response{$std_mib{'std_mib_status_display'} . "." . $inst} . " ";
  346. }
  347. # see if there are any alerts
  348. if (defined ( $std_mib_inst_count{'std_mib_alert_sev_level'} ) ) {
  349. if ( ( lc($display) =~ /save/ || lc($display) =~ /warm/ ) && $std_mib_inst_count{'std_mib_alert_sev_level'} == 1 ) {
  350. $state='OK';
  351. $answer = "Printer ok - $display";
  352. print $answer . "|$pfd\n";
  353. exit $ERRORS{$state};
  354. }
  355. # sometime during transitions from power save to warming there are 2 alerts
  356. # if the 2nd alert is for something else it should get caught in the
  357. # next call since warmup typically is much smaller than check time
  358. # interval.
  359. if ( lc($display) =~ /warm/ && $std_mib_inst_count{'std_mib_alert_sev_level'} == 2 ) {
  360. $state='OK';
  361. $answer = "$state: Printer - $display";
  362. print $answer . "|$pfd\n";
  363. exit $ERRORS{$state};
  364. }
  365. # We have alerts and the display does not say power save or warming up
  366. $std_mib_instances{'std_mib_alert_sev_level'} = substr($std_mib_instances{'std_mib_alert_sev_level'}, 1);
  367. @display_index = split(/:/, $std_mib_instances{'std_mib_alert_sev_level'} );
  368. $answer = "Alert location(s): ";
  369. for $inst (@display_index) {
  370. $state = 'WARNING';
  371. if ( $snmp_response{$std_mib{'std_mib_alert_location'} . "." . $inst} < 1) {
  372. $answer .= "unknown location ";
  373. }else{
  374. $answer .= $std_mib_prt_alert_code{$snmp_response{$std_mib{'std_mib_alert_location'} . "." . $inst} } . " ";
  375. #print $std_mib_prt_alert_code{$snmp_response{$std_mib{'std_mib_alert_location'}. "." . $inst}} ;
  376. }
  377. }
  378. print "$state: $answer|$pfd\n";
  379. exit $ERRORS{$state};
  380. }else{
  381. $state='OK';
  382. $answer = "$state: Printer ok - $display ";
  383. print $answer . "|$pfd\n";
  384. exit $ERRORS{$state};
  385. }
  386. }
  387. elsif( $ptype == 2 ) { # HP MIB - JetDirect
  388. #### HP MIB OIDS - instance OIDs
  389. my $HPJD_LINE_STATUS= ".1.3.6.1.4.1.11.2.3.9.1.1.2.1.0";
  390. my $HPJD_PAPER_STATUS= ".1.3.6.1.4.1.11.2.3.9.1.1.2.2.0";
  391. my $HPJD_INTERVENTION_REQUIRED= ".1.3.6.1.4.1.11.2.3.9.1.1.2.3.0";
  392. my $HPJD_GD_PERIPHERAL_ERROR= ".1.3.6.1.4.1.11.2.3.9.1.1.2.6.0";
  393. my $HPJD_GD_PAPER_JAM= ".1.3.6.1.4.1.11.2.3.9.1.1.2.8.0";
  394. my $HPJD_GD_PAPER_OUT= ".1.3.6.1.4.1.11.2.3.9.1.1.2.9.0";
  395. my $HPJD_GD_TONER_LOW= ".1.3.6.1.4.1.11.2.3.9.1.1.2.10.0";
  396. my $HPJD_GD_PAGE_PUNT= ".1.3.6.1.4.1.11.2.3.9.1.1.2.11.0";
  397. my $HPJD_GD_MEMORY_OUT= ".1.3.6.1.4.1.11.2.3.9.1.1.2.12.0";
  398. my $HPJD_GD_DOOR_OPEN= ".1.3.6.1.4.1.11.2.3.9.1.1.2.17.0";
  399. my $HPJD_GD_PAPER_OUTPUT= ".1.3.6.1.4.1.11.2.3.9.1.1.2.19.0";
  400. my $HPJD_GD_STATUS_DISPLAY= ".1.3.6.1.4.1.11.2.3.9.1.1.3.0";
  401. #define ONLINE 0
  402. #define OFFLINE 1
  403. my @hp_oids = ( $HPJD_LINE_STATUS,$HPJD_PAPER_STATUS,$HPJD_INTERVENTION_REQUIRED,$HPJD_GD_PERIPHERAL_ERROR,
  404. $HPJD_GD_PAPER_JAM,$HPJD_GD_PAPER_OUT,$HPJD_GD_TONER_LOW,$HPJD_GD_PAGE_PUNT,$HPJD_GD_MEMORY_OUT,
  405. $HPJD_GD_DOOR_OPEN,$HPJD_GD_PAPER_OUTPUT,$HPJD_GD_STATUS_DISPLAY);
  406. $state = $ERRORS{'OK'};
  407. if (!defined($response = $session->get_request(@hp_oids))) {
  408. $answer=$session->error;
  409. $session->close;
  410. $state = 'CRITICAL';
  411. print ("$state: $answer \n");
  412. exit $ERRORS{$state};
  413. }
  414. # cycle thru the responses and set the appropriate state
  415. if($response->{$HPJD_GD_PAPER_JAM} ) {
  416. $state='WARNING';
  417. $answer = "Paper Jam";
  418. }
  419. elsif($response->{$HPJD_GD_PAPER_OUT} ) {
  420. $state='WARNING';
  421. $answer = "Out of Paper";
  422. }
  423. elsif($response->{$HPJD_LINE_STATUS} ) {
  424. if ($response->{$HPJD_LINE_STATUS} ne "POWERSAVE ON" ) {
  425. $state='WARNING';
  426. $answer = "Printer Offline";
  427. }
  428. }
  429. elsif($response->{$HPJD_GD_PERIPHERAL_ERROR} ) {
  430. $state='WARNING';
  431. $answer = "Peripheral Error";
  432. }
  433. elsif($response->{$HPJD_INTERVENTION_REQUIRED} ) {
  434. $state='WARNING';
  435. $answer = "Intervention Required";
  436. }
  437. elsif($response->{$HPJD_GD_TONER_LOW} ) {
  438. $state='WARNING';
  439. $answer = "Toner Low";
  440. }
  441. elsif($response->{$HPJD_GD_MEMORY_OUT} ) {
  442. $state='WARNING';
  443. $answer = "Insufficient Memory";
  444. }
  445. elsif($response->{$HPJD_GD_DOOR_OPEN} ) {
  446. $state='WARNING';
  447. $answer = "Insufficient Memory";
  448. }
  449. elsif($response->{$HPJD_GD_PAPER_OUTPUT} ) {
  450. $state='WARNING';
  451. $answer = "OutPut Tray is Full";
  452. }
  453. elsif($response->{$HPJD_GD_PAGE_PUNT} ) {
  454. $state='WARNING';
  455. $answer = "Data too slow for Engine";
  456. }
  457. elsif($response->{$HPJD_PAPER_STATUS} ) {
  458. $state='WARNING';
  459. $answer = "Unknown Paper Error";
  460. }
  461. else # add code to parse STATUS DISPLAY here
  462. {
  463. $state='OK';
  464. $answer = "Printer ok - $response->{$HPJD_GD_STATUS_DISPLAY} ";
  465. }
  466. # print and exit
  467. print "$state: $answer \n";
  468. exit $ERRORS{$state};
  469. }
  470. else{ # 3rd printer type - not yet supported
  471. print "Printer type $opt_P has not been implemented\n";
  472. $state='UNKNOWN';
  473. exit $ERRORS{$state};
  474. }
  475. #### subroutines
  476. sub unit_status {
  477. my $stat = shift;
  478. }
  479. sub print_usage () {
  480. print "Usage: $PROGNAME -H <host> [-C community] [-P HP or RFC] [-p port] [-v snmp_version] [-h help] [-V version]\n";
  481. }
  482. sub print_help () {
  483. print_revision($PROGNAME,'$Revision: 795 $');
  484. print "Copyright (c) 2002 Subhendu Ghosh/Ethan Galstad.
  485. This plugin reports the status of an network printer with an SNMP management
  486. module.
  487. ";
  488. print_usage();
  489. print "
  490. -H, --hostname=HOST
  491. Name or IP address of host to check
  492. -C --community
  493. snmp community string (default: public)
  494. -P --Printer
  495. supported values are \"HP\" for Jetdirect printers and
  496. \"RFC\" for RFC 1759 Print MIB based implementations (default: RFC)
  497. -p --port
  498. Port where snmp agent is listening (default: 161)
  499. -v --snmp_version
  500. SNMP version to use (default: version 1)
  501. -h --help
  502. This screen
  503. -V --version
  504. Plugin version
  505. ";
  506. support();
  507. }