How To
Plugins Health Check
6 min
below are instructions to run the plugins health check script download script create the plugins health check js from the bottom by default, the script will search for all plugins to search by 1 or more plugins, modify the script, and enter the plugin name(s) for example var plugins = \['sw swimlane util', 'sw swimlane email']; swimlane platform installer (spi) & helm save the swimlane namespace an env variable note for spi, enter default for \<swimlane namespace> export ns=\<swimlane namespace> save the mongo primary into an env variable for standalone export mongo primary=swimlane sw mongo 0 for ha use the command below to lookup the primary kubectl n $ns exec swimlane sw mongo 0 mongo u admin p authenticationdatabase admin tls tlsallowinvalidcertificates admin eval="rs ismaster();" | grep primary replace \<mongo primary pod> with name of the pod (ex swimlane sw mongo #) from the previous step export mongo primary=\<mongo primary pod> copy the file plugins health check js in the primary mongo container kubectl n $ns cp plugins health check js $mongo primary /tmp/ run the file plugins health check js inside the mongo primary container kubectl n $ns exec $mongo primary mongo quiet swimlane u admin p authenticationdatabase admin tls tlsallowinvalidcertificates /tmp/plugins health check js | tee plugins health check results txt the output will be available in plugins health check results txt sample results plugin sw microsoft exchange \======================================================================================================================================================== packagedescriptors db packagedescriptors find({" id" {$regex 'sw microsoft exchange'}}) \======================================================================================================================================================== \| version 5 1 1 \| pythonversion 3 6 \======================================================================================================================================================== assetdescriptors db assetdescriptors find({"packagedescriptor name" {$regex 'sw microsoft exchange'}}) \======================================================================================================================================================== \| version 5 1 1 \| packagedescriptor \| | version 5 1 1 \| | pythonversion 3 6 \======================================================================================================================================================== availableactiondescriptors db availableactiondescriptors find({"packagedescriptor name" {$regex 'sw microsoft exchange'}}) \======================================================================================================================================================== \| name delete emails \| id amebj1vsrwguvflgt \| version 5 1 1 \| assetdependencyversion 5 1 1 \| packagedescriptor \| | version 5 1 1 \| | pythonversion 3 6 \| name get email metadata \| id apv76xjq7curc1xmm \| version 5 1 1 \| assetdependencyversion 5 1 1 \| packagedescriptor \| | version 5 1 1 \| | pythonversion 3 6 \| name move email to folder \| id aqry2mn9dbixhts2x \| version 5 1 1 \| assetdependencyversion 5 1 1 \| packagedescriptor \| | version 5 1 1 \| | pythonversion 3 6 \| name reply/forward email \| id aronzcftikismuxji \| version 5 1 1 \| assetdependencyversion 5 1 1 \| packagedescriptor \| | version 5 1 1 \| | pythonversion 3 6 \| name send an email \| id asldv1inoj6yslsp3 \| version 5 1 1 \| assetdependencyversion 5 1 1 \| packagedescriptor \| | version 5 1 1 \| | pythonversion 3 6 \| name set email category \| id atitqsb6tswtxmy4p \| version 5 1 1 \| assetdependencyversion 5 1 1 \| packagedescriptor \| | version 5 1 1 \| | pythonversion 3 6 \======================================================================================================================================================== assets db assets find({"descriptor packagedescriptor name" {$regex 'sw microsoft exchange'}}) \======================================================================================================================================================== \| id ahtky7bqmc re8zej \| name microsoft exchange \| descriptor \| | name microsoft exchange \| | version 5 1 1 \| | packagedescriptor \| | name sw microsoft exchange \| | version 5 1 1 \| | pythonversion 3 6 \======================================================================================================================================================== fs files db fs files find({"filename" {$regex 'sw microsoft exchange'}}) \======================================================================================================================================================== \| id a23ktt58vo6n1 ohr \| filename sw microsoft exchange 5 1 1 swimbundle \======================================================================================================================================================== non forked tasks db tasks find({"action t" "packagedaction", "action descriptor packagedescriptor name" {$regex 'sw microsoft exchange'}}) \======================================================================================================================================================== task #1 get exchange metadata \| id amruauae0q9ghnxqc \| action \| | packagedescriptorid ajgq9w8wg3l1rxdq5 (match not found) \| | assetid ahtky7bqmc re8zej (match found) \| | descriptor \| | | id ajgq9w8wg3l1rxdq5 \| | | name get email metadata \| | | assetdependencyversion 5 1 1 \| | | packagedescriptor \| | | | version 5 1 1 \| | | | pythonversion 3 6 task #2 move email \| id ajbc40s sh tss2kv \| action \| | packagedescriptorid aqry2mn9dbixhts2x (match found) \| | assetid null (match not found) \| | descriptor \| | | id aqry2mn9dbixhts2x \| | | name move email to folder \| | | assetdependencyversion 5 1 1 \| | | packagedescriptor \| | | | version 5 1 1 \| | | | pythonversion 3 6 \======================================================================================================================================================== forked tasks db tasks find({"action forkedfrompackage" {$exists true}, "action forkedfrompackage" {$regex 'sw microsoft exchange'}}) \======================================================================================================================================================== task #1 fork exchange delete email \| id anzhnjcvouxxpx5ht \| action \| | t python36action \| | assetid ahtky7bqmc re8zej (match found) \| | assetdependencyversion 5 1 1 \| | descriptor \| | actiontype python36 task #2 test move folder \| id au wp 4mgil949jf3 \| action \| | t python36action \| | assetid ahtky7bqmc re8zej (match found) \| | assetdependencyversion 5 1 1 \| | descriptor \| | actiontype python36 save the code below as plugin health check js db = db getsiblingdb('swimlane'); // default search all plugins var plugins = \[]; // to search by 1 or more plugins // 1 uncomment the next line and enter the plugin name //var plugins = \['sw xxx', 'sw xxx']; var assets = \[] var availableactiondescriptors = \[] var indent = "\t| "; var indent2 = "\t|\t| "; var indent3 = "\t|\t|\t "; var indent4 = "\t|\t|\t|\t "; var indent5 = "\t|\t|\t|\t|\t "; var header = " " var divider = "\t========================================================================================================================================================" if (plugins length === 0) { db getcollection('packagedescriptors') find({}, {"name" 1} ) foreach( function(mydoc) { plugins push(mydoc name); } ); } plugins foreach(function (pluginname) { print(header) print("plugin " + pluginname); // packagedescriptors print("\r"); print(divider); print("\tpackagedescriptors ") print(`\t\tdb packagedescriptors find({" id" {$regex '${pluginname}'}})`); print(divider); db getcollection('packagedescriptors') find( {" id" {$regex\ pluginname}}, { "name" 1, "version" 1, "pythonversion" 1 } ) foreach( function(mydoc) { print( indent + "version " + mydoc version ); print( indent + "pythonversion " + mydoc pythonversion ); print("\r"); } ); // assetdescriptors print(divider); print("\tassetdescriptors ") print(`\t\tdb assetdescriptors find({"packagedescriptor name" {$regex '${pluginname}'}})`); print(divider); db getcollection('assetdescriptors') find( {"packagedescriptor name" {$regex\ pluginname}}, { "version" 1, "packagedescriptor version" 1, "packagedescriptor pythonversion" 1 } ) foreach( function(mydoc) { print( indent + "version " + mydoc version); print( indent + "packagedescriptor "); print( indent2 + "version " + mydoc packagedescriptor version); print( indent2 + "pythonversion " + mydoc packagedescriptor pythonversion); print("\r"); } ); // availableactiondescriptors print(divider); print("\tavailableactiondescriptors ") print(`\t\tdb availableactiondescriptors find({"packagedescriptor name" {$regex '${pluginname}'}})`); print(divider); db getcollection('availableactiondescriptors') find( {"packagedescriptor name" {$regex\ pluginname}}, { "name" 1, "version" 1, "assetdependencyversion" 1, "packagedescriptor version" 1, "packagedescriptor pythonversion" 1 } ) foreach( function(mydoc) { availableactiondescriptors push(mydoc id); print(indent + "name " + mydoc name); print(indent + " id " + mydoc id); print(indent + "version " + mydoc version); print(indent + "assetdependencyversion " + mydoc assetdependencyversion); print(indent + "packagedescriptor "); print(indent2 + "version " + mydoc packagedescriptor version ); print(indent2 + "pythonversion " + mydoc packagedescriptor pythonversion ); print("\r"); } ); // assets print(divider); print("\tassets ") print(`\t\tdb assets find({"descriptor packagedescriptor name" {$regex '${pluginname}'}})`); print(divider); db getcollection('assets') find( {"descriptor packagedescriptor name" {$regex\ pluginname}}, { " id" 1, "name" 1, "descriptor name" 1, "descriptor version" 1, "descriptor packagedescriptor name" 1, "descriptor packagedescriptor version" 1, "descriptor packagedescriptor pythonversion" 1 } ) foreach( function(mydoc) { assets push(mydoc id); print(indent + " id " + mydoc id); print(indent + "name " + mydoc name); print(indent + "descriptor "); print(indent2 + "name " + mydoc descriptor name); print(indent2 + "version " + mydoc descriptor version ); print(indent2 + "packagedescriptor "); print(indent3 + "name " + mydoc descriptor packagedescriptor name); print(indent3 + "version " + mydoc descriptor packagedescriptor version); print(indent3 + "pythonversion " + mydoc descriptor packagedescriptor pythonversion); print("\r"); } ); // fs files print(divider); print("\tfs files ") print(`\t\tdb fs files find({"filename" {$regex '${pluginname}'}})`); print(divider); db getcollection('fs files') find( {"filename" {$regex\ pluginname} } ) foreach( function(mydoc) { print(indent + " id " + mydoc id); print(indent + "filename " + mydoc filename); } ); // non forked tasks var taskcount = 1 print("\r"); print(divider); print("\tnon forked tasks "); print(`\t\tdb tasks find({"action t" "packagedaction", "action descriptor packagedescriptor name" {$regex '${pluginname}'}})`); print(divider); var tasks = db getcollection('tasks') find( { "action t" "packagedaction", "action descriptor packagedescriptor name" {$regex\ pluginname} }, { " id" 1, "name" 1, "action packagedescriptorid" 1, "action assetid" 1, "action descriptor id" 1, "action descriptor name" 1, "action descriptor assetdependencyversion" 1, "action descriptor packagedescriptor version" 1, "action descriptor packagedescriptor pythonversion" 1 }); tasks foreach(function(task) { print("\ttask #" + taskcount++ + " " + task name + "\n"); print(indent + " id " + task id); print(indent + "action "); if (availableactiondescriptors includes(task action packagedescriptorid)) { print(indent2 + "packagedescriptorid " + task action packagedescriptorid + " (match found)"); } else { print(indent2 + "packagedescriptorid " + task action packagedescriptorid + " (match not found)"); } if (assets includes(task action assetid)) { print(indent2 + "assetid " + task action assetid + " (match found)"); } else { print(indent2 + "assetid " + task action assetid + " (match not found)"); } print(indent3 + "descriptor "); print(indent4 + " id " + task action descriptor id); print(indent4 + "name " + task action descriptor name); print(indent4 + "assetdependencyversion " + task action descriptor assetdependencyversion); print(indent4 + "packagedescriptor "); print(indent5 + "version " + task action descriptor packagedescriptor version); print(indent5 + "pythonversion " + task action descriptor packagedescriptor pythonversion); print("\r"); }); // forked tasks print(divider); print("\tforked tasks "); print(`\t\tdb tasks find({"action forkedfrompackage" {$exists true}, "action forkedfrompackage" {$regex '${pluginname}'}})`); print(divider); print("\r"); var taskcount = 1 var tasks = db getcollection('tasks') find( { "action forkedfrompackage" {$exists true}, "action forkedfrompackage" {$regex\ pluginname} }, { " id" 1, "name" 1, "action t" 1, "action assetid" 1, "action assetdependencyversion" 1, "action descriptor actiontype" 1 }); tasks foreach(function(task) { print("\ttask #" + taskcount++ + " " + task name + "\n"); print(indent + " id " + task id); print(indent + "action "); print(indent2 + " t " + task action t); if (assets includes(task action assetid)) { print(indent2 + "assetid " + task action assetid + " (match found)"); } else { print(indent2 + "assetid " + task action assetid + " (match not found)"); } print(indent2 + "assetdependencyversion " + task action assetdependencyversion); print(indent2 + "descriptor "); print(indent3 + "actiontype " + task action descriptor actiontype); print("\r"); }); });