Script for solaris 10 zone/pset

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

Post Reply
anteater
Posts: 3
Joined: Tue Jan 16, 2007 1:37 pm

Script for solaris 10 zone/pset

Post by anteater »

Hi,
here is my first script for cacti to display infos about zone/pset Usage on a Solaris 10 System using zone's/pset's.

From the README:
This programm/scripts and templates are for displaying information about Solaris 10 Zone CPU Usage und Solaris 10 processor set usage, and are my first things i made for cacti, so be carefull ;-)

zonestat collects two types of data.
- For a processor set it display the raw counter for the cpu usage split up
into user/kernel/wait/idle
- For a zone a takes a snapshot of the current CPU/memory usage based on the information
found in /proc/<pid>. The infos are:
CPU usage in percent
Memory usage in percent
Total used memory
Resident size of memory

The templates used for the data collect and display are not complete yet..

Requirements:
- net-snmp on the client side
- cacti with script support and php with snmp support

Installation:
- Compile zonestat (Tested with Studio 11 cc)
- Add the following to your snmp configuration:
exec .1.3.6.1.4.1.2021.51 procstat <path>/zonestats
- Import the data query template
- Import the data template
- Import the graph template

If everything went OK you should see a two new data query's which can be attached to your device. If
you run them in verbose mode you should the your processor sets and zone's.


I know it's not perfect :lol: ,
Attachments
zstat.zip
(19.28 KiB) Downloaded 1556 times
stephen.nash
Posts: 1
Joined: Tue Apr 17, 2007 10:40 am
Location: Cambridge, MA

RE: Script for solaris 10 zone/pset

Post by stephen.nash »

hello,

I get different results if I compile zonestats.c with gcc or sunpro (studio 11) when run in zone or in the global zone.

bash-3.00# /usr/local/sbin/zonestats.sunpro
pset:1:pset_nexdoc:14310895:652859238:4742173:0:
pset:-1:pset_default:84097553:1815621738:116020092:0:

bash-3.00# /usr/local/sbin/zonestats.gcc
pset:1:pset_nexdoc:14310900:652863054:4742187:0:
pset:-1:pset_default:84097750:1815632614:116020527:0:
zone:1:global:1.16:18.31:3022424:4196920:99
zone:2:marx-test-z1:0.03:0.82:137808:619640:42
zone:3:marx-test-z2:0.02:0.92:158592:495360:50
zone:4:marx-test-z3:0.01:0.79:132632:422976:42
zone:5:marx-test-z4:0.04:1.11:189264:790880:49
zone:6:marx-test-z5:0.03:1.91:320744:874888:47
zone:7:marx-test-z6:0.24:2.24:377656:1688704:66

In a zone, I see ...

# /usr/local/sbin/zonestats.gcc
pset:-1:pset_default:84093622:1815379484:116009764:0:
zone:1:marx-test-z3:0.18:0.83:138832:431296:43

# /usr/local/sbin/zonestats.sunpro
pset:-1:pset_default:84094095:1815382378:116010105:0:
kasimong
Posts: 40
Joined: Tue Oct 02, 2007 7:54 am
Location: Bremerhaven,Bremen,Germany

Command failed for target `zonestats'

Post by kasimong »

hi,
try this on "SunOS 5.10 Generic_127111-11 sun4v sparc SUNW,SPARC-Enterprise-T5220System = SunOS"

/opt/studio11/SUNWspro/bin/cc -g zonestats.c -o zonestats
Undefined first referenced
symbol in file
pool_conf_open zonestats.o
kstat_chain_update zonestats.o
pool_query_resources zonestats.o
pool_resource_info zonestats.o
pool_dynamic_location zonestats.o
kstat_read zonestats.o
kstat_open zonestats.o
pool_value_alloc zonestats.o
pool_value_set_string zonestats.o
pool_value_set_int64 zonestats.o
pool_value_free zonestats.o
pool_value_set_name zonestats.o
pool_conf_alloc zonestats.o
ld: fatal: Symbol referencing errors. No output written to zonestats
*** Error code 1
make: Fatal error: Command failed for target `zonestats'
cliles
Posts: 4
Joined: Wed Dec 26, 2007 12:09 pm

Re: Command failed for target `zonestats'

Post by cliles »

kasimong wrote:hi,
try this on "SunOS 5.10 Generic_127111-11 sun4v sparc SUNW,SPARC-Enterprise-T5220System = SunOS"

/opt/studio11/SUNWspro/bin/cc -g zonestats.c -o zonestats
Undefined first referenced
symbol in file
pool_conf_open zonestats.o
kstat_chain_update zonestats.o
pool_query_resources zonestats.o
pool_resource_info zonestats.o
pool_dynamic_location zonestats.o
kstat_read zonestats.o
kstat_open zonestats.o
pool_value_alloc zonestats.o
pool_value_set_string zonestats.o
pool_value_set_int64 zonestats.o
pool_value_free zonestats.o
pool_value_set_name zonestats.o
pool_conf_alloc zonestats.o
ld: fatal: Symbol referencing errors. No output written to zonestats
*** Error code 1
make: Fatal error: Command failed for target `zonestats'
add -lpool and -lkstat to CFLAGS.
hello,

I get different results if I compile zonestats.c with gcc or sunpro (studio 11) when run in zone or in the global zone.

bash-3.00# /usr/local/sbin/zonestats.sunpro
pset:1:pset_nexdoc:14310895:652859238:4742173:0:
pset:-1:pset_default:84097553:1815621738:116020092:0:

bash-3.00# /usr/local/sbin/zonestats.gcc
pset:1:pset_nexdoc:14310900:652863054:4742187:0:
pset:-1:pset_default:84097750:1815632614:116020527:0:
zone:1:global:1.16:18.31:3022424:4196920:99
zone:2:marx-test-z1:0.03:0.82:137808:619640:42
zone:3:marx-test-z2:0.02:0.92:158592:495360:50
zone:4:marx-test-z3:0.01:0.79:132632:422976:42
zone:5:marx-test-z4:0.04:1.11:189264:790880:49
zone:6:marx-test-z5:0.03:1.91:320744:874888:47
zone:7:marx-test-z6:0.24:2.24:377656:1688704:66

In a zone, I see ...

# /usr/local/sbin/zonestats.gcc
pset:-1:pset_default:84093622:1815379484:116009764:0:
zone:1:marx-test-z3:0.18:0.83:138832:431296:43

# /usr/local/sbin/zonestats.sunpro
pset:-1:pset_default:84094095:1815382378:116010105:0:
I get the same results. I'm going w/ gcc compiled binary in the global zone, with hopes I can validate the results with some "prstat -Z" parsing....
:o
darckos
Posts: 5
Joined: Mon Nov 02, 2009 9:04 am

Post by darckos »

Hi,

I don't see Zone Data Queries in the archive, is it normal ?

Regards
stucole
Posts: 15
Joined: Thu Apr 01, 2010 5:49 am

Re: Script for solaris 10 zone/pset

Post by stucole »

Hi,

I have been trying to get zone information for Cacti for ages and I have just stumbled upon your zonestat script/queries.

I have compiled the source on an x86 solaris server using gcc with the added cflags but everytime I run the script I get a core dump of zonestats.

Are there any specifics for x86 solaris that I need to be aware of , or are we talking a complete re-write of the code.

Many thanks

Stu
Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests