Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
Operating System - Tru64 Unix
cancel
Showing results for 
Search instead for 
Did you mean: 

system statistics

SOLVED
Go to solution
Ali Humaidan
Occasional Advisor

system statistics

Hi all,
I'm using Tru64 UNIX 5.1a and I'm trying to write a C program to get the different kind of system statistics such as:
- general server info
- memory usage
- cpu usage
- running processes

can anybody help me to find the C system calls for those info
12 REPLIES
Ralf Puchner
Honored Contributor

Re: system statistics

/proc is your friend. Have a look to older forum entries containing a sample reading values.
Help() { FirstReadManual(urgently); Go_to_it;; }
Ali Humaidan
Occasional Advisor

Re: system statistics

Thanks for your reply but can you be more specific ?
I know how to get these info from linux proc directory, but on unix everything is different, and it seems proc directory contains only process information
Ralf Puchner
Honored Contributor

Re: system statistics

the information about running processes/memory usage is part of a sample source code posted here in the forum.
Help() { FirstReadManual(urgently); Go_to_it;; }
Ali Humaidan
Occasional Advisor

Re: system statistics

Thanks Ralf for your reply
I searched the forums again and again with no use
I would really appreciate it if you can give me the direct link for this source code
Ralf Puchner
Honored Contributor

Re: system statistics

have a look into the attachement. prpsinfo structure is important.
Help() { FirstReadManual(urgently); Go_to_it;; }
Arnaud Veron
Valued Contributor

Re: system statistics

why don't you query the tru64 snmp agent ???
Ali Humaidan
Occasional Advisor

Re: system statistics

Thank you Ralf very much for the code, it has helped me in monitoring the process on the system.

But what about physical/swap memory usage and the disk I/O ??? can these information also be found in /proc directory or by communication to the server with SNMP or what ?
Ralf Puchner
Honored Contributor

Re: system statistics

these information can also be found within /proc and also within snmp.

Information for snmp can be found within the man pages and /usr/share/sysman/mibs.
Help() { FirstReadManual(urgently); Go_to_it;; }
Ali Humaidan
Occasional Advisor

Re: system statistics

Thanks Ralf Puchner and Arnaud Veron for your positive feedback.

It seems that mibs files contains all the info I need, but I don't know how to intereact with it using SNMP ??

Can anybody direct me to any C source code to intereact with SNMP agent on the server ??? (because I couldn't find any)
Arnaud Veron
Valued Contributor
Solution

Re: system statistics

You can query the snmp agent with the "snmp_request" tru64 command. example : snmp_request 127.0.0.1 public get 1.3.6.1.2.1.2.2.1.10.2
where :

127.0.0.1 = IP of the host where the snmp agent is running
public = the snmp community you want to query
get = snmp type of method
1.3.6.1.2.1.2.2.1.10.2 = SNMP OID of the metric you're interested in ( you can find OID in the SNMP MIB )

Other OS support SNMP querying :
linux : snmpwalk
windows : getif

good luck.
Ali Humaidan
Occasional Advisor

Re: system statistics

Thanks Arnaud Veron for your reply, now SNMP is clearer to me ... just two questions though:

1. Is there an SNMP system call for snmp_get to read the result from a C program .. or using exec() to invoke snmp_get is the only way.

2. How to query SNMP to view all the groups of a specific branch for example (1.3.6.1.4.1.232.*) .. because MIB files have only a specific branch ie.
--The compaq enterprise (1.3.6.1.4.1.232)
--cpqSystemInfo Group (1.3.6.1.4.1.232.2)
--cpqSiComponent Group (1.3.6.1.4.1.232.2.2)
--cpqSiAsset Group (1.3.6.1.4.1.232.2.2.2)

Thanks again for your help
Arnaud Veron
Valued Contributor

Re: system statistics

1 - i don't know. But i'm sure you will find what you want here : http://www.netsnmp.org/
you have all the C source of snmp utilities.

2 - you have to use the "getnext" snmp method instead of the "get" one. You also have to tell snmp_request to run into "tree mode", so as to browse the tree you're interested in.
example : snmp_request localhost public getnext -t 1.3.6.1.4.1.232.2.2.2