![]() ![]() |
Jul 22 2010, 10:06 AM
Post
#1
|
|
|
Rookie ![]() Group: Members Posts: 13 Joined: 5-May 10 Member No.: 2,409 |
QUOTE ---------------------------------------------------------------------------------------------------------- -- Version: 4.0 -- Date: 2009-10-29 -- Description: Counts the number of instances of a process that are running -- Arguments: process name, minimum count, maximum count -- -- Copyright © 2010, Intellipool AB -- -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without modification, are permitted provided that -- the following conditions are met: -- -- 1) Redistributions of source code must retain the above copyright notice, this list of conditions -- and the following disclaimer. -- 2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions -- and the following disclaimer in the documentation and/or other materials provided with the distribution. -- 3) Neither the name of Intellipool AB nor the names of its contributors may be used to endorse or promote -- products derived from this software without specific prior written permission. -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- ---------------------------------------------------------------------------------------------------------- -- This function is called by INM to retrieve a script configuration function OnConfigure() -- The variable returned must be called "Config" so INM can find it. Config = LuaScriptConfigurator() -- A parameter configuration, add them in the order the script is extracting them. Config:AddArgument("Maximale Anzahl RDP Sessions","Monitor will go into alarm if the number of instance running rises above this number.",LuaScriptConfigurator.CHECK_NOT_EMPTY) -- Set the entry point, this is the function called by INM Config:SetEntryPoint("main") -- Done with configuration, return the object return Config end -- This is the entry point function main() max = tonumber(GetArgument(0)) ok = true result = "" SetExitStatus("OK",true) --Query WMI for a list of all processes running on the machine. Query = TLuaWMIQuery(); sAbfrage = Query:Execute("Select ActiveSessions from Win32_PerfRawData_TermService_TerminalServices"); abfrage2 = string.sub(abfrage, string.find(abfrage,"%d") --if (abfrage2 > max) then --result = "The number of running instances is " .. abfrage2 .. " which is more than " .. max --ok = false --else --result = "The number of running instances is " .. abfrage2 .. " which is between " .. min .. " and " .. max --ok = true --end SetExitStatus(abfrage2,true); end get boolean error or nul error, what can i do? |
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 8th September 2010 - 07:47 AM |