Skip to content
This repository has been archived by the owner on Aug 28, 2021. It is now read-only.

Commit

Permalink
version 1.3.23
Browse files Browse the repository at this point in the history
- AIX issue - non terminating processes will result in collecting stop #38
- time zone issue - additional sourcetypes (collect, clean) use a date format that includes TZ and can lead to confusion #39
  • Loading branch information
guilhemmarchand committed Jun 24, 2017
1 parent 37f4e44 commit d7f6e72
Show file tree
Hide file tree
Showing 11 changed files with 161 additions and 51 deletions.
15 changes: 10 additions & 5 deletions TA-nmon/bin/fifo_consumer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
# Guilhem Marchand 2017/05/29, error in rotated files naming for purge rm command
# Guilhem Marchand 2017/05/30, improvements to prevent gaps in data
# Guilhem Marchand 2017/06/04, manage nmon external metrics in dedicated file
# Guilhem Marchand 2017/06/04, manage nmon external header in dedicated file
# Guilhem Marchand 2017/06/04, specify explicit date format to prevent time zone issues

# Version 1.0.9
# Version 1.0.10

# For AIX / Linux / Solaris

Expand All @@ -33,8 +33,13 @@ HOST=`hostname`
# Which type of OS are we running
UNAME=`uname`

# format date output to strftime dd/mm/YYYY HH:MM:SS
log_date () {
date "+%d-%m-%Y %H:%M:%S"
}

if [ -z "${SPLUNK_HOME}" ]; then
echo "`date`, ${HOST} ERROR, SPLUNK_HOME variable is not defined"
echo "`log_date`, ${HOST} ERROR, SPLUNK_HOME variable is not defined"
exit 1
fi

Expand All @@ -53,7 +58,7 @@ SPL_HOME=${SPLUNK_HOME}

# Check SPL_HOME variable is defined, this should be the case when launched by Splunk scheduler
if [ -z "${SPL_HOME}" ]; then
echo "`date`, ${HOST} ERROR, SPL_HOME (SPLUNK_HOME) variable is not defined"
echo "`log_date`, ${HOST} ERROR, SPL_HOME (SPLUNK_HOME) variable is not defined"
exit 1
fi

Expand All @@ -65,7 +70,7 @@ elif [ -d "$SPLUNK_HOME/etc/slave-apps/TA-nmon" ];then
APP=$SPLUNK_HOME/etc/slave-apps/TA-nmon

else
echo "`date`, ${HOST} ERROR, the APP directory could not be defined, is the TA-nmon installed ?"
echo "`log_date`, ${HOST} ERROR, the APP directory could not be defined, is the TA-nmon installed ?"
exit 1
fi

Expand Down
13 changes: 10 additions & 3 deletions TA-nmon/bin/nmon2csv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,24 @@
# - Update path discovery
# - 23/05/2017: V1.0.11: Guilhem Marchand:
# - Missing userargs call in condition
# - 24/06/2017: V1.0.12: Guilhem Marchand:
# - specify explicit date format to prevent time zone issues

# Version 1.0.11
# Version 1.0.12

# For AIX / Linux / Solaris

#################################################
## Your Customizations Go Here ##
#################################################

# format date output to strftime dd/mm/YYYY HH:MM:SS
log_date () {
date "+%d-%m-%Y %H:%M:%S"
}

if [ -z "${SPLUNK_HOME}" ]; then
echo "`date`, ERROR, SPLUNK_HOME variable is not defined"
echo "`log_date`, ERROR, SPLUNK_HOME variable is not defined"
exit 1
fi

Expand All @@ -68,7 +75,7 @@ elif [ -d "$SPLUNK_HOME/etc/slave-apps/TA-nmon" ];then
APP=$SPLUNK_HOME/etc/slave-apps/TA-nmon

else
echo "`date`, ${HOST} ERROR, the APP directory could not be defined, is the TA-nmon installed ?"
echo "`log_date`, ${HOST} ERROR, the APP directory could not be defined, is the TA-nmon installed ?"
exit 1
fi

Expand Down
6 changes: 4 additions & 2 deletions TA-nmon/bin/nmon_cleaner.pl
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@
# - Increasing default value for csv cleaning to 14320 seconds
# - Include json cleaning
# - 04/01/2017: V1.1.7: Guilhem Marchand: Update path discovery
# - 24/06/2017: V1.1.8: Guilhem Marchand: time output format update

$version = "1.1.7";
$version = "1.1.8";

use Time::Local;
use Time::HiRes;
use Getopt::Long;
use POSIX 'strftime';
use File::stat; # use the object-oriented interface to stat

# LOGGING INFORMATION:
Expand Down Expand Up @@ -119,7 +121,7 @@
my $t_start = [Time::HiRes::gettimeofday];

# Local time
my $time = localtime;
my $time = strftime "%d-%m-%Y %H:%M:%S", localtime;

# Default Environment Variable SPLUNK_HOME, this shall be automatically defined if as the script shall be launched by Splunk
my $SPLUNK_HOME = $ENV{SPLUNK_HOME};
Expand Down
5 changes: 3 additions & 2 deletions TA-nmon/bin/nmon_cleaner.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
# - Increasing default value for csv cleaning to 14320 seconds
# - Include json cleaning
# - 04/01/2017: V1.1.18: Guilhem Marchand: Update path discovery
# - 24/06/2017: V1.1.19: Guilhem Marchand: time output format update

# Load libs

Expand All @@ -39,7 +40,7 @@
import argparse

# Converter version
version = '1.1.18'
version = '1.1.19'

# LOGGING INFORMATION:
# - The program uses the standard logging Python module to display important messages in Splunk logs
Expand Down Expand Up @@ -114,7 +115,7 @@ def check_negative(value):
logging.root.addHandler(handler)

# Current date
now = time.strftime("%c")
now = time.strftime("%d-%m-%Y %H:%M:%S")

# Set maxseconds
maxseconds_csv = args.MAXSECONDS_CSV
Expand Down
39 changes: 36 additions & 3 deletions TA-nmon/bin/nmon_cleaner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,25 @@
# Guilhem Marchand 2016/07/30, the core-app does not contains anymore data collection objects
# Guilhem Marchand 2016/08/02, Manage the TA-nmon_selfmode
# Guilhem Marchand 2017/04/02, Update path discovery
# Guilhem Marchand 2017/06/24,
# - specify explicit date format to prevent time zone issues
# - AIX maintenance task to solve non ending nmon processes issue

# Version 1.0.10
# Version 1.0.11

# For AIX / Linux / Solaris

#################################################
## Your Customizations Go Here ##
#################################################

# format date output to strftime dd/mm/YYYY HH:MM:SS
log_date () {
date "+%d-%m-%Y %H:%M:%S"
}

if [ -z "${SPLUNK_HOME}" ]; then
echo "`date`, ERROR, SPLUNK_HOME variable is not defined"
echo "`log_date`, ERROR, SPLUNK_HOME variable is not defined"
exit 1
fi

Expand All @@ -40,7 +48,7 @@ elif [ -d "$SPLUNK_HOME/etc/slave-apps/TA-nmon" ];then
APP=$SPLUNK_HOME/etc/slave-apps/TA-nmon

else
echo "`date`, ${HOST} ERROR, the APP directory could not be defined, is the TA-nmon installed ?"
echo "`log_date`, ${HOST} ERROR, the APP directory could not be defined, is the TA-nmon installed ?"
exit 1
fi

Expand All @@ -51,6 +59,31 @@ fi
# Store arguments sent to script
userargs=$@

###### Maintenance tasks ######

#AIX has a bug where sometimes the nmon processes fail to exit after a period of time
if [ `uname` = "AIX" ] ; then

#If we find a process that has gone beyond 24 hours, and an additional 11 minutes grace period just in case
res=`ps -eo user,pid,command,etime,args | grep -E "^ *splunk.*nmon" | awk '{ print $4 }' | grep "\-[0-9][0-9]:" | grep -v "\-00:1[01]" | grep -v grep`

if [ "x$res" != "x" ]; then

#Unfortunately under some circumstances there can by multiple old nmon processes that are stuck (not just the one)
#Therefore will kill all of the splunk nmon processes to ensure things can continue

oldPidList=`ps -eo user,pid,command,etime,args | grep -E "^ *splunk.*nmon" | grep "\-[0-9][0-9]:" | grep -v "\-00:1[01]" | awk '{ print $2 }' | grep -v grep`
for pid in $oldPidList; do
echo "`log_date`, old nmon process found due to `ps -eo user,pid,command,etime,args | grep $pid | grep -v grep` killing process $pid"
kill $pid
done

fi

fi

###### End maintenance tasks ######

# Python is the default choice, if it is not available launch the Perl version
PYTHON=`which python >/dev/null 2>&1`

Expand Down

0 comments on commit d7f6e72

Please sign in to comment.