Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Hopefully, someone can help with this.
We have an in house monitoring solution, and I need to return a percentage of usage from the "swpd" in vmstat instead of just a number.
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 488 162276 841144 30837840 0 0 628 29 4 9 6 2 90 2 0
If you're looking for the percentage of the swap memory, you should start with the output of the "free" command instead. It'll give you the total, used, and free amounts. From there, calculating a percentage in bash is fairly simple: http://www.ukdragon.com/blog/index.p...ntages_in_bash
Don't need to get worked up, I don't like the answer, I need more of a complete answer.
Not an untested line of syntax and a URL.
Wasn't worked up, was asking what was missing. The answer is "nothing". The only 'untested' part is how to CALL the command to build a variable in bash. I think it's correct, but (since YOU are going to write the script), I left it to you to research. I even gave you a link to a tutorial showing you how to figure percentages in bash, so you could use what you were given.
You don't like it, feel free to figure it out on your own...you asked for ideas. I pointed you to the right system utility to use, gave you three lines of variable-producing code from which (if you put any effort into it), you could have easily written your own script.
I'm guessing what you wanted was someone to write it for you, and hand you something tested and debugged. No, thanks....you were given ideas, direction, and instructions to take it further. If you don't want to, then tell someone else at your company to write it.