I am using the following directSQL to find out if Extension Mobility Profile is logged in or not. I need to do this check for multiple profiles periodically and sometimes it is more frequently. Seeing it could have negative impact on the AXL service in case of more frequent so I was wondering if there is any other good way of doing it. So I had a look at the AXL change notification feature and wanted to know if I could use it to be notified when an Extension Mobility profile login/logout activity happens. Can someone please give me some pointers on it?
select FIRST 1 device2.name as devicename, devicenumplanmap1.numplanindex as npindex, (SELECT name FROM routepartition as r WHERE r.pkid = numplan1.fkroutepartition) AS rpname, (SELECT name FROM callingsearchspace WHERE pkid = numplan1.fkcallingsearchspace_sharedlineappear) AS csspacename from extensionmobilitydynamic, device as device1, device as device2, numplan as numplan1, devicenumplanmap as devicenumplanmap1 where extensionmobilitydynamic.fkdevice_currentloginprofile = device1.pkid AND extensionmobilitydynamic.fkdevice = device2.pkid AND ( device1.pkid = DeviceNumPlanMap1.fkDevice ) AND ( numplan1.pkid = DeviceNumPlanMap1.fkNumPlan ) AND ( numplan1.dnorpattern = '8664' ) AND ( device1.name = 'JF_EM' ) order by device2.tkdeviceprofile
The *dynamic tables are implemented as in-memory tables and so are pretty fast and efficient. However with all the various joins and subqueries going on in your SQL, I would agree you would want to avoid calling this request over-frequently.
As the configuration of DNs/lines/CSS is not likely to change frequently, would it make sense to break out a simpler query of just extensionmobilitydynamic that can be executed more frequently with less overhead?
You can also use the Extension Mobility API to check users to see what devices they're logged in. It's a REST API. Here's the doc: Cisco DevNet
This won't alert you when something changes, but you can use it to poll the EM status of users and devices.