IRIX and Software

Access L1 Controller Information from within IRIX?

Hello all,

I am in the process of porting the Zabbix Agent to IRIX, so that most sensors that work under Linux also work under IRIX.

Does anybody know if it is possible to access the information from the L1 Controller from an 3x00 machine or f.e. a Fuel from within IRIX? Some command I can't seem to find?

Another problem I have is determining CPU load. Parsing top isn't something I wanna do, since I think it's an ugly hack. Under Linux, I always get the CPU Load (and Zabbix does to) from /proc/stat, is there an equivalent under IRIX?

best regards and thanx in advance for all help provided!

tuo
I think you want 'man l1cmd'. Some examples:

Code: Select all

l1cmd(1M)                                                            l1cmd(1M)

Name
l1cmd - Send a command to the SGI L1 System Controller

SYNOPSIS
/usr/sbin/l1cmd [--scdev device_name]  command


Code: Select all

[Mai:~] neko 2# l1cmd --scdev /hw/module/001c01/L1/controller env
Environmental monitoring is enabled and running.

Description    State       Warning Limits     Fault Limits       Current
-------------- ----------  -----------------  -----------------  -------
12V    Enabled  10%  10.80/ 13.20  20%   9.60/ 14.40   12.063
12V IO    Enabled  10%  10.80/ 13.20  20%   9.60/ 14.40   12.125
5V    Enabled  10%   4.50/  5.50  20%   4.00/  6.00    5.044
3.3V    Enabled  10%   2.97/  3.63  20%   2.64/  3.96    3.320
2.5V    Enabled  10%   2.25/  2.75  20%   2.00/  3.00    2.470
1.5V    Enabled  10%   1.35/  1.65  20%   1.20/  1.80    1.466
5V AUX    Enabled  10%   4.50/  5.50  20%   4.00/  6.00    5.096
3.3V AUX    Enabled  10%   2.97/  3.63  20%   2.64/  3.96    3.285
PIMM 12V BIAS    Enabled  10%  10.80/ 13.20  20%   9.60/ 14.40   12.125
SRAM    Enabled  10%   2.25/  2.75  20%   2.00/  3.00    2.509
VCPU    Enabled  10%   1.44/  1.76  20%   1.28/  1.92    1.607
PIMM 1.5V    Enabled  10%   1.35/  1.65  20%   1.20/  1.80    1.495
PIMM 3.3V AUX    Enabled  10%   2.97/  3.63  20%   2.64/  3.96    3.285
PIMM 5V AUX    Enabled  10%   4.50/  5.50  20%   4.00/  6.00    5.096
XIO 12V BIAS    Enabled  10%  10.80/ 13.20  20%   9.60/ 14.40   12.000
XIO 5V    Enabled  10%   4.50/  5.50  20%   4.00/  6.00    5.044
XIO 2.5V    Enabled  10%   2.25/  2.75  20%   2.00/  3.00    2.457
XIO 3.3V AUX    Enabled  10%   2.97/  3.63  20%   2.64/  3.96    3.268

Description     State       Warning RPM  Current RPM
--------------- ----------  -----------  -----------
FAN  0  EXHAUST    Enabled          920         1147
FAN  1       HD    Enabled         1560         2280
FAN  2      PCI    Enabled         1120         1577
FAN  3    XIO 1    Enabled         1600         2410
FAN  4    XIO 2    Enabled         1600         2205
FAN  5       PS    Enabled         1349         3183

Advisory   Critical   Fault      Current
Description       State       Temp       Temp       Temp       Temp
----------------- ----------  ---------  ---------  ---------  ---------
0 NODE 0            Enabled    [Autofan Control]    80C/176F   41C/105F
1 NODE 1            Enabled    [Autofan Control]    80C/176F   42C/107F
2 NODE 2            Enabled    [Autofan Control]    80C/176F   34C/ 93F
3 PIMM              Enabled    [Autofan Control]    80C/176F   45C/113F
4 ODYSSEY           Enabled    [Autofan Control]    80C/176F   43C/109F
5 BEDROCK           Enabled    [Autofan Control]    85C/185F   45C/113F

