Created
June 19, 2023 14:03
-
-
Save earnhardt3rd/96fe5c5e07b15559d4d1a04490b20392 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'getopts.pl'; | |
| Getopts('m:d:t'); | |
| my $MODE = uc($opt_m) || ""; | |
| my $DEBUG = $opt_d || 0; | |
| if (defined $opt_t) { my %TEST = &_STATS_HELP();} | |
| 1; | |
| sub _STATS_HELP { | |
| #my $calling_sub = (caller(0))[3]; | |
| #print "CALLER:$calling_sub\n"; | |
| my $HelpMsg = " PDM_STATS \n"; | |
| $HelpMsg .= " ----------- \n"; | |
| $HelpMsg .= " In summary: this tool will store a list of command(s) to be executed by pdm_getstats \n"; | |
| $HelpMsg .= " ------------------------------------------------------------------------------------ \n"; | |
| if (uc($USER_ACCESS) =~ /ADMIN/) { | |
| $HelpMsg .= " To manage the command list, use: 'pdm_stats setup' ~ follow the prompts \n"; | |
| $HelpMsg .= " \n"; | |
| if (scalar(keys %SUBS) <= 0) {&_GET_SUBS();} | |
| if (scalar(keys %SUBS) > 0) { | |
| $HelpMsg.= " ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: \n"; | |
| $HelpMsg.= " SPECIAL: 'Commands' that will call internal sub procedures \n"; | |
| $HelpMsg.= " .......................................................... \n"; | |
| $HelpMsg.= " In most cases, you will need to pass 'WAIT' to prevent premature creation of tarball! \n"; | |
| $HelpMsg.= " Example: \n"; | |
| $HelpMsg.= " ACTIVE SEQ CRON FILTER APP OS RESULTS_FILE Command Parameters \n"; | |
| $HelpMsg.= " Y 20 ALL W win_events.txt _WIN_EVENTS WAIT \n"; | |
| #no strict 'subs'; | |
| #use Data::Dumper; | |
| #$Data::Dumper::Deparse=1; | |
| use B qw(svref_2object); | |
| $HelpMsg.= " \n"; | |
| $HelpMsg.= " PUBLISHED METHODS: \n"; | |
| $HelpMsg.= " ----------------- \n"; | |
| foreach my $skey(sort keys %SUBS) { | |
| if ($skey =~ /^_PUB/) { | |
| #my $subCode = Dumper $SUBS{$skey}; | |
| my $cv = svref_2object($SUBS{$skey}); | |
| my $gv = $cv->GV; | |
| my $alt_key = $skey; | |
| $alt_key =~ s/^_PUB//; | |
| $HelpMsg.= sprintf " %-s\n",$alt_key; | |
| } | |
| } | |
| $HelpMsg.= " ----------------- \n"; | |
| $HelpMsg.= " ^:] Actually, any valid sub-procedure can be used. Use pdm_sub to see full list. \n"; | |
| $HelpMsg.= " ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: \n"; | |
| } | |
| $HelpMsg.="\n"; | |
| $HelpMsg.=" Also note that 'Parameters' can lead with any pdm_roots value!\n"; | |
| $HelpMsg.=" ex. Command Parameters\n"; | |
| $HelpMsg.=" ls NXROOT/bopcfg/www/CATALINA_BASE/temp\n"; | |
| $HelpMsg.=" ..................................................................................................... \n"; | |
| $HelpMsg.=" CRON Syntax: <YYYY>!<MM>!<MD>!<WD>!<HR>!<MN>\n"; | |
| $HelpMsg.=" -<YYYY> : Year 2013\n"; | |
| $HelpMsg.=" -<MM> : Month 0-11\n"; | |
| $HelpMsg.=" -<MD> : Month Day 0-30\n"; | |
| $HelpMsg.=" -<WD> : Week Day 0-6\n"; | |
| $HelpMsg.=" -<HR> : Hour 0-23\n"; | |
| $HelpMsg.=" -<MN> : Minute 0-59\n"; | |
| $HelpMsg.=" CORN Rules:\n"; | |
| $HelpMsg.=" 1. If token='', job will RUN regardless of mode................................................... \n"; | |
| $HelpMsg.=" 2. If token='N', job will be skipped during CRON mode and will RUN in regular mode................ \n"; | |
| $HelpMsg.=" 3. All Other Tokens are parsed from left to right, so single token will always be 'MN'\n"; | |
| $HelpMsg.=" 4. Each token can be sub-divided with single range(xx-yy) and/or multi-range(xx-yy,aa-bb)\n"; | |
| $HelpMsg.=" CRON Examples:\n"; | |
| $HelpMsg.=" 1. Simply every Friday 5:00PM Rule:[*!*!*!5!17!0] or [5!17!0]\n"; | |
| $HelpMsg.=" 2. First Day of each Month 8:00AM Rule:[*!*!1!*!8!0] or [8!0]\n"; | |
| $HelpMsg.=" 3. Every Monday,Wednesday,Friday at full interval Rule:[*!*!*!1,3,5!*!*] or [1,3,5!*!*]\n"; | |
| $HelpMsg.=" 4. Every Quarter 5PM Rule:[*!4,7,10,1!*!*!17!0] or [4,7,10,1!*!*!17!0]\n"; | |
| $HelpMsg.=" ..................................................................................................... \n"; | |
| $HelpMsg.=" Special Notice\n"; | |
| $HelpMsg.=" --------------\n"; | |
| $HelpMsg.=" To capture web_stats for PDM/stats graphs, you must add a special line\n"; | |
| $HelpMsg.=" to pdm_stats with a unique OS TAG equal to 'WM' or 'LM'\n"; | |
| $HelpMsg.=" This will trigger a special internal method to write a file to PDM/stats/DT folder\n"; | |
| $HelpMsg.=" Here's an example:\n"; | |
| $HelpMsg.=" Y;85; ;TAG=APP-00-PRI,HOST=THIS;USD;WM;pdm_webstat-r-n-d.txt:=:pdm_webstat;-r -n -d\n"; | |
| if ($DEBUG > 100) { | |
| my $Sample.="#!:=:#!FALSE#!FALSE\n"; | |
| $Sample.="#-------------------------------------------------\n"; | |
| $Sample.="# Modified on 2012_09_16 022528 by frank-earnhardt\n"; | |
| $Sample.="#-------------------------------------------------\n"; | |
| $Sample.=":HAG:hFile:=:PDM_-_MVC_-_SRC_-__CTRL_-_SYS_-_.pdm_stats\n"; | |
| $Sample.=":HAG:hKeyCase:=:\n"; | |
| $Sample.=":HAG:hKeyMask:=:ACTIVE,SEQ,CRON,FILTER,APP,OS,RESULTS_FILE\n"; | |
| $Sample.=":HAG:hKeySep:=:;\n"; | |
| $Sample.=":HAG:hKeyTitle:=:MANAGE CONFIGURED STATS LIST\n"; | |
| $Sample.=":HAG:hValCase:=:\n"; | |
| $Sample.=":HAG:hValMask:=:Command,Parameters\n"; | |
| $Sample.=":HAG:hValSep:=:;\n"; | |
| $Sample.=":HAG:hValTitle:=:ACTUAL COMMAND\n"; | |
| $Sample.="N;40; ; ;ALL;WL;netstat-b.txt:=:netstat;-b\n"; | |
| $Sample.="N;61; ;TAG=APP-00-PRI,HOST=THIS;USD;WL;pdm_vdbinfo-a.txt:=:pdm_vdbinfo;-a\n"; | |
| $Sample.="N;61; ;TAG=APP-00-PRI,HOST=THIS;USD;WL;pdm_vdbinfo-d.txt:=:pdm_vdbinfo;-d\n"; | |
| $Sample.="N;71;N;TAG=APP-02-SEC,HOST=THIS;USD;WL;pdm_vdbinfo-a.txt:=:pdm_vdbinfo;-a\n"; | |
| $Sample.="N;71;N;TAG=APP-02-SEC,HOST=THIS;USD;WL;pdm_vdbinfo-d.txt:=:pdm_vdbinfo;-d\n"; | |
| $Sample.="Y;00; ; ;ALL;WL;cataline_tmp.txt:=:ls;\"NXROOT/bopcfg/www/CATALINA_BASE/temp\"\n"; | |
| $Sample.="Y;05;;;ALL;W;processInformation.txt:=:PDM/bats/psi.exe;\n"; | |
| $Sample.="Y;10; ; ;ALL;L;free-l-t.txt:=:free;-l -t\n"; | |
| $Sample.="Y;10; ; ;ALL;L;ps-elf.txt:=:ps;-elf\n"; | |
| $Sample.="Y;10; ; ;ALL;L;top-b-n1.txt:=:top;-b -n1\n"; | |
| $Sample.="Y;10; ; ;ALL;W;tasklist-v.csv:=:ps;/V /FO CSV\n"; | |
| $Sample.="Y;20; ; ;ALL;W;diskSpaceInfo.txt:=:PDM/bats/dsi.exe;-l:E -s:BYtes -f:\n"; | |
| $Sample.="Y;20; ; ;ALL;W;systeminfo.txt:=:systeminfo;\n"; | |
| $Sample.="Y;20; ; ;ALL;WL;diskinfo.txt:=:df;\n"; | |
| $Sample.="Y;20; ; ;ALL;W;win_events.txt:=:_PUB_WIN_EVENTS;WAIT\n"; | |
| $Sample.="Y;30; ; ;ALL;L;iostat.txt:=:iostat;\n"; | |
| $Sample.="Y;30; ; ;ALL;L;lsof.txt:=:lsof;\n"; | |
| $Sample.="Y;40; ; ;ALL;WL;netstat-abn.txt:=:netstat;-abn\n"; | |
| $Sample.="Y;40; ; ;ALL;WL;netstat-e.txt:=:netstat;-e\n"; | |
| $Sample.="Y;40; ; ;ALL;WL;netstat-r.txt:=:netstat;-r\n"; | |
| $Sample.="Y;40; ; ;ALL;WL;netstat-s.txt:=:netstat;-s\n"; | |
| $Sample.="Y;50; ; ;ALL;L;vmstat.txt:=:vmstat;-a -m\n"; | |
| $Sample.="Y;50; ; ;ALL;W;powerpath.txt:=:powermt;display dev\n"; | |
| $Sample.="Y;60; ;TAG=APP-00-PRI,HOST=THIS;USD;WL;pdm_listconn-s-c.txt:=:pdm_listconn;-s -c\n"; | |
| $Sample.="Y;60; ;TAG=APP-00-PRI,HOST=THIS;USD;WL;pdm_status.txt:=:pdm_status;\n"; | |
| $Sample.="Y;60; ;TAG=APP-00-PRI,HOST=THIS;USD;WL;pdm_webstat-n-d.txt:=:pdm_webstat;-n -D\n"; | |
| $Sample.="Y;60; ;TAG=APP-00-PRI,HOST=THIS;USD;WL;slstat.txt:=:slstat;\n"; | |
| $Sample.="Y;70;N;TAG=APP-02-SEC,HOST=THIS;USD;WL;pdm_listconn-s-c.txt:=:pdm_listconn;-s -c\n"; | |
| $Sample.="Y;70;N;TAG=APP-02-SEC,HOST=THIS;USD;WL;pdm_status.txt:=:pdm_status;\n"; | |
| $Sample.="Y;70;N;TAG=APP-02-SEC,HOST=THIS;USD;WL;pdm_webstat-n-d.txt:=:pdm_webstat;-n -D\n"; | |
| $Sample.="Y;70;N;TAG=APP-02-SEC,HOST=THIS;USD;WL;slstat.txt:=:slstat;\n"; | |
| $Sample.="Y;80;;TAG=APP-00-PRI,HOST=THIS;USD;W;lock_mon.txt:=:_PUB_LOCK_MONITOR;\n"; | |
| $Sample.="Y;80;;TAG=APP-00-PRI,HOST=THIS;USD;W;resetTemplate.txt:=:PDM/scripts/SPECTRUM/CFG/runResetTemplates.bat; \n"; | |
| $Sample.="Y;85; ;TAG=APP-00-PRI,HOST=THIS;USD;WM;pdm_webstat-r-n-d.txt:=:pdm_webstat;-r -n -d\n"; | |
| $Sample.="Y;99; ;TAG=APP-00-PRI,HOST=THIS;USD;W;SPECTRUM_RESET.txt:=:perl;PDM/MVC/BIN/frank-earnhardt/smon.pl\n"; | |
| $HelpMsg.= &displayMessageInBox(" *** THE FOLLOWING IS A WROKING EXAMPLE OF .pdm_stats *** \n"); | |
| $HelpMsg.= &displayMessageInBox($Sample); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment