#!/bin/bash
#############################################################
# Name:        Supportconfig Plugin for NOWS SBE ClamAV
# Description: Gathers Clam antivirus mailserver scanner
#              troubleshooting information
# License:     GPLv2
# Author:      Randy Goddard (randage@gmail.com)
#              Jason Record (jrecord@novell.com)
# Modified:    2010 Oct 21
#############################################################

SVER=2.02
RCFILE="/usr/lib/supportconfig/resources/scplugin.rc"
LOG_LINES=0	#0 means include the entire file
LOG_DIR="/var/log"
CONF_DIR="/etc"

[ -s $RCFILE ] && . $RCFILE || { echo "ERROR: Initializing resource file: $RCFILE"; exit 1; }

section_header "Supportconfig Plugin for NOWS SBE ClamAV, v${SVER}"

plugin_command "rpm -qa | egrep -i 'clam' | sort"
RPMLIST=$(rpm -qa | egrep -i 'clam' | sort)
if [ -z "$RPMLIST" ]; then
  echo "ERROR: ClamAV package(s) not installed"
  echo
  exit 111
fi

for THISRPM in $RPMLIST
do
	validate_rpm $THISRPM
done

for i in clamd freshclam
do
	if [ -s /etc/init.d/$i ]; then
		plugin_command "chkconfig -l $i"
		plugin_command "/etc/init.d/$i status"
		
	fi
done

plugin_command "ps axwwo user,pid,ppid,%cpu,%mem,vsz,rss,stat,time,cmd | egrep 'clamd|freshclam' | egrep -v 'nowsbe_|grep'"
plugin_command "netstat -nlp | egrep 'clamd|freshclam'"
plugin_command "clamav-config --libs"
plugin_command "clamconf"
pconf_files "$CONF_DIR/clamd.conf"
plog_files $LOG_LINES $LOG_DIR/clamd

