bosh icon indicating copy to clipboard operation
bosh copied to clipboard

SAR command (sysstat) doesn't work into VM created using Ubuntu stemcell

Open aalbanes opened this issue 9 years ago • 10 comments

I deployed a set of bosh managed vms using stemcells [3263.10] and [3312.12] with Ubuntu 14.04. bosh-softlayer-xen-ubuntu-trusty-go_agent | ubuntu-trusty | 3312.12* | 1443361 |

Issuing the sar command I got:

root@a7bf2596-de9c-4e25-8f9f-eb1fe8bed821:~# sar Cannot open /var/log/sysstat/sa01: No such file or directory Please check if data collecting is enabled in /etc/default/sysstat

Despite sysstat is enabled by default Link it doesn't work.

Issue is due to the fact that directory /var/log/systat is missing. This directory is normally created by dpkg during the sysstat*.deb installation script. To me it seems a bug of pkg_mgr.

I fixed the deployed VMs by issuing: mkdir /var/log/sysstat service sysstat restart

@maximilien as per my email

aalbanes avatar Feb 01 '17 12:02 aalbanes

It seems that stemcell contains the /var/log/sysstat folder, but this is "lost" when the bosh agent change the mount point of /var/log to /var/vcap/data/root_log file system.

Notice that the /var/log/sysstat folder is created by dpkg/apt-get during package installation and the sysstat service start script doesn't create that if missing.

sysstat dir is created on the wrong filesystem (/ one) and not on /var/vcap/data/root_log

aalbanes avatar Feb 01 '17 20:02 aalbanes

The default permission of "/var/log" is set to 775 at line 40, but it's changed to 770 at line 907-910 in commit 257a51094b68933f3e26a65e561c6c49cdb9b6a2. Need to understand why it's changed to 770.

/cc @aalbanes @maximilien @cppforlife

mattcui avatar Feb 02 '17 09:02 mattcui

@mattcui Matt I see, this is another issue.

The sysstat folder creation is not impacted by this permission change, that folder is created by root who owns the /var folder tree... as I said in comment#2 the issue is that deb installation via chroot creates the folder in the root filesystem (/), when the agent start it replace the mount point of /var/log to /var/vcap/data/root_log and this lead to sysstat folder to disappear.

aalbanes avatar Feb 02 '17 15:02 aalbanes

@aalbanes yes, I think there needs to copy all content in /var/log to /var/vcap/data/root_log before bind mount.

mattcui avatar Feb 03 '17 02:02 mattcui

@maximilien @jianqiu could you please help discuss with @cppforlife or other guys there when you get a chance. Thanks.

mattcui avatar Feb 08 '17 07:02 mattcui

@mattcui DK had some customer thingie today. We'll try him tomorrow

maximilien avatar Feb 09 '17 01:02 maximilien

Trying to use the sysstat plugin from Telegraf in a BOSH vm and having a similar issue, would you have any update?

fdhex avatar Feb 21 '17 13:02 fdhex

Hey @cppforlife can we chat about this today? Thx

/cc @jianqiu

maximilien avatar Feb 21 '17 22:02 maximilien

@fdhex @mattcui @maximilien and i looked into this just now. seems like we could augment stemcell to make it possible to start that service. it seems like unlike auditd service it doesnt create log directory on the fly: https://www.pivotaltracker.com/story/show/140456537

cppforlife avatar Feb 23 '17 00:02 cppforlife

Resoled in stemcell 3421: https://github.com/cloudfoundry/bosh-linux-stemcell-builder/releases/tag/v3421

cppforlife avatar May 23 '17 17:05 cppforlife