no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | monitors:library [2010/01/25 21:12] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== My Monitor (CHANGEME) ====== | ||
+ | |||
+ | ^ Author | [[ questy@gmail.com | Jerald Sheets ]] | | ||
+ | ^ Compatibility | Xymon 4.2 | | ||
+ | ^ Requirements | Perl, unix | | ||
+ | ^ Download | library.pl | | ||
+ | ^ Last Update | 2010-01-25 | | ||
+ | |||
+ | ===== Description ===== | ||
+ | |||
+ | Stornext check for the MDC servers. | ||
+ | |||
+ | Next, it checks for total tape drives IN USE, FREE, or DELAYED and passes those values in NCV format to the graphing engine. | ||
+ | |||
+ | ===== Installation ===== | ||
+ | === Client side === | ||
+ | |||
+ | Take the library.pl script, and place it into $HOBBITCLIENTHOME/ | ||
+ | In the $HOBBITCLIENTHOME/ | ||
+ | the end of the file: | ||
+ | |||
+ | # MDC Fsstate Data Collector. | ||
+ | # the current state of the libraries and the fsstate command. | ||
+ | | ||
+ | ENVFILE $HOBBITCLIENTHOME/ | ||
+ | CMD $HOBBITCLIENTHOME/ | ||
+ | LOGFILE $HOBBITCLIENTHOME/ | ||
+ | INTERVAL 3m | ||
+ | |||
+ | === Server side === | ||
+ | |||
+ | |||
+ | At the end of your $HOBBITSERVERHOME/ | ||
+ | add the following at the end of your " | ||
+ | |||
+ | | ||
+ | |||
+ | Next, add the following lines immediately below the " | ||
+ | |||
+ | # This defines the custom graphs specified in the above TEST2RRD section | ||
+ | | ||
+ | |||
+ | In the " | ||
+ | of the other entries. | ||
+ | |||
+ | Finally, define the graphs for these values in the Xymon graphs | ||
+ | configuration $HOBBITSERVERHOME/ | ||
+ | |||
+ | # MDC Controller Drive Status Graphs | ||
+ | [library] | ||
+ | TITLE Library Drive Utilization | ||
+ | YAXIS Number of Drives | ||
+ | DEF: | ||
+ | DEF: | ||
+ | DEF: | ||
+ | LINE2: | ||
+ | LINE2: | ||
+ | LINE2: | ||
+ | COMMENT: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | |||
+ | If all goes well, you will get a library column on your MDC servers. | ||
+ | will display the Active, Free, and Delayed tape drives and will graph each | ||
+ | one. | ||
+ | |||
+ | ===== Source ===== | ||
+ | |||
+ | ==== library.pl ==== | ||
+ | |||
+ | <hidden onHidden=" | ||
+ | < | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | ############################################################################################## | ||
+ | # # | ||
+ | # Program: | ||
+ | # Author: | ||
+ | # Initial Version: | ||
+ | # Changelog: | ||
+ | # # | ||
+ | ############################################################################################## | ||
+ | # # | ||
+ | # Purpose: | ||
+ | # does a couple things. | ||
+ | # | ||
+ | # | ||
+ | # could be that Stornext is hung, and you need to have a look. Next, it # | ||
+ | # runs fsstate and looks for how many drives are in one of three specific | ||
+ | # | ||
+ | # The amount in NCV format for use in Xymon. | ||
+ | # Xymon server to do so, it will graph the number of tapes in a particular | ||
+ | # state and provide averages over time. # | ||
+ | # # | ||
+ | ############################################################################################## | ||
+ | # # | ||
+ | # Deployment: | ||
+ | # In the $HOBBITCLIENTHOME/ | ||
+ | # the end of the file: # | ||
+ | # # | ||
+ | # # MDC Fsstate Data Collector. | ||
+ | # # the current state of the libraries and the fsstate command. | ||
+ | # [fsstate] | ||
+ | # | ||
+ | # CMD $HOBBITCLIENTHOME/ | ||
+ | # | ||
+ | # | ||
+ | # # | ||
+ | # Once you have done this, do the following on your Xymon Server: | ||
+ | # # | ||
+ | # At the end of your $HOBBITSERVERHOME/ | ||
+ | # add the following at the end of your " | ||
+ | # # | ||
+ | # | ||
+ | # # | ||
+ | # Next, add the following lines immediately below the " | ||
+ | # line. # | ||
+ | # # | ||
+ | # # This defines the custom graphs specified in the above TEST2RRD section # | ||
+ | # | ||
+ | # # | ||
+ | # In the " | ||
+ | # of the other entries. | ||
+ | # # | ||
+ | # Finally, define the graphs for these values in the Xymon graphs | ||
+ | # configuration $HOBBITSERVERHOME/ | ||
+ | # # | ||
+ | # # MDC Controller Drive Status Graphs | ||
+ | # | ||
+ | # TITLE Library Drive Utilization | ||
+ | # YAXIS Number of Drives | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # # | ||
+ | # If all goes well, you will get a library column on your MDC servers. | ||
+ | # will display the Active, Free, and Delayed tape drives and will graph each # | ||
+ | # one. # | ||
+ | # # | ||
+ | ############################################################################################## | ||
+ | |||
+ | use strict; | ||
+ | |||
+ | # My variables and commands | ||
+ | my($DEBUG) | ||
+ | my($inuse) | ||
+ | my($free) | ||
+ | my($delayed) | ||
+ | my($masterFile) = '/ | ||
+ | my($isMaster) | ||
+ | |||
+ | # Xymon Variables | ||
+ | $ENV{BBPROG} | ||
+ | my($TESTNAME) | ||
+ | my($BBHOME) | ||
+ | my($BB) | ||
+ | my($BBDISP) | ||
+ | my($BBVAR) | ||
+ | my($MACHINE) | ||
+ | my($DATE) | ||
+ | my($COLOR) | ||
+ | my($MSG) | ||
+ | my($HEAD) | ||
+ | my($DATA) | ||
+ | |||
+ | # Invoke debug routine if flag is set above | ||
+ | if ($DEBUG == 1){ | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | } | ||
+ | |||
+ | # Fsstate Processes - sanity check | ||
+ | my($FSCMD) | ||
+ | |||
+ | if($FSCMD > 5){ | ||
+ | $HEAD = "MDC Fsstate Critical.\n"; | ||
+ | $MSG = "More than 5 fsstate processes detected. | ||
+ | sendRed(); | ||
+ | sendReport(); | ||
+ | }elsif(($FSCMD == 3) || ($FSCMD == 4)){ | ||
+ | $HEAD = "MDC Fsstate Cautionary.\n"; | ||
+ | $MSG = " | ||
+ | sendYellow(); | ||
+ | sendReport(); | ||
+ | } | ||
+ | |||
+ | |||
+ | # Figure out if you're the master server or not | ||
+ | isMaster(); | ||
+ | |||
+ | # If you are the master server, set the variable. | ||
+ | if($isMaster eq " | ||
+ | | ||
+ | }else{ | ||
+ | # If you're here, you're not the master. | ||
+ | | ||
+ | | ||
+ | exit 0; | ||
+ | } | ||
+ | |||
+ | |||
+ | ################# | ||
+ | ## Subroutines ## | ||
+ | ################# | ||
+ | |||
+ | # Determines if system is the master MDC Controller | ||
+ | sub isMaster { | ||
+ | if(-e $masterFile){ | ||
+ | $isMaster = " | ||
+ | | ||
+ | $isMaster = " | ||
+ | } | ||
+ | } | ||
+ | |||
+ | # Parses the output of " | ||
+ | sub getStats { | ||
+ | | ||
+ | | ||
+ | | ||
+ | head(" | ||
+ | msg("& | ||
+ | $DATA = " | ||
+ | Active: | ||
+ | Free:$OPEN | ||
+ | Delayed: | ||
+ | "; | ||
+ | | ||
+ | | ||
+ | } | ||
+ | |||
+ | # In the event this is not the master server, this empties the variables and sends a " | ||
+ | # the server for this host, preventing purple (no data) being sent to the server for this host. | ||
+ | # All other statuses here simply set the color when called. | ||
+ | sub sendClear { | ||
+ | $MSG = $DATA = $HEAD = ''; | ||
+ | | ||
+ | } | ||
+ | |||
+ | sub sendRed { | ||
+ | | ||
+ | } | ||
+ | |||
+ | sub sendYellow { | ||
+ | | ||
+ | } | ||
+ | |||
+ | sub sendGreen { | ||
+ | | ||
+ | } | ||
+ | |||
+ | # This runs the local bb instance and sends the report with all the values necessary to set | ||
+ | # the Xymon server in the appropriate status | ||
+ | sub sendReport { | ||
+ | | ||
+ | my($cmd) = "$BB $BBDISP \" | ||
+ | system($cmd); | ||
+ | } | ||
+ | |||
+ | # Format the header | ||
+ | sub head | ||
+ | { | ||
+ | $HEAD = " | ||
+ | } | ||
+ | |||
+ | |||
+ | # Clean up messaging a bit | ||
+ | sub msg | ||
+ | { | ||
+ | $MSG .= join(" | ||
+ | } | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ===== Known Bugs and Issues ===== | ||
+ | |||
+ | This has only been tested on StorNext MDC servers running on Linux. | ||
+ | |||
+ | ===== To Do ===== | ||
+ | |||
+ | Make the code prettier here in-house, and split our libraries into multiple graphs. | ||
+ | |||
+ | ===== Credits ===== | ||
+ | |||
+ | There' | ||
+ | |||
+ | ===== Changelog ===== | ||
+ | |||
+ | * **2010-01-25** | ||
+ | * Initial release | ||