Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

[OHAI-439] Add OpenVZ plugin to parse data from /proc/user_beancounters #123

Closed
wants to merge 1 commit into from

4 participants

@ChrisLundquist

http://tickets.opscode.com/browse/OHAI-439

output looks like

root@block852638-iap:~# ohai openvz
[2013-01-28T22:52:41+00:00] WARN: [inet] no ip on venet0
[2013-01-28T22:52:41+00:00] WARN: unable to detect ipaddress
[2013-01-28T22:52:41+00:00] WARN: unable to detect macaddress
{
  "othersockbuf": {
    "maxheld": 65760,
    "failcnt": 0,
    "barrier": 4194304,
    "limit": 8388608,
    "held": 25432
  },
  "oomguarpages": {
    "maxheld": 82836,
    "failcnt": 0,
    "barrier": 262144,
    "limit": 9223372036854775807,
    "held": 80387
  },
  "numothersock": {
    "maxheld": 105,
    "failcnt": 0,
    "barrier": 1024,
    "limit": 1024,
    "held": 95
  },
  "numsiginfo": {
    "maxheld": 69,
    "failcnt": 0,
    "barrier": 512,
    "limit": 512,
    "held": 0
  },
  "physpages": {
    "maxheld": 216508,
    "failcnt": 0,
    "barrier": 262144,
    "limit": 9223372036854775807,
    "held": 103851
  },
  "lockedpages": {
    "maxheld": 0,
    "failcnt": 0,
    "barrier": 64,
    "limit": 64,
    "held": 0
  },
  "memory": {
    "total": 1048576
  },
  "tcprcvbuf": {
    "maxheld": 7541904,
    "failcnt": 0,
    "barrier": 10485760,
    "limit": 15728640,
    "held": 81920
  },
  "numtcpsock": {
    "maxheld": 7,
    "failcnt": 0,
    "barrier": 5120,
    "limit": 5120,
    "held": 5
  },
  "kmemsize": {
    "maxheld": 21643264,
    "failcnt": 0,
    "barrier": 67108864,
    "limit": 75497472,
    "held": 18798700
  },
  "dgramrcvbuf": {
    "maxheld": 2312,
    "failcnt": 0,
    "barrier": 1048576,
    "limit": 1048576,
    "held": 0
  },
  "tcpsndbuf": {
    "maxheld": 464472,
    "failcnt": 0,
    "barrier": 10485760,
    "limit": 15728640,
    "held": 87200
  },
  "vmguarpages": {
    "maxheld": 0,
    "failcnt": 0,
    "barrier": 393216,
    "limit": 9223372036854775807,
    "held": 0
  },
  "shmpages": {
    "maxheld": 1005,
    "failcnt": 0,
    "barrier": 262144,
    "limit": 262144,
    "held": 653
  },
  "numiptent": {
    "maxheld": 20,
    "failcnt": 0,
    "barrier": 2048,
    "limit": 2048,
    "held": 20
  },
  "numpty": {
    "maxheld": 3,
    "failcnt": 0,
    "barrier": 64,
    "limit": 64,
    "held": 1
  },
  "numflock": {
    "maxheld": 7,
    "failcnt": 0,
    "barrier": 1024,
    "limit": 1024,
    "held": 1
  },
  "numproc": {
    "maxheld": 168,
    "failcnt": 0,
    "barrier": 1024,
    "limit": 1024,
    "held": 104
  },
  "privvmpages": {
    "maxheld": 260691,
    "failcnt": 207,
    "barrier": 393216,
    "limit": 442368,
    "held": 241239
  },
  "numfile": {
    "maxheld": 520,
    "failcnt": 0,
    "barrier": 10240,
    "limit": 10240,
    "held": 322
  },
  "dcachesize": {
    "maxheld": 9437184,
    "failcnt": 0,
    "barrier": 8388608,
    "limit": 9437184,
    "held": 9407477
  }
}

Take special note of ohai openvz/memory/total

@sersut
Owner

Thanks @ChrisLundquist for the patch. Looks like we need two things in order to move this forward:

  • Port this to OHAI 7 plugin style. More info here.
  • A unit test so that the functionality is not regressed.

