Here is a starting example of how you can extract the variable values from the message:
local msg = "2014-09-04 11:39:57,447 [WebContainer : 5] DEBUG org.apache.axis.TIME - axisServlet.doPost: /WebServices pre=1 invoke=35 post=0 send=5 ProductCataloguePort.getProduct"
local pattern = " pre=(%d+) invoke=(%d+) post=(%d+) send=(%d+) "
local vpre,vinvoke,vpost,vsend = string.match(msg, pattern)
print("pre= "..vpre)
print("invoke= "..vinvoke)
print("post= "..vpost)
print("send= "..vsend)
You can run this in the script window in the NAS GUI or in the NSA. That made it easy for me to test, so I wanted to provide it as a definite working example. The script assumes the values will always be positive integers, but handing decimal values or negative numbers would be simple with some changes to the pattern.
Converting the script to extract the values from an alarm message is fairly easy. Getting it to submit QoS is also easy but requries a QoS definition. The script to extract and send QoS should look something like this:
local qos_name = "QOS_SOME_STUFF"
local qos_source = "source"
local qos_target = "target"
local pattern = " pre=(%d+) invoke=(%d+) post=(%d+) send=(%d+) "
local a = alarm.get()
local vpre,vinvoke,vpost,vsend = string.match(a.message, pattern)
local sum = vpre + vinvoke + vpost + vsend
nimbus.qos(qos_name, qos_source, qos_target, sum, QOS_ASYNC)
The qos_* variables should be set the values that make sense. The script assumes the QoS is asynchronous, which seems most likely when extracting from alarms. Before you send the first QoS, make sure you have a matching QoS definition. Assuming you need a custom QoS definition, you can create it manually or have the script do it (which might be unnecessary overhead depending on how often the script runs). If you try to do it in Lua, here is the relevant function call:
nimbus.qos_definition ( QosName, QosGroup, Description, Unit, UnitAbbreviation, HasMax [, IsAsynch] )
Creates a QoS definition named QosName. Unless the flag IsAsynch is true, an interval based QoS is created. Please note that subsequent definitions on the same name will not recreate or alter an existing QoS definition. The HasMax flag set requires that all qos data (issued by nimbus.qos) referring to this QoSName is issued with a MaxValue.