...
From the dashboard, add a new channel (for this example, I will call it Channel Monitor) with a From Translator component and for the Destination you can select to Channel (you can leave it empty).
Select a poll time under Source in the channel settings appropriate to your needs.
Input the following snippet of code in the translator, the code works by utilizing as follows:
It uses the iguana.status() API to retrieve the Iguana status (which includes channel status) and parse the data.
Next it will check for any stopped channels
.
Finally it will log a warning message using iguana.logWarning with a header and the names of the channels. (The header will be used in Iguana monitoring to detect the warnings).
Code Block |
---|
-- Get all channel status and log stopped channels in Iguana Log function main() -- 1) Retrieve status local status = iguana.status() -- 2) Parsed status and count all channels local parsedStatus = xml.parse{data=status} local iguanaParsedStatus = parsedStatus.IguanaStatus local count = iguanaParsedStatus:childCount("Channel") -- 3) Find all the stopped channels local stopped = {} for i = 1, count do if iguanaParsedStatus:child("Channel", i).Status:nodeValue() == 'off' then table.insert(stopped, iguanaParsedStatus:child("Channel", i).Name:nodeValue()) end end -- 4) Create a stopped channel warning in Iguana logs if (#stopped > 0) then local warningHeader = "The following channels are off:\n\n" local warningBody = table.concat(stopped, "\n") iguana.logWarning(warningHeader .. warningBody) end end |
...
Go to settings then Monitoring. You may have to setup your email settings, please visit this page for more information. https://help.interfaceware.com/v6/monitoring#settings
If your email is settings are already setup, add a new notification Standard Rule.
Select the source and channel to be your ‘Channel Monitor’ and note that you will be querying the logs of that channel for Warnings that contain the header ("The following channels are off” - Line 21 in the example code) and then select your recipients. Your rule should look something like this:
...