[Mai:~] neko 3# l1cmd --scdev /hw/module/001c01/L1/controller version
L1 1.38.4 (Image B), Built 06/30/2005 00:01:44    [Fuel/PE/O300 1MB image]
Twitter: @neko_no_ko
IRIX Release 4.0.5 IP12 Version 06151813 System V
Copyright 1987-1992 Silicon Graphics, Inc.
All Rights Reserved.
gtogl wrote: Hello all,

I am in the process of porting the Zabbix Agent to IRIX, so that most sensors that work under Linux also work under IRIX.

Does anybody know if it is possible to access the information from the L1 Controller from an 3x00 machine or f.e. a Fuel from within IRIX? Some command I can't seem to find?

Another problem I have is determining CPU load. Parsing top isn't something I wanna do, since I think it's an ugly hack. Under Linux, I always get the CPU Load (and Zabbix does to) from /proc/stat, is there an equivalent under IRIX?

tuo


try the 'uptime' command to get the load stats. Irix have a bunch of statistics tools like 'sar' and 'pcp'. But you have to install it first.

sar - system activity reporter (chkconfig sar on)
pcp - summarize a Performance Co-Pilot (PCP) installation

With the later one you get pcpinfo which can be used in cmd line scripting to fetch the metrix data.

regards
Joerg
ah, yes, l1cmd, now that I read it, I know I have seen this somewhere before! Thanx!!!

Concerning the load, sorry, my post was unclear. I mean the per cpu load percentage, not the "load" as in processes currently running.

Under Linux, you have the /proc/stat with the the amount of time each cpu spent on f.e. kernel tasks, user tasks, idle task etc. so you can easily calculate the % of cpu utilization, that's what I'm looking for.

But pcp sound very promising, I will look into that! Thanks for the help to both of you, much appreciated!
You can take a look at sysmp(2), especially the MP_SAGET and MP_SAGET1 commands.
Flags like MPSA_SINFO [for processor loads, etc.] and MPSA_RMINFO [memory info] are probably something you're looking for.

If you're also interested in getting some detailed data about the devices in the system (something like hinv), you can take a look at getinvent(3).

I have made a short ~85 line program in C that demonstrates the use of sysmp for getting some trivial memory info and per processor loads. I can also dig up some code that uses getinvent to show some simple info about the system.
I can post the source here, if anyone is interested. :)

Otherwise, PCP is great for getting all sorts of data about the system; if I'm not mistaken it even has a C library, so you can call it directly from your app.
of course I'm interested, that would be great if you could post the code.

currently, I am working on a PHP Interface to the l1cmd, which automatically reads the configuration of the system from the l1, display the racks and bricks on a page and pulls status info for them. in active mode, it will even be possible to actively control the l1 (f.e. power up/down), but that mode should be looked upon by more than two eyes to prevent security issues.

I know that larger origin system have the l2 and l3 for similar things, it's basically just some playing around on my side, I want to extend the information my zabbix network is able to display for SGI systems with an l1.

so any code is greatly appreciated, and if anyone is actually interested in this PHP interface, I will put it up somewhere for download
Also interested in the CPU load info code!:)
If you are running PCP you can use the command pmdumptext..

This is the default output:

Code: Select all

[ 1] BlueThing:kernel.percpu.cpu.idle["cpu0"]
[ 2] BlueThing:kernel.percpu.cpu.wait.total["cpu0"]
[ 3] BlueThing:kernel.percpu.cpu.intr["cpu0"]
[ 4] BlueThing:kernel.percpu.cpu.sys["cpu0"]
[ 5] BlueThing:kernel.percpu.cpu.user["cpu0"]
[ 6] BlueThing:kernel.percpu.cpu.idle["cpu1"]
[ 7] BlueThing:kernel.percpu.cpu.wait.total["cpu1"]
[ 8] BlueThing:kernel.percpu.cpu.intr["cpu1"]
[ 9] BlueThing:kernel.percpu.cpu.sys["cpu1"]
[10] BlueThing:kernel.percpu.cpu.user["cpu1"]

