More about JMXTerm and Alfresco

One of the multiple possibilities for JMXTerm client is scripting for defined tasks in your Alfresco Enterprise Server (as pointed out in the previous post). Let's check it with some simple examples. Consider the next shell script called (run-jmx.sh) 
#!/bin/bash
java -jar jmxterm-1.0-alpha-4-uber.jar -l service:jmx:rmi:///jndi/rmi://localhost:50500/alfresco/jmxrmi -p change_asap -u controlRole -i $1
 
And then the following text file (show-users.jmx)
 
domain Alfresco
bean Alfresco:Name=RepoServerMgmt
get UserCountAll
run listUserNamesAll
close
 
The result is something like:
 
$ ./run-jmx.sh show-users.jmx

Welcome to JMX terminal. Type "help" for available commands.
#domain is set to Alfresco
#bean is set to Alfresco:Name=RepoServerMgmt

#mbean = Alfresco:Name=RepoServerMgmt:
UserCountAll = 3;

#calling operation listUserNamesAll of mbean Alfresco:Name=RepoServerMgmt
#operation returns: 
[ admin, zylk, alfresco ]
#disconnected
 
You can prepare then other useful jmx scripts such as (ldap-resync.jmx)
 
domain Alfresco
bean log4j:logger=org.alfresco.repo.security.sync
set priority DEBUG
bean Alfresco:Category=Synchronization,Type=Configuration,id1=default
run stop
run start
bean log4j:logger=org.alfresco.repo.security.sync
set priority INFO
close
 
Finally you also may use it for monitoring purposes, for example, for a nagios monitoring (in the same way that Alfresco Nagios Icinga plugin does it with check_jmx.jar).
 
Some references of this are:
00

More Blog Entries

0 Comments