Ad Widget

Collapse

Monitoring available Windows updates

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Colttt
    Senior Member
    Zabbix Certified Specialist
    • Mar 2009
    • 878

    #46
    ohh thanks..

    can i give the script parameters?
    ala
    Code:
    updates.whs -updatesHigh
    and i got only this Data?


    ---------------------------------------

    now you dont need to setup the hostname manualy..

    Code:
    serverName = "zabbix.mydoamin.com"
    hostName = strComputerName
    zbxSender = "C:\Program Files\Zabbix Agent\zabbix_sender.exe"
    
    updatesHigh = 0
    updatesOptional = 0
    
    Set objSearcher = CreateObject("Microsoft.Update.Searcher")
    Set objSysInfo = CreateObject("Microsoft.Update.SystemInfo")
    Set objResults = objSearcher.Search("IsInstalled=0")
    Set colUpdates = objResults.Updates
    Set WSHShell = CreateObject("WScript.Shell")
    Set wshNetwork = WScript.CreateObject( "WScript.Network" )
    strComputerName = wshNetwork.ComputerName
    
    For i = 0 to colUpdates.Count - 1
    
    	If (colUpdates.Item(i).IsInstalled = False AND colUpdates.Item(i).AutoSelectOnWebSites = False) Then
    		updatesOptional = updatesOptional + 1
    	ElseIf (colUpdates.Item(i).IsInstalled = False AND colUpdates.Item(i).AutoSelectOnWebSites = True) Then
    		updatesHigh = updatesHigh + 1
    	End IF
        
    Next
    
    updatesTotal = (updatesHigh + updatesOptional)
    
    WSHShell.Exec zbxSender & " -z " & serverName & " -s " & hostName & " -k win_updates[total] -o " & updatesTotal
    WSHShell.Exec zbxSender & " -z " & serverName & " -s " & hostName & " -k win_updates[high] -o " & updatesHigh
    WSHShell.Exec zbxSender & " -z " & serverName & " -s " & hostName & " -k win_updates[optional] -o " & updatesOptional
    WSHShell.Exec zbxSender & " -z " & serverName & " -s " & hostName & " -k win_updates[reboot] -o " & objSysInfo.RebootRequired
    
    WScript.Quit 0
    Last edited by Colttt; 24-02-2011, 15:30.
    Debian-User

    Sorry for my bad english

    Comment

    • eger
      Member
      • Nov 2006
      • 95

      #47
      Originally posted by Shad0w
      ohh thanks..

      can i give the script parameters?
      ala
      Code:
      updates.whs -updatesHigh
      and i got only this Data?


      ---------------------------------------

      now you dont need to setup the hostname manualy..

      Code:
      serverName = "zabbix.mydoamin.com"
      hostName = strComputerName
      zbxSender = "C:\Program Files\Zabbix Agent\zabbix_sender.exe"
      
      updatesHigh = 0
      updatesOptional = 0
      
      Set objSearcher = CreateObject("Microsoft.Update.Searcher")
      Set objSysInfo = CreateObject("Microsoft.Update.SystemInfo")
      Set objResults = objSearcher.Search("IsInstalled=0")
      Set colUpdates = objResults.Updates
      Set WSHShell = CreateObject("WScript.Shell")
      Set wshNetwork = WScript.CreateObject( "WScript.Network" )
      strComputerName = wshNetwork.ComputerName
      
      For i = 0 to colUpdates.Count - 1
      
      	If (colUpdates.Item(i).IsInstalled = False AND colUpdates.Item(i).AutoSelectOnWebSites = False) Then
      		updatesOptional = updatesOptional + 1
      	ElseIf (colUpdates.Item(i).IsInstalled = False AND colUpdates.Item(i).AutoSelectOnWebSites = True) Then
      		updatesHigh = updatesHigh + 1
      	End IF
          
      Next
      
      updatesTotal = (updatesHigh + updatesOptional)
      
      WSHShell.Exec zbxSender & " -z " & serverName & " -s " & hostName & " -k win_updates[total] -o " & updatesTotal
      WSHShell.Exec zbxSender & " -z " & serverName & " -s " & hostName & " -k win_updates[high] -o " & updatesHigh
      WSHShell.Exec zbxSender & " -z " & serverName & " -s " & hostName & " -k win_updates[optional] -o " & updatesOptional
      WSHShell.Exec zbxSender & " -z " & serverName & " -s " & hostName & " -k win_updates[reboot] -o " & objSysInfo.RebootRequired
      
      WScript.Quit 0
      Hmm, that is a good idea, does that include the full name + domain suffix? I will update the main post with this code once I test it. I haven't had time to work on my monitoring system lately.

      Comment

      • Colttt
        Senior Member
        Zabbix Certified Specialist
        • Mar 2009
        • 878

        #48
        its only the name without domain-suffix
        Debian-User

        Sorry for my bad english

        Comment

        • beeloo
          Member
          • Nov 2010
          • 62

          #49
          Originally posted by eger
          Not sure what you mean. Couldn't you just create a trigger for only win_updates[high] and then an action that filters for it?

          What I'm try to do is to generate an email daily which provide a summary of all the pcs under win_updates[high] (regardless there is 0 update or any update needed).

          Could you please let me know how to accomplish this under the filter option? I'm not 100% sure what to do with it.

          Thanks alot.

          Comment

          • beeloo
            Member
            • Nov 2010
            • 62

            #50
            I'm able to created a trigger for win_updates[high] and send an email. But I noticed that I will receive the trigger email for each host for any problem. Is there a way to group all the "problem" hosts together in one email and send to me daily?

            Comment

            • fisher
              Junior Member
              • Oct 2008
              • 27

              #51
              Originally posted by beeloo
              I'm able to created a trigger for win_updates[high] and send an email. But I noticed that I will receive the trigger email for each host for any problem. Is there a way to group all the "problem" hosts together in one email and send to me daily?
              You can create a new action (and add a condition to filter the intended messages only) and media type which just creates-updates file(s) with the reports of the machines, and this file could be mailed to you daily.

              Comment

              • Colttt
                Senior Member
                Zabbix Certified Specialist
                • Mar 2009
                • 878

                #52
                hello,

                this will work
                Code:
                C:\>"Programme\Zabbix Agent\zabbix_sender.exe" -z 192.x.x.x -s myPC -k win_updates[total]
                -o 0
                Info from server: "Processed 1 Failed 0 Total 1 Seconds spent 0.000234"
                sent: 1; skipped: 0; total: 1
                buw when i run the script, i dont become an value in zabbix, and there is no error in the zabbix_server.log.

                can somebody help me?
                Debian-User

                Sorry for my bad english

                Comment

                • meden199
                  Junior Member
                  • Jun 2010
                  • 9

                  #53
                  I have a little question about the script.

                  I received 1 time the correct data from the server.
                  I installed the update but on the zabbix dashbord it says that I have Windows Updates waiting.
                  This message won't go away.(Only after removing the complete template.)

                  Anny idea?

                  Comment

                  • Colttt
                    Senior Member
                    Zabbix Certified Specialist
                    • Mar 2009
                    • 878

                    #54
                    run the script ..

                    __________________
                    my solution was the right name.. zabbix is case senstiv..
                    the script send SERVER1 but zabbix need server1 ^^
                    Debian-User

                    Sorry for my bad english

                    Comment

                    • meden199
                      Junior Member
                      • Jun 2010
                      • 9

                      #55
                      The script runs every day at 06:30.
                      Even when I run the script manualy the messages on the dashbord stay.

                      When I take a look at lates data I can see that the latest data is form the time that the script runs.
                      The output from the script to zabbix is 0 updates.

                      I followed every step from the begging of thes Thread.

                      Comment

                      • Colttt
                        Senior Member
                        Zabbix Certified Specialist
                        • Mar 2009
                        • 878

                        #56
                        now i become an error in the origianl script on line 10.. can somebody confirm this?! how can i fix it?
                        Debian-User

                        Sorry for my bad english

                        Comment

                        • eger
                          Member
                          • Nov 2006
                          • 95

                          #57
                          Originally posted by Shad0w
                          now i become an error in the origianl script on line 10.. can somebody confirm this?! how can i fix it?
                          What error do you get? I still use the original script on my Windows 2008 R2 servers. No problems here.

                          Comment

                          • Colttt
                            Senior Member
                            Zabbix Certified Specialist
                            • Mar 2009
                            • 878

                            #58
                            i become this error:
                            Debian-User

                            Sorry for my bad english

                            Comment

                            • eger
                              Member
                              • Nov 2006
                              • 95

                              #59
                              Originally posted by Shad0w
                              i become this error:
                              Are you able to run Windows Updates normally on the machine? The error looks like a code returned from Windows Updates.

                              Comment

                              • Colttt
                                Senior Member
                                Zabbix Certified Specialist
                                • Mar 2009
                                • 878

                                #60
                                we use WSUS..

                                --------------
                                Edit: hmm.. now it works and i dont change anything, i only reboot the wsus-server.. hmm Windows-feature
                                Last edited by Colttt; 06-05-2011, 09:16.
                                Debian-User

                                Sorry for my bad english

                                Comment

                                Working...