Ignore:
Timestamp:
Sep 13, 2013, 4:09:14 PM (12 years ago)
Author:
Herwig Bauernfeind
Message:

SMBMon 2.5: Add zombie detection

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/guitools/smbmon/smbmon.vrx

    r797 r805  
    330330    ok = VRSet("PB_Reload", "Enabled", VRFileExists(samba.!smbcmd))
    331331
    332     ok = VRSet("CN_Daemons", "View", DaemonView)
    333     ok = VRSet("CN_smbtree", "View", TreeView)
    334     ok = VRSet("CB_NoMsgBox","Set",  NoMsgBox)
    335     ok = VRSet("CB_WPSStartStop","Set",  WPSStartStop)
     332    ok = VRSet("CN_Daemons",      "View", DaemonView)
     333    ok = VRSet("CN_smbtree",      "View", TreeView)
     334    ok = VRSet("CB_NoMsgBox",     "Set",  NoMsgBox)
     335    ok = VRSet("CB_WPSStartStop", "Set",  WPSStartStop)
     336    ok = VRSet("CB_DetectZombies","Set",  DetectZombies)
    336337
    337338    call _INILayoutRead "CN_Users"
     
    423424    if Font.!Status   = "" then Font.!Status   = "9.WarpSans"
    424425
    425     Intervall = VRGetIni( "Settings", "Intervall", OurINI)
     426    Intervall = VRGetIni( "Settings", "Intervall", OurINI,'NoClose')
    426427    if Intervall = "" then Intervall = 60
    427428
    428     IntervallMin = VRGetIni( "Settings", "IntervallMin", OurINI)
     429    IntervallMin = VRGetIni( "Settings", "IntervallMin", OurINI,'NoClose')
    429430    if IntervallMin = "" then IntervallMin = 180
    430431
    431     CurrentPageNr = VRGetIni( "Settings", "CurrentPageNr", OurINI)
     432    CurrentPageNr = VRGetIni( "Settings", "CurrentPageNr", OurINI,'NoClose')
    432433    if CurrentPageNr = "" then CurrentPageNr = 4
    433434
    434     DaemonView = VRGetIni( "Settings", "DaemonView", OurINI)
     435    DaemonView = VRGetIni( "Settings", "DaemonView", OurINI,'NoClose')
    435436    if DaemonView = "" then DaemonView = "Detail"
    436437
    437     TreeView = VRGetIni( "Settings", "TreeView", OurINI)
     438    TreeView = VRGetIni( "Settings", "TreeView", OurINI,'NoClose')
    438439    if TreeView = "" then TreeView = "IconTree"
    439440
    440     NoMsgBox = VRGetIni( "Settings", "NoMsgBox", OurINI)
     441    NoMsgBox = VRGetIni( "Settings", "NoMsgBox", OurINI,'NoClose')
    441442    if NoMsgBox = "" then NoMsgBox = 1
    442443
    443     WPSStartStop = VRGetIni( "Settings", "WPSStartStop", OurINI)
     444    WPSStartStop = VRGetIni( "Settings", "WPSStartStop", OurINI,'NoClose')
    444445    if WPSStartStop = "" then WPSStartStop = 1
     446
     447    DetectZombies = VRGetIni( "Settings", "DetectZombies", OurINI,'NoClose')
     448    if DetectZombies = "" then DetectZombies = 0
    445449
    446450    options.!debug = VRGetIni( "Options", "Debug", OurINI)
     
    490494    ok = VRSetIni( "Settings", "WPSStartStop", WPSStartStop,                   OurINI,'NoClose')
    491495    ok = VRSetIni( "Settings", "BigIcons",     \VRGet("CN_SMBTREE", "MiniIcons"),OurINI,'NoClose')
     496    ok = VRSetIni( "Settings", "DetectZombies",DetectZombies,                  OurINI,'NoClose')
    492497
    493498    ok = VRSetIni( "Options",  "Debug",    options.!debug,             OurINI, 'NoClose' )     
     
    589594    CALL NLVSetText 'Page_6',      'Hinttext', 60  */
    590595
    591     CALL NLVSetText 'DT_Refresh',     'Caption',  25
    592     CALL NLVSetText 'DT_RefreshMin',  'Caption',  25
    593     CALL NLVSetText 'DT_Intervall',   'Caption',  26
    594     ok = VRSet("DT_IntervallMin","Caption", NLVGetMessage(26)' 'NLVGetMessage(28))
    595     CALL NLVSetText 'CB_NoMsgBox',    'Caption',  27
    596     CALL NLVSetText 'CB_WPSSTARTSTOP','Caption',  29
     596    CALL NLVSetText 'DT_Refresh',      'Caption',  25
     597    CALL NLVSetText 'DT_RefreshMin',   'Caption',  25
     598    CALL NLVSetText 'DT_Intervall',    'Caption',  26
     599    ok = VRSet("DT_IntervallMin",      "Caption", NLVGetMessage(26)' 'NLVGetMessage(28))
     600    CALL NLVSetText 'CB_NoMsgBox',     'Caption',  27
     601    CALL NLVSetText 'CB_WPSSTARTSTOP', 'Caption',  29
     602    CALL NLVSetText 'CB_DetectZombies','Caption',  30
    597603
    598604    CALL NLVSetText 'ContextMenu_Daemons_Sort',   'Caption', 35
     
    846852            end
    847853            smbdpidhandle.I = VRMethod( "CN_Daemons", "AddRecord", smbdhandle, , 'PID 'word(smbdpids,I)' ('d2x(word(smbdpids,I))'x)', "$48")
     854            /* we ping all smbd.exe except the first one */
     855            if DetectZombies = 1 & I > 1 then do
     856                ok = VRSet("Main", 'Pointer', 'Wait' )
     857                address cmd samba.!smbcontrolexe' 'word(smbdpids,I)' ping --timeout=2 --debuglevel=0 2>'samba.!error' 1>'samba.!msg
     858                ok = VRSet("Main", 'Pointer', '<default>' )
     859                response = linein(samba.!msg)
     860                ok = stream(samba.!msg,'c','close')
     861                if pos('PONG', response) = 0 then do /* we have a zombie */
     862                    ok = VRMethod( "CN_Daemons", "SetRecordAttr", smbdpidhandle.I,"Icon", "$49")
     863                    say "  Found Zombie "word(smbdpids,I)
     864                end
     865            end
    848866            if Username <> "" then do
    849867                smbdpidhandle.I.user = VRMethod( "CN_Daemons", "AddRecord", smbdpidhandle.I, , Username, "$44")
     
    12171235    if options.!Debug then ok = VRREdirectStdIO("ON")
    12181236                      else ok = VRREdirectStdIO("OFF")
     1237return
     1238
     1239/*:VRX         CB_DetectZombies_Click
     1240*/
     1241CB_DetectZombies_Click:
     1242    DetectZombies = VRGet("CB_DetectZombies","set")
     1243    say 'DetectZombies = "'DetectZombies'"'
    12191244return
    12201245
     
    22292254SW_FILES_Init:
    22302255    window = VRInfo( "Object" )
    2231     if( \VRIsChildOf( window, "Notebook" ) ) then do
     2256    if( \VRIsChildOf( window, "TDL" ) ) then do
    22322257        call VRMethod window, "CenterWindow"
    22332258        call VRSet window, "Visible", 1
     
    22602285SW_SERVICE_Init:
    22612286    window = VRInfo( "Object" )
    2262     if( \VRIsChildOf( window, "Notebook" ) ) then do
     2287    if( \VRIsChildOf( window, "TDL" ) ) then do
    22632288        call VRMethod window, "CenterWindow"
    22642289        call VRSet window, "Visible", 1
     
    22912316SW_SETTINGS_Init:
    22922317    window = VRInfo( "Object" )
    2293     if( \VRIsChildOf( window, "Notebook" ) ) then do
     2318    if( \VRIsChildOf( window, "TDL" ) ) then do
    22942319        call VRMethod window, "CenterWindow"
    22952320        call VRSet window, "Visible", 1
     
    23222347SW_SMBTREE_Init:
    23232348    window = VRInfo( "Object" )
    2324     if( \VRIsChildOf( window, "Notebook" ) ) then do
     2349    if( \VRIsChildOf( window, "TDL" ) ) then do
    23252350        call VRMethod window, "CenterWindow"
    23262351        call VRSet window, "Visible", 1
Note: See TracChangeset for help on using the changeset viewer.