## WeBWorK Main Forum

### email all instructors, list all active students

Number of replies: 4
We're about (tomorrow is the first day of classes here) to start serving roughly 2000 students in about 50 classes on a new server.

There are two things I'd like to be able to do that I don't know how to do easily:

1) I'd like to be able to email all instructors.

If we had added all instructors from the course admin page, they would all be students in the classlist on that page, and I could do it that way. Unfortunately, a lot of our classes were moved from our previous server, and that process (archive, scp, unarchive) doesn't put the instructors into the classlist on the course admin page.

2) I'd like to be able to watch the system load in conjunction with knowing how many students are actively using the system.

Of course for an individual course I could look at the classlist, but is there any smart way to find out how many active users there are on the whole system? (I realize that the definition of active user is up to interpretation to some extent.)

thanks, Hal

### Re: email all instructors, list all active students

by Mark Hamrick -
The listing of all active students has become important now to me also. I don't have the slightest idea how to pull that information however.

### Re: email all instructors, list all active students

So part of the difficulty with this question is that I'm not sure what I mean by an "active student."

I assume that what WeBWorK means when it lists someone in the classlist as "active" is something like "less than N seconds since their last interaction with the server for some value of N in the hundreds somewhere?"

I do have a proxy that I'm using to try to keep track of how much activity there is. I do a tail -f of timing.log. I believe this reports each time WeBWorK serves up a page (and for what course it is being served, and what homework, problem, etc) and how long it took to generate that page.

By running this in a big terminal window and looking at the time stamps, I get an idea (very roughly) of how many questions per minute WeBWorK is processing.

To find all instructors, I run a script that calls wwdb for each course and dumps the permission table, and then uses various tools to create a list of people with permission 10.

(This is maybe more database intensive than one might want, but I don't need to run this very often, and it really doesn't take that long.)

I thought a similar trick might work to discover who is active (according to WeBWorK) but I don't know what table (if any), or how, this data is stored.

Hal

### Re: email all instructors, list all active students

by Arnold Pizer -
Hi Hal,

An "active" student is one who is listed in the key table (i.e. has not logged out) and whose timestamp has not expired. Here's how active students are found in webwork2/lib/WeBWorK/ContentGenerator/Instructor/UserList.pm

# check to see if a user is currently logged in
# DBFIXME use a WHERE clause
my $Key =$db->getKey($User->user_id); my$is_active = ($Key and time <=$Key->timestamp()+$ce->{sessionKeyTimeout}); # cribbed from check_session push @tableCells,$is_active ? CGI::b("active") : CGI::em("inactive");

Arnie

### Re: email all instructors, list all active students

Dear Arnie,

Thanks for the information. Realizing that I need to look in the key tables was the critical thing.

I've got various little scripts (clumsily written as I'm accomplished neither in shell scripting nor in perl) that I've written for various local administrative tasks. These include the two I mentioned here:

-list of active users, by course
-list of instructors

and also things like

-script that converts an XML file from our registrar giving a class's registration list into an appropriate .lst file for uploading

-script that takes an excel spreadsheet with all people registered for all math classes, makes a bunch of .lst files, and scp's them into the appropriate templates directories.

and some other miscellaneous things.

Some of these (like the last two) rely on how data comes to us from our registrar's office, so are not possible to make portable, but I suppose they could still be useful to someone (especially someone like me who isn't a shell or perl programmer). Others (like the first two) possibly work unaltered as long as WEBWORK_ROOT is /opt/webwork/webwork2, but can be easily edited.

So if anyone wants to use or work from any of these, feel free to email me.

Mark points out that it might be worth putting together a repository of (potentially) useful scripts for administrative purposes somewhere?

-Hal