- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: topas
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-03-2007 11:08 PM
тАО09-03-2007 11:08 PM
I dont really know unix, but sometimes use glance to check the performance of the system, what I need to know is if there is a command to run which will just to pull off the CPU performance to the screen, rather than GUI.
Hope this makes sense.
THanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-03-2007 11:10 PM
тАО09-03-2007 11:10 PM
Re: topas
Topas is the AIX version of top.
# top
Regards,
Robert-Jan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-03-2007 11:50 PM
тАО09-03-2007 11:50 PM
Re: topas
top is resource extensive command.
Please run it using
nice top
:)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-04-2007 12:03 AM
тАО09-04-2007 12:03 AM
Re: topas
I may have mis typed my post (sorry)
What I am trying to do is monitor the processor every hour to a flat file.
So I can review the next day.
Hope it's explained better this time.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-04-2007 12:08 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-04-2007 12:12 AM
тАО09-04-2007 12:12 AM
Re: topas
No problem!
heck the root's crontab for the lines containing sa1 and sa2 eg.
* * * * /usr/lbin/sa/sa1 1200 3
0 0 * * * /usr/lbin/sa/sa2 -s 00:00 -e 23:45 -1 3600 -A
run the sar command
# sar
00:00:00 %usr %sys %wio %idle
00:10:00 0 1 1 98
00:20:00 0 1 1 98
00:30:00 0 1 1 98
00:40:00 0 1 1 98
00:50:00 0 1 1 98
01:00:00 0 1 1 98
01:10:00 0 1 1 98
....
Regards,
Robert-Jan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-04-2007 01:14 AM
тАО09-04-2007 01:14 AM
Re: topas
One last question now sorry if it's dragging on.
What I am trying to do is be alerted to a file when the CPU is less than 70% idle.
What I have done with your help and someone at work is
sar 1 1 > filename.txt
got the following
14:07:49 1 1 0 98
then
cut -c39-40 filename |tail -1 > filename2.txt
which then contains
98
The question is then how do I create a text file if the figure in the file is less than 70.
Hope you can help.
Again sorry for it dragging on.
Thanks
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-04-2007 01:25 AM
тАО09-04-2007 01:25 AM
Re: topas
LOAD=$(sar 1 1 | tail -n 1)
IDLE=$(echo $LOAD | cut -d " " -f 5)
if [ $IDLE -lt 70 ]
then
echo "$LOAD" >> /path/to/cpu_logile.log
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-04-2007 02:04 AM
тАО09-04-2007 02:04 AM
Re: topas
I get an error
/sarwatch.txt[5]: [81: not found.
which appears when it gets to the if statment.
LOAD=$(sar 1 1 | tail -n 1)
IDLE=$(echo $LOAD | cut -d " " -f 5)
if [ $IDLE -lt 70 ]
then
echo "$LOAD" >> /path/to/cpu_logile.log
fi
Thanks again.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-04-2007 04:51 AM
тАО09-04-2007 04:51 AM
Re: topas
/sarwatch.txt[5]: [81: not found.
This means your cut didn't work and it has a "[" in the field?
LOAD=$(sar 1 1 | tail -n 1)
IDLE=$(echo $LOAD | cut -d " " -f 5)
if [ $IDLE -lt 70 ]
If you don't use LOAD anywhere else, you could just pass the sar output directly to awk. awk has a more usable interface to select fields. cut(1) would treat each space as a delimiter, even if two in a row.
If you quoted "$IDLE" above, you wouldn't get that "not found" error but you wouldn't know your script was broken:
if [ "$IDLE" -lt 70 ]; then
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-04-2007 06:35 PM
тАО09-04-2007 06:35 PM
Re: topas
LOAD=$(sar 1 1 | tail -n 1)
echo $LOAD
IDLE=$(echo $LOAD | cut -d " " -f 5)
echo $IDLE
End then :
if [ $IDLE -lt 70 ]
then
echo "less then 70"
else
echo "more then 70"
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-04-2007 07:00 PM
тАО09-04-2007 07:00 PM
Re: topas
Thanks everyone
I have typed in the commands manually can get the following.
LOAD=$(sar 1 1 | tail -n 1)
echo $LOAD
07:39:51 53 13 25 9
IDLE=$(echo $LOAD | cut -d " " -f 5)
echo $IDLE
9
however when I type in the if statment it goes to a different prompt >
$ if [ $IDLE -lt 70 ]
> then
> echo "less then 70"
> else
> echo "more then 70"
> fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-04-2007 07:08 PM
тАО09-04-2007 07:08 PM
Re: topas
As long as you type no "fi", you will keep receiving the ">" prompt.
Did the if command return a "less than 70" output ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-04-2007 07:22 PM
тАО09-04-2007 07:22 PM
Re: topas
No it didnt echo anything
$ if [ $IDLE -lt 70 ]
> then
> echo "less then 70"
> else
> echo "more then 70"
> fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-04-2007 07:44 PM
тАО09-04-2007 07:44 PM
Re: topas
When I enter :
$ IDLE=66
$ if [ $IDLE -eq 66 ]
> then
> echo XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
> fi
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
$
Whatever if-statement you write, it should execute the 'then' OR the 'else' and both contain an echo command, so there should be output allways.
At the other hand : If you cut and paste the commands that you typed manually into a script and execute the script, does it still return an error as before ? Since the individual commands work, they should also work in a script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-04-2007 08:01 PM
тАО09-04-2007 08:01 PM
Re: topas
The scriptLOAD=$(sar 1 1 | tail -n 1)
echo $LOAD
IDLE=$(echo $LOAD | cut -d " " -f5)
echo $IDLE
if [$IDLE -lt 70] then
echo $LOAD
else
echo "more than 70"
fi
The output08:57:34 22 7 36 36
36
/sarwatch.txt[5]: Syntax error at line 8 : `else' is not expected.
It's doing my head in now..........
THanks
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-04-2007 09:54 PM
тАО09-04-2007 09:54 PM
Re: topas
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-04-2007 10:14 PM
тАО09-04-2007 10:14 PM
Re: topas
The results are now
11:10:34 0 1 6 93
93
/sarwatch.txt[5]: [93: not found.
more than 70
Which it's reporting its more than 70 now, but still get the not found bit.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-04-2007 11:43 PM
тАО09-04-2007 11:43 PM
Re: topas
Got it to work.
the -lt 70 needed to be a variable.
ie
1 LOAD=$(sar 1 1 | tail -n 1)
2 IDLE=$(echo $LOAD | cut -d " " -f5) >/dev/null
3 VAR1=10
4 echo $IDLE
5 if [ $IDLE -lt $VAR1 ] ; then
6 echo "less than"
7 else
8 echo "more than 70"
9 fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-05-2007 12:08 AM
тАО09-05-2007 12:08 AM
Re: topas
On my system "if [ $IDLE -lt 70 ]" works fine.
What is your OS-version and what shell are you working in (I am using sh on HP-UX 11i v2, the default posix-shell on HPUX)? And what is your patch level of the shell (swlist -l product | grep PHCO | grep sh) ? I have PHCO_32444 fo sh-posix.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-05-2007 11:57 AM
тАО09-05-2007 11:57 AM
Re: topas
This fails for 3 reasons, you need a ";" after the "]". You need a space before and after "[" and before the "]":
if [ $IDLE -lt 70 ]; then
You need to attach your script next time because you had the spaces when posted the first time.
>Wim: You need to put the "then" on a new line,
Only if you like that yukky style. :-)
/sarwatch.txt[5]: [93: not found.
This is exactly what you get with:
if [$IDLE ...
>Got it to work. the -lt 70 needed to be a variable.
No, you need to have consistent spacing. When you changed to a variable, you put in some spaces.
>Wim: I think you have an issue in your shell.
No, with the shell input that keeps changing. :-)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-05-2007 06:16 PM
тАО09-05-2007 06:16 PM
Re: topas
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-05-2007 06:33 PM
тАО09-05-2007 06:33 PM
Re: topas
This is not that helpful. Please provide all 5 chars: 11.00?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-05-2007 06:49 PM
тАО09-05-2007 06:49 PM
Re: topas
B.11.00 U 9000/800 (tm)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-05-2007 07:02 PM
тАО09-05-2007 07:02 PM