Sorry for the delay in response since this fell through the cracks. We are moving to use Github Issues in order to prevent similar missed in the future.

@sersut sersut removed the Attack List label
@chef-supermarket

Hi. I am an automated pull request bot named Curry. There are commits in this pull request whose authors are not yet authorized to contribute to Chef Software, Inc. projects or are using a non-GitHub verified email address. To become authorized to contribute, you will need to sign the Contributor License Agreement (CLA) as an individual or on behalf of your company. You can read more on Chef's blog.

GitHub Users Who Are Not Authorized To Contribute

The following GitHub users do not appear to have signed a CLA:

Please sign the CLA here.

@ChrisLundquist

I've signed the CLA at least twice before.

@btm
Owner

@ChrisLundquist the curry bot compares the email address in the commits with a github user, and then the github user with an account on https://supermarket.getchef.com. It doesn't look like your supermarket user has a github account associated with it so you'll want to go to https://supermarket.getchef.com/profile/edit#github-accounts and add it. Then your CLA will get automatically verified (and save everyone some time).

@chef-supermarket

Hi. Your friendly Curry bot here. Just letting you know that all commit authors have become authorized to contribute. I have added the "Signed CLA" label to this issue so it can easily be found in the future.

@ChrisLundquist

It looks like I can't associate multiple email addresses on the Chef side like I can on the GitHub side. I was flagged because I changed my primary address to my work one.
I've signed it again, and here was the previous one signed 10/24/2012 1:31 PM

I wonder if there is a way to prevent others from hitting this bump?

@ChrisLundquist

I won't be able to push this forward. @jyotty might be interested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 53 additions and 0 deletions.
  1. +53 −0 lib/ohai/plugins/openvz.rb
View
53 lib/ohai/plugins/openvz.rb
@@ -0,0 +1,53 @@
+provides "openvz"
+# Sample output
+#Version: 2.5
+# uid resource held maxheld barrier limit failcnt
+# 852638: kmemsize 16595303 21577728 67108864 75497472 0
+# lockedpages 0 0 64 64 0
+# privvmpages 239894 258143 393216 442368 161
+# shmpages 653 1005 262144 262144 0
+# dummy 0 0 0 0 0
+# numproc 106 168 1024 1024 0
+# physpages 96664 216508 262144 9223372036854775807 0
+# vmguarpages 0 0 393216 9223372036854775807 0
+# oomguarpages 80857 82836 262144 9223372036854775807 0
+# numtcpsock 5 7 5120 5120 0
+# numflock 1 7 1024 1024 0
+# numpty 1 3 64 64 0
+# numsiginfo 0 69 512 512 0
+# tcpsndbuf 146192 338032 10485760 15728640 0
+# tcprcvbuf 81920 7541904 10485760 15728640 0
+# othersockbuf 25432 65760 4194304 8388608 0
+# dgramrcvbuf 0 2312 1048576 1048576 0
+# numothersock 95 105 1024 1024 0
+# dcachesize 6900492 9437184 8388608 9437184 0
+# numfile 348 520 10240 10240 0
+# dummy 0 0 0 0 0
+# dummy 0 0 0 0 0
+# dummy 0 0 0 0 0
+# numiptent 20 20 2048 2048 0
+
+
+openvz Mash.new
+
+if File.exists?("/proc/user_beancounters")
+ Ohai::Log.debug("OpenVZ: user_beancounters detected")
+
+ File.open("/proc/user_beancounters").each do |line|
+ line =~ /\s(\w+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/
+ resource, held, maxheld, barrier, limit, failcnt = $1, $2, $3, $4, $5, $6
+
+ next if ["dummy",nil].include? resource # skip header line and dummy resources
+
+ openvz[resource] = Mash.new
+ openvz[resource]["held"] = held.to_i
+ openvz[resource]["maxheld"] = maxheld.to_i
+ openvz[resource]["barrier"] = barrier.to_i
+ openvz[resource]["limit"] = limit.to_i
+ openvz[resource]["failcnt"] = failcnt.to_i
+ end
+
+ openvz["memory"] = Mash.new
+
+ openvz["memory"]["total"] = openvz["oomguarpages"]["barrier"] * 4 #kb // sizeof(page)
+end
Something went wrong with that request. Please try again.