Novell is now a part of Micro Focus

I wrote a Perl script that simply should...

Articles and Tips: qna

01 Jul 2003


Q.

I wrote a Perl script that simply should read the CPU utilization. The script works, but the value is too high. I tried it on both NetWare 5 and NetWare 6 servers. The servers normally have a CPU utilization of about 1 to 5%. On NetWare 6, the value is higher than 80% every time; on NetWare 5 the value is about 50% and higher.

Is there anything wrong with the script (shown below)? Can I get the information a different way?

if ($] < 5.006) { $server=UCSExt->new("ucx:server" or die "Can't get ucx:server object"); } else { $server=Perl2UCS->new("ucx:server" or die "Can't get ucx:server object"); } $cpuutil = $server->{"Utilization"}; print ("CPUUtil: $cpuutil\n");

A.

Loading Perl and the components used by the script will impact server utilization. Insert a sleep routine before getting the utilization, and you should get a more accurate value:

sleep 1;
	$cpuutil = $server->{"Utilization"};
	print ("CPUUtil: $cpuutil\n"); #
			result is correct!

* Originally published in Novell AppNotes


Disclaimer

The origin of this information may be internal or external to Novell. While Novell makes all reasonable efforts to verify this information, Novell does not make explicit or implied claims to its validity.

© Copyright Micro Focus or one of its affiliates