+  elseif msg_type=="ALARM" then
+    printLog("ALARM: "..msg_body)  
+    sens = splitStr(msg_body,",")
+    sensor = {}
+    idx = 1
+    sensor_type = nil
+    sensor_id = web_devid
+    mqtt_param = {}
+    for i,rec in ipairs(sens) do
+      recrd=splitStr(rec,'=')
+      key=recrd[1] or nil
+      value=recrd[2] or nil
+      if value then
+        if key=="TYPE" then
+          alarm_type=value
+        elseif key=="ID" then
+          alarm_id=value
+        else
+          mqtt_param[key]=value
+        end
+      end
+    end
+    if mqtt_client then
+      mqtt_msg = { type = alarm_type, id = alarm_id, data = mqtt_param }
+      serializedString = json.encode(mqtt_msg)
+      mqtt_client:publish(mqtt_alarm_topic,serializedString)
+    end
+    if alarm_exec then
+      command=alarm_exec..
+        " \""..string.gsub(alarm_type,"\"","\\\"")..
+        "\" \""..string.gsub(alarm_id,"\"","\\\"")..
+        "\" \""..string.gsub(msg_body,"\"","\\\"").."\""
+      os.execute(command)
+    end