pcp
[Top] [All Lists]

pmlogger_check is fooled by localhost

To: pcp@xxxxxxxxxxx
Subject: pmlogger_check is fooled by localhost
From: Max Matveev <makc@xxxxxxxxx>
Date: Wed, 7 Apr 2010 10:26:09 +1000
I've got caught in pmlogger stampede after using the following
incantation in the control file:

# special local logger
localhost      n  n   PCP_LOG_DIR/pmlogger/mumble     -c 
/var/lib/pcp/config/mumble.conf

pmlogger was started with -h localhost argument which was helpfully
replaced in the map file with the actual host name, that host name did
not match what pmlogger_check and pmlogger_daily were expecting,
pmlogger_check went troppo and started starting new logger every time
it was invoked, pmlogger_daily tried to merge archives which were
still written by the horde of pmlogger - it wasn't thrilled by that.

The reason I've used 'localhost' instead of LOCALHOSTNAME was because
on that machine's name is not resolvable: it's not in DNS and it's not
in the /etc/hosts (DHCP addresses and generic hostnames).

I've added the following in pmlogger_check 

--- /usr/libexec/pcp/bin/pmlogger_check 2010-02-04 10:58:38.000000000 +1100
+++ ./pmlogger_check    2010-04-07 10:23:52.587928390 +1000
@@ -288,6 +288,9 @@
  | while read host primary socks dir args
 do
     line=`expr $line + 1`
+    if [ "$host" == "localhost" ]; then
+       host=$LOCALHOSTNAME
+    fi
     $VERY_VERBOSE && echo "[control:$line] host=\"$host\"
     primary=\"$primary\" socks=\"$socks\" dir=\"$dir\"
     args=\"$args\""
     case "$host"
     in

but I wonder if it would be better to remove automatic replacement
which pmlogger does.

max

<Prev in Thread] Current Thread [Next in Thread>