Column          1       2       3       4       5       6       7      8       9      10
Source     BlueTh  BlueTh  BlueTh  BlueTh  BlueTh  BlueTh  BlueTh  BlueTh  BlueTh  BlueTh
Metric       idle   total    intr     sys    user    idle   total   intr     sys    user
Inst       cpu0    cpu0    cpu0    cpu0    cpu0    cpu1    cpu1   cpu1    cpu1    cpu1
Normal       0.00    0.00    0.00    0.00    0.00    0.00    0.00   0.00    0.00    0.00
Units       util    util    util    util    util    util    util   util    util    util
Wed Jan  4 17:09:53      0.84    0.00    0.02    0.07    0.07    0.97    0.00    0.00    0.02    0.01
Wed Jan  4 17:09:55      0.87    0.00    0.00    0.04    0.08    0.97    0.00    0.00    0.00    0.02
Wed Jan  4 17:09:57      0.87    0.00    0.02    0.04    0.06    0.94    0.00    0.00    0.02    0.03


From the man page I think it looks pretty configurable :

NAME
pmdumptext - performance metrics dump to an ASCII table

SYNOPSIS
pmdumptext [-CFgHilmMNoruz] [-A align] [-a archive[,archive,...]] [-c
config] [-d delimiter] [-f format] [-h host] [-n pmnsfile] [-O offset]
[-P precision] [-R lines] [-s sample] [-S starttime] [-t interval] [-T
endtime] [-U string] [-w width] [-Z timezone] [metric ...]

DESCRIPTION
pmdumptext outputs the values of performance metrics collected live or
from a Performance Co-Pilot (PCP(1)) archive. By default, the metric
values are displayed in tab separated columns, prefixed by a timestamp.

[......]
OK, here's that sysmp code I wrote some time ago. It's nothing fancy, just reads the data.
If I remember correctly, the loads are in CPU time (ie. they tell you how much time in total has the CPU spent in user, kernel, idle, ... state), but don't take my word for it - you should probably check some manpages first :) .

Code: Select all

#include <stdio.h>
#include <string.h>  /* for memset(), strerror()  */
#include <unistd.h>  /* for exit(), getpagesize() */

#include <sys/types.h>
#include <sys/sysmp.h>
#include <sys/sysinfo.h>

#include <errno.h>

/* Convert pages to kb */
#define p2kb(pages) ((((uint64_t) pages) * pagesize) >> 10)


/* Automatically set in init() */
static int pagesize = 4096;
static int numproc  = 1;

/* Structs for holding our info */
static struct sysinfo si;
static struct rminfo  mi;


void init(void) {
/* Get page size */
pagesize = getpagesize(); /* Alternatively, one could use sysmp(MP_PGSIZE) */

/* Get the number of processors in the system */
numproc  = sysmp(MP_NPROCS);

/* Clear the structs */
memset(&si, 0, sizeof(struct sysinfo));
memset(&mi, 0, sizeof(struct rminfo));
}

