#!/usr/bin/perl -w # StackSys - Open Daemon Support for Business # clubpacswestmi.net - All your Modalities are Belong to US # This is a nagios plugin for DICOM services. The script is a wrapper for # dcmtk's (http://dicom.offis.de/dcmtk.php.en) echoscu to monitor # STORE SCP. It will have to be installed (or # the binary built) on the nagios system. # Make sure the DCMDICTPATH environment variable is set. # Ron Sweeney , 05/2k05 # # check_dcm.pl # define command{ # command_name check_dcm # command_line $USER1$/check_dcm -d query -a ALI_STORE_SCP -n $HOSTADDRESS$ -p 104 # } # # this script is currently under development and does not conform to # Nagios standards. # http://nagiosplug.sourceforge.net/developer-guidelines.html#PLUGOUTPUT use Getopt::Std; #use strict; use lib "/usr/local/nagios/libexec"; ## directory where I can find "utils.pm" use utils qw(%ERRORS); ####################################### ######## CONFIGURE THIS STUFF ######### ####################################### $echoscu = "/usr/local/dicom/bin/echoscu"; my($USAGE) = <<"END_OF_USAGE"; check_dcm is a nagios plug-in and wrapper for dcmtk to monitor DICOM networks USAGE: check_dcm -a [AETITLE] -n [NODE] -p [port] options: -h print this help message (makes us Nagios compliant too!) -a aetitle -n node -p port Ron Sweeney , 06/2K04 Open Daemon Support for Business All your Modalities are Belong to US END_OF_USAGE my(%options); getopts("ha:n:p:", \%options); if (exists $options{h}) { print $USAGE; exit(0); } ###################### now, lets get some shit ############################# $thing = `$echoscu -v -aet $options{a} $options{n} $options{p}`; @response = split(/\012/, $thing); foreach $result (@response) { if ($response[2] =~m/Status: Success/g ) { print $response[2]; exit($ERRORS{'OK'}); } #elsif ($result[2] =~m/TCP Initialization Error: Connection refused/g ) { #print $result[2]; #exit($ERRORS{'CRITICAL'}); #} #elsif ($result =~m/Association Rejected/g ) { #print $result; #exit($ERRORS{'CRITICAL'}); #} else { print "Indeterminate Error.\n"; #print $response; exit($ERRORS{'CRITICAL'}); } }