How do you count the number of active calendars?

I believe a calendar gets created for all portal users (or at least after running cptool create calendar -all). Does anyone know how to get a report of the number of calendars (personal and group) currently being used?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

cscal is your friend

cd $CP_ROOT/products/SUNWics5/cal/bin
./cscal list > cals.txt

Then if you want to find out if the user account is active for each calendar, you could pipe that file into an ldapsearch command and look for the value of pdsAccountStatus

This command would give you the number of events for a given calendar:
./cscal list -v loginid | grep "number of events" | cut -f 2 -d "="

So to answer your question completely: if you want to find the number of events on each calendar, you first dump out the list of all calendars as above, and then pipe that list into the command that queries the number of events on a calendar. It's a simple matter to sort out the ones you want to report on from there.

Todd

cscal, cscomponents, awk, and sed are your friends :)

Funny how things work out, I was trying to figure out how to do this today and was checking here for a different problem but saw this. For my place we wanted to know who was actively using (i.e. creating events/todos) in the calendar. As such comparing the list of calendars against the pdsAccountStatus was not sufficient.

As such I have come up with the following steps:

  1. Extract a list of all calendars
    cd $CP_ROOT/products/SUNWics5/cal/bin
    ./cscal list > /tmp/cals.txt
  2. Find out how many events/todos are present in the calendar since Jan 1, 2010
    cat /tmp/cals.txt | awk '{print "cscomponents -s 20100101T000000Z list "substr($1,0,length($1)-1)" | tr -d '\''\\n'\'' | awk '\''{print $0}'\'' "}' | sh | tee /tmp/calReport.txt
  3. Convert report into a nice csv
    cat /tmp/calReport | awk '{print substr($1,0,length($1)-1)","$6","$9}'|sed s/events=//|sed s/tasks=// | tee /tmp/calreport.csv

The end result will be a CSV with columns for calendar id, # of events, # of todos. You can then do whatever analysis you want to figure out which calendars are active or not. In our case we are judging active as having data for 2010 or later, if you want to consider events further back just change the date specificed with -s in step 2.

output of cals.txt

While I do the cscal list, I got something like this on each line....
"oy2cheng: owner=oy2cheng status=enabled"

I cannot see any events, todos...  Am I missing something? or somthing we not enabled?

cscal list

 Thats what the 2nd step does, it is feeding the cscal list into the cscomponent command.  cscomponent list the events and todos.

You can use cscal to see the number of events/todos for a calendar, but not the events themselves.  Use the -v flag for verbose.

 

eg,

./cscal list calendarID -v

 

 

Does Banner put events in for you?

When we were using INTCOMP, Banner would populate some events in the Calendar. (such as lectures on Wednesday and Saturday).

Since we do not use Banner for scheduling our lectures, these fields were being used for other purposes.

This would have meant a skewed view of how many calendars were being used.

Fortunately we are not auto populating the calendar with these since we upgraded to Luminis 4.

Derek
University of Leeds, UK

Syndicate content