void display_data(void) {
register int i, ret;

printf("%d CPU(s); Page size = %d bytes\n", numproc, pagesize);

/* Get memory info into the [mi] struct */
ret = sysmp(MP_SAGET, MPSA_RMINFO, &mi, sizeof(struct rminfo));

/* Bail out on error */
if (ret != 0) {
fprintf(stderr, "sysmp(MP_SAGET, MPSA_RMINFO) returned %d\n", ret);
fprintf(stderr, "ERROR: %s\n", strerror(errno));
exit(1);
}

printf("Memory: %d MB free, %d MB used;  %d MB total\n",
(unsigned int)(p2kb(mi.freemem) / 1024),
(unsigned int)((p2kb(mi.physmem) - p2kb(mi.freemem)) / 1024),
(unsigned int)(p2kb(mi.physmem) / 1024)
);

/*
* Show loads for every processor
*   If you want to get the combined loads for all processors in the system,
*   just use MP_SAGET instead of MP_SAGET1 and remove the last parameter.
*/
for (i = 0; i < numproc; i++) {
/* Get info for processor [i] into the [si] struct */
ret = sysmp(MP_SAGET1, MPSA_SINFO, &si, sizeof(struct sysinfo), i);

/* Bail out on error */
if (ret != 0) {
fprintf(stderr,
"sysmp(MP_SAGET1, MPSA_SINFO) returned %d for processor %d\n",
ret, i);
fprintf(stderr, "ERROR: %s\n", strerror(errno));
exit(2);
}

printf("CPU%d: %ld user, %ld kern, %ld sxbrk, %ld intr, %ld idle, %ld wait\n",
i, si.cpu[CPU_USER], si.cpu[CPU_KERNEL], si.cpu[CPU_SXBRK],
si.cpu[CPU_INTR], si.cpu[CPU_IDLE], si.cpu[CPU_WAIT]
);
}
}

int main(int argc, char *argv[]) {
init();
display_data();

return 0;
}



It should give an output similar to this:

Code: Select all

2 CPU(s); Page size = 16384 bytes
Memory: 1104 MB free, 431 MB used;  1536 MB total
CPU0: 282134 user, 26628 kern, 0 sxbrk, 2928 intr, 2024597 idle, 3504 wait
CPU1: 86504 user, 21074 kern, 0 sxbrk, 1404 intr, 2228580 idle, 2201 wait



Hope that will be of some use to your project :)

EDIT: Just wanted to add this: to get percentages, you will probably have to gather the data for all processors, usleep() for some time (like maybe half a second, or a second), gather the loads again and compute the percentages from that.
At least that seems to be what `top` and the like do.
wow, many thanks for the code :)

btw: that's exactly how I determin the % under linux, simply parse /proc/stats, sleep a second, parse again, compute difference, compute percentage.

and I guess that's how f.e. "top" works, because top always needs that first second before all the values seem sane

edit: your code works like a charm. I am currently writing a little script to compute the cpu % (among other things) and display it on the L1 display of the bricks, as soon as I'm finished, I'm gonna post it here if anyone is interested
ShadeOfBlue wrote: OK, here's that sysmp code I wrote some time ago. It's nothing fancy, just reads the data.
If I remember correctly, the loads are in CPU time (ie. they tell you how much time in total has the CPU spent in user, kernel, idle, ... state), but don't take my word for it - you should probably check some manpages first :) .
It should give an output similar to this:

Code: Select all

2 CPU(s); Page size = 16384 bytes
Memory: 1104 MB free, 431 MB used;  1536 MB total
CPU0: 282134 user, 26628 kern, 0 sxbrk, 2928 intr, 2024597 idle, 3504 wait
CPU1: 86504 user, 21074 kern, 0 sxbrk, 1404 intr, 2228580 idle, 2201 wait



Hope that will be of some use to your project :)

EDIT: Just wanted to add this: to get percentages, you will probably have to gather the data for all processors, usleep() for some time (like maybe half a second, or a second), gather the loads again and compute the percentages from that.
At least that seems to be what `top` and the like do.


to provide it to everybody i compiled it and i hope it's okay for you.
http://www.nekochan.net/wiki/downloads/foetz/sysmp.bz2
r-a-c.de
gtogl wrote: wow, many thanks for the code :)

btw: that's exactly how I determin the % under linux, simply parse /proc/stats, sleep a second, parse again, compute difference, compute percentage.

and I guess that's how f.e. "top" works, because top always needs that first second before all the values seem sane

edit: your code works like a charm. I am currently writing a little script to compute the cpu % (among other things) and display it on the L1 display of the bricks, as soon as I'm finished, I'm gonna post it here if anyone is interested


Hey - did you ever get that script you talked about for the L1 display to work? I'd love to give it a try on my hardware.

Thanks!

-chris