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 ( 
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
The result is something like:
$ ./ 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 ]
You can prepare then other useful jmx scripts such as (ldap-resync.jmx)
domain Alfresco
set priority DEBUG
bean Alfresco:Category=Synchronization,Type=Configuration,id1=default
run stop
run start
set priority INFO
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:

More Blog Entries