Xymon Mailing List Archive search

vmstat/cpu graphs for OS X

list Adam Scheblein
Thu, 24 Aug 2006 10:53:18 -0500
Message-Id: <user-8bdbf7e39424@xymon.invalid>

OK, so I put in the extra code and everything compiled without any issue, I
recompiled both the server and the client with the new code and now vmstat
data is being transmitted and the server is trying to graph the data,
however, it keeps giving me a blank graph and displays nan for the values of
the datapoints on the graph.  Am I missing something??  Will it not graph if
the values do not add up exactly to 100%??

Thanks,
Adam
-----Original Message-----
From: Scheblein, Adam [mailto:user-de8d51f0c651@xymon.invalid]
Sent: Thursday, August 24, 2006 8:48 AM
To: user-ae9b8668bcde@xymon.invalid
Subject: RE: [hobbit] vmstat/cpu graphs for OS X
-----Original Message-----
From: Henrik Stoerner [mailto:user-ce4a2c883f75@xymon.invalid]
Sent: Wednesday, August 23, 2006 3:57 PM
To: user-ae9b8668bcde@xymon.invalid
Subject: Re: [hobbit] vmstat/cpu graphs for OS X

On Wed, Aug 23, 2006 at 11:27:42AM -0500, Scheblein, Adam wrote:
I am currently working on implementing a script that will give output
the
same as vmstat but for mac.  Does Hobbit create graphs based on what
the
client is??
The Hobbit server will only process the types of data it knows about.
And for OSX it doesn't know about any vmstat data since I've never seen
any vmstat data from that type of system.

So first of all, it requires modifying the hobbitd/rrd/do_vmstat.c file
to recognize your vmstat data format and create/update an RRD file.
Second, if you're sending the data as part of the client message then
the hobbitd/client/darwin.c file must have a line added to actually
send the vmstat data to the RRD module.
That makes sense (and is also what I suspected was happening

I ask because currently I have the following output coming from the
mac:

[vmstat]
procs -----------memory---------- ---swap-- -----io---- --system--  --
--
cpu----
r  b   swpd   free   buff  cache   si   so    bi    bo   in    cs
us
sy id
2  0      0      0      0      0    0    0     0     0    0     0    3
47 49
2  0      0      0      0      0    0    0     0     0    0     0    8
42 49
(I only have r, us, sy and id implemented at the moment)
Still, it's a start. Are the other values impossible to get, or haven't
you gotten around to implementing them yet?
Most of the are possible to get, I just have not had time to implement
them
yet.  I will get there probably within the next week or 2
To get the graph, add these two items to the hobbitd/rrd/do_vmstat.c
file:
First a table describing the vmstat columns - just put it somewhere with
the other tables:

static vmstat_layout_t vmstat_darwin_layout[] = {
        { 0, "cpu_r" },
        { 1, "cpu_b" },
        { -1, "cpu_w" },
        { 2, "mem_swpd" },
        { 3, "mem_free" },
        { 4, "mem_buff" },
        { 5, "mem_cach" },
        { 6, "mem_si" },
        { 7, "mem_so" },
        { 8, "dsk_bi" },
        { 9, "dsk_bo" },
        { 10, "cpu_int" },
        { 11, "cpu_csw" },
        { 12, "cpu_usr" },
        { 13, "cpu_sys" },
        { 14, "cpu_idl" },
        { -1, "cpu_wait" },
        { -1, NULL }
};

Next, in the same file find this bit:
          case OS_DARWIN:
                errprintf("Cannot handle Darwin vmstat from host '%s'
\n",
hostname);
                return -1;
and replace it with
          case OS_DARWIN:
		layout = vmstat_darwin_layout; break;

Finally, in the hobbitd/client/darwin.c file add this to invoke the
standard vmstat handler from the client data: First a line declaring
a variable for the vmstat data, just after the other declarations:

	char *portsstr;
	char *vmstatstr;  <-- add this line

A bit further down grab the vmstat data:
	portsstr = getdata("ports");
	vmstatstr = getdata("vmstat");	<-- add this line

And finally pass this data to the vmstat module: After the line
	unix_ifstat_report(hostname, clienttype, os, hinfo, fromline,
timestr, ifstatstr);
add this line:
	unix_vmstat_report(hostname, clienttype, os, hinfo, fromline,
timestr, vmstatstr);
I will give this a shot and let you know how it goes.  Thanks for the
HOWTO
for changing the code -- I would have been lost.
Regards,
Henrik