diff --git a/index.js b/index.js index e6e504e..b78e711 100644 --- a/index.js +++ b/index.js @@ -352,7 +352,7 @@ async function list() { if (c.Status.includes("(unhealthy)")) hcStatus = "(unhealthy)" if (monContainers.includes(c.Id + "," + c.State + "," + c.Names[0] + "," + hcStatus) == false && monContainers.length !== 0) { // exclude exited status if set - if (EXCLUDE_EXITED == 'true' && c.State.toLocaleLowerCase() == 'exited') { + if (EXCLUDE_EXITED == 'true' && c.State.toLocaleLowerCase() == 'exited' && (typeof query !== 'undefined' && query)) { // ignore } else { @@ -405,10 +405,11 @@ async function list() { monContainers.forEach(c => { let delArray = newConArray.filter(nc => nc.includes(c.split(",")[0])); // if no match in history array and latest scan, then is deleted - if(delArray.length==0 && EXCLUDE_EXITED !== 'true'){ + if(delArray.length==0 && EXCLUDE_EXITED !== 'true' && (typeof c.Id !== 'undefined' && c.Id)){ var output = c.split(",")[2].replace("/","") + ": exited" if(SHA.toLowerCase()=='true'){ - output += " " + c.ImageID + output += " " + c.Id + console.log(c); } console.log(" - " + output); //send(output) diff --git a/package.json b/package.json index c206296..fdff0b5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "monocker", - "version": "2.13.1", + "version": "2.13.2", "description": "Monitors and alerts for docker containers state changes", "type": "module", "main": "index.js",