...
Note |
---|
Please note that this is only an example intended to show Iguana’s capabilities. You may need to modify this code or do some further testing to make sure this fit your requirements. |
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 -- Number of channels in instance local count = iguanaParsedStatus:childCount("Channel") -- List (table3) toFind holdall allthe stopped channelchannels names local stopped = {} -- Loop over the status page of Iguana and find all the stopped channels and insert them to table 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 -- If4) thereCreate area channels stopped thenchannel createwarnings ain warningIguana log if (#stopped > 0) then -- The header will be at the top of the warning local warningHeader = "The following channels are off:\n\n" -- Followed by all the channel names local warningBody = table.concat(stopped, "\n") -- Finally call the function and concatenate the header and the body iguana.logWarning(warningHeader .. warningBody) end end |
Then click on commit to source then add a note message at the bottom then click on “Commit Files”. Check “Update to run from new commit” if it pops up and click “Update”.
...