Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a multi-user web application installed on Linux. For example, I have mysql installed in Linux server and users can use their browsers to access this application "mysql" (through Apache2 and php 5) by using phpmyadmin tool (phpmyadmin/sql is just an example). I need to monitor the processes created in Linux when users access this application (usually there are apache and mysql processes and might be other processes/threads). I can't determine to which user/users (here I am not talking about unix users, these users are phpmyadmin/mysql users)these processes belong. To solve this problem, I am thinking to create a unix user in the Linux server to each one who wants to use this application from his/her browser. For example, I want to create a user "john" in Linux, john will login to the Linux server using his username and password from his browser, and after a successful login, john can use this application (he also needs to authenticate to this application)
I believe by doing this, it is easier to know the processes that are created by a given user/users.
First, am I right in my suggestion?
Second, if I want to achieve that, is there any documentations to follow?
Thank you
Well, I don't think you're looking at the puzzle at the right angle.
MySQL usually runs as a mysql user. All of it's processes will be owned by mysql. Individual users that have access to the MySQL service and application don't own the OS processes. Now they will usually show up within the applications own processes which could be monitored.
Just like phpmysqladmin is an application or tool that uses apache to serve itself on and use. Apache will run as nobody or httpd user, but each processed spawned by users using the web server isn't going to be owned by them and you can't track the OS level of processes by an individual stance or level.
Yes you are right, I used the "top" command while I was using phpmyadmin and I noticed the "mysql" user.
Actually, my main problem is that I want to track the usage (cpu usage and memory usage)of this application for each user accessing it. For example, if user1 accessed this software for 30 minutes, I need to know the "cpu user time", "cpu system time", "idle time" and "elapsed time which is 30 minutes" (or any form of cpu usage) for each user (application level user like in my example mysql user). All the tools that I have ("sar", "top", "vmstat") or others, depend on the processes created. If I can't know the processes for each user, how can I track cpu and memory usage for each user using this application?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.