View and collect Activities metrics
Use the ActivityMetricsService commands and Server Metrics page to monitor product usage, and to make configuration adjustments when necessary.
Before starting
Metrics are frequency data that are recorded about the database state. There are two ways to view and collect metrics. The simplest way is to enter the URL below or select Server Metrics from the site footer to see some of the most relevant metrics available for the application:
http://<servername.com:port>/activities/service/html/servermetricswhere <servername.com:port> is the appropriate host name and port number for your server.
You can also follow these steps to return metrics using administrative commands. No file check out or server restart is required when using these commands. This method takes more work, but it also provides you with results that you can write to a file. To run administrative commands, use the wsadmin client. See Starting the wsadmin client for details.
Note: Whichever method you use, the results are cached for one hour. If you attempt to collect metrics data again within that hour, the same numbers are displayed because they are read from the cache. After the cache expires and you request metrics data, the database is queried and the numbers are updated.
Note: You must be assigned to the metrics-reader role to be able to view metrics. Everyone is added to the metrics-reader role by default, but the administrator can change role assignments using the WAS Integrated Solutions Console. See Roles for more details.
You can collect the following metrics for Activities:
Table 1. Activities metrics
Metric
Description
activities.metric.distinct.loggedin7days
Number of users logged in the last week.
activities.metric.distinct.owners
Total number of distinct owners. This number helps you determine how many people are creating activities versus those who are participating in existing activities.
activities.metric.total.activities
Total number of activities.
activities.metric.total.creators
Total number of creators of greater than 2 activities. This number helps you to determine if just one or two people are creating all of the activities or if many people are creating activities.
activities.metric.total.entries
Total number of entries. You can compare the number of entries to the number of activities to determine how active the existing activities are. The larger the ratio, the more active the activities.
activities.metric.total.loggedin1day
Number of users logged in today.
activities.metric.total.loggedin30days
Number of users logged in the last month.
activities.metric.total.members
Total number of distinct members. People who are members of more than one activity are counted only once.
About this task
To collect metrics and write them to a file...
Procedure
- Start the Activities Jython script interpreter.
- Access the Activities configuration file:
execfile("activitiesAdmin.py")The command in this procedure writes information to a file.
If prompted to specify a service to connect to, specify the node where the file that you want to write to is stored.
- Enter one of the following commands to collect the current metrics:
- To collect all of the metrics at once, and have them returned as a hash table:
ActivityMetricsService.fetchMetrics()
- To collect one or a subset of metrics:
ActivityMetricsService.fetchMetric("<metric_to_fetch>")
- where the <metric_to_fetch> is one of the metrics defined in the Activities metrics table above.
For example:
ActivityMetricsService.fetchMetric("activities.metric.distinct.loggedin7days") ActivityMetricsService.fetchMetric("activities.metric.distinct.owners") ActivityMetricsService.fetchMetric("activities.metric.total.activities") ActivityMetricsService.fetchMetric("activities.metric.total.creators") ActivityMetricsService.fetchMetric("activities.metric.total.entries") ActivityMetricsService.fetchMetric("activities.metric.total.loggedin1day") ActivityMetricsService.fetchMetric("activities.metric.total.loggedin30days") ActivityMetricsService.fetchMetric("activities.metric.total.members")
- Use one of the following commands:
- To write all of the metrics to a file:
ActivityMetricsService.saveMetricToFile("<file_name>",<number>,"all")
- where you provide values for the following variables:
- <file_name>: Full path to a file in which to store the metric information with a TXT or CSV extension. If you plan to keep the metrics over time, use a universal file path so that you can run the command on any node and save the results to the same file. If the file does not exist, one is created. The metrics information is returned in comma separated format. If you plan to view the data in a spreadsheet, give the file a .CSV extension. A comma-separated values (CSV) file is a simple text format in which each record in the table is one line of the text file and each field value of a record is separated from the next with a comma. See Importing statistics and metrics into a spreadsheet for more details.
- <number>: The number of entries to persist in the file. If you specify 20, and add one new entry to the file, the file retains the last 19 entries and adds your new entry. Any older entries are deleted.
- For example:
ActivityMetricsService.saveMetricToFile( "C:/IBM/LotusConnections/Data/activities/metrics/TotalActs.txt", 40,“all”)
- or
ActivityMetricsService.saveMetricToFile( "//9.32.168.90/c$/IBM/LotusConnections/Data/activities/metrics/TotalActs.csv", 40,"all")
- To write one metric to a file:
ActivityMetricsService.saveMetricToFile("<file_name>",<number>,"<metric_to_save>")Note: Be sure that there are no extra returns after the command if you copy and paste from this page. Paste the command into a text editor like notepad first.
- where you provide values for the following variables:
- <file_name>: Full path to a text file in which to store the metric information. If the file does not exist, one is created.
- <number>: The number of entries to persist in the file. If you specify 20, and add one new entry to the file, the file retains the last 19 entries and adds your new entry. Any older entries are deleted.
- <metric_to_save>: Metric that you want to write to the file. See the Activities metrics table above for a list of options.
For example:
ActivityMetricsService.saveMetricToFile("C:/IBM/LotusConnections/Data/ activities/metrics/LoggedInThisWeek.txt",40, "activities.metric.distinct.loggedin7days") ActivityMetricsService.saveMetricToFile("C:/IBM/LotusConnections/Data/ activities/metrics/TotOwners.txt", 40,"activities.metric.distinct.owners") ActivityMetricsService.saveMetricToFile("C:/IBM/LotusConnections/Data/ activities/metrics/TotalActs.txt",40,"activities.metric.total.activities") ActivityMetricsService.saveMetricToFile("C:/IBM/LotusConnections/Data/ activities/metrics/TotCreat.txt",40,"activities.metric.total.creators") ActivityMetricsService.saveMetricToFile("C:/IBM/LotusConnections/Data/ activities/metrics/TotEntries.txt",40,"activities.metric.total.entries") ActivityMetricsService.saveMetricToFile("C:/IBM/LotusConnections/Data/ activities/metrics/LoggedInToday.txt",40, "activities.metric.total.loggedin1day") ActivityMetricsService.saveMetricToFile("C:/IBM/LotusConnections/Data/ activities/metrics/LoggedInThisMonth.txt",40, "activities.metric.total.loggedin30days") ActivityMetricsService.saveMetricToFile("C:/IBM/LotusConnections/Data/ activities/metrics/empCnt.txt",40,"activities.metric.total.members")For the activities.metric.total.members metric, for example, this command results in the following text getting added to the file:
dates,2008-01-08 14:30:22, activities.metric.total.members,100After four calls, spaced an hour apart, the file would contain the following text:
dates,2008-01-08 14:30:22,2008-01-08 15:30:22,2008-01-08 16:30:22, 2008-01-08 17:30:22 activities.metric.total.members,100,103,105,109
- To write a subset of metrics to a file:
- Define a java.util.ArrayList object variable named fldkeys.
- Add the subset of metrics that you want to write to a file to the array. For example, :
from java.util import ArrayList fldkeys=ArrayList() fldkeys.add("activities.metric.total.members") fldkeys.add("activities.metric.total.entries") fldkeys.add("activities.metric.distinct.owners")
- Use the following command to write the subset of metrics to a file:
ActivityMetricsService.saveMetricsToFile("C:/ibm/LotusConnections/Data/activities/metrics/MetList.txt",40,fldkeys)
Parent topic
Monitoring statistics and metricsRelated concepts
Collecting metrics
Related tasks
Importing statistics and metrics into a spreadsheet
Starting the wsadmin clientRelated reference
Roles