|
hostname, server's hostname
thanks pludi for quick reply.
i have to monitor several linux workstations connected to a linux server.
i intend to issue cron jobs in each of the workstations to get the processes running and output the results to a textfile daily.
so for every 30 minutes, cron job something like :
0,30 * * * * * ... ps c -FC "firefox-bin,soffice.bin, ..." >> textfile.txt
the textfile.txt is to contain the workstation's hostname as part of the filename which i can get by issuing hostname at the workstation prompt.
at the end of the day, the workstation has to copy that daily file to a subdirectory in the server. another cron job that i think will need the server's hostname this time. something like :
cp textfile.txt serverhostname/assigned/directory/
(or ssh, ftp, scp whichever will be applicable, please suggest.)
at end of the day, i should have 10 daily files coming from each of the 10 workstations at the serverhostname/assigned/directory/
as each of the textfile.txt contains the name of the workstation it came from, i can write a program to track which workstations are used more often and at what peak times for the processes being monitored from these log files.
this is for the high school administrators/lab manager who want to monitor what the computers in their internet lab are being used for and at what times.
i was worried that if the serverhostname is changed by the sysad at the server, my cron tasks and scripts will not run if i hardcode the serverhostname, thus my need to find it out from wherever (e.g. cat /etc/sysconfig/network > something.txt).
thanks, just a newbie here.
better leads how to accomplish above will be appreciated.
(i also have another problem -- how to make the ps command accept the "watched executables" from a csv file that can later be expanded instead of hardcoding each of the additional executables in the ps statement)
|