Ad Widget

Collapse

Windows processes monitoring

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • scout
    Junior Member
    • May 2012
    • 28

    #1

    Windows processes monitoring

    Hello,

    I would like to monitor Windows systems. Looking solution to monitor each Windows process (how much each process take CPU usage, RAM).

    I.e. looking solution how to implement task manager process tab status into Zabbix like that:

    process name/ user/ CPU usage/ Memory usage

    Thank you for comments.
  • BrentN
    Member
    • Mar 2012
    • 37

    #2
    I'm using a powershell script for this, but I'm dumping it all into a single text item as a table. Not sure if that is what you want, but here's how I'm doing it.

    PowerShell script:
    Code:
    $table = `
    	@{Expression={$_.Name};Label="Executable";width=20}, `
    	@{Expression={$_.Description};Label="Process Description";width=25}, `
    	@{Expression={$_.ID};Label="PID";width=7;align="left"}, `
    	@{Expression={"{0:N1}" -f ($_.CPU)};Label="CPU Load";width=10;align="left"}, `
    	@{Expression={"{0:N0}" -f ($_.NPM / 1024)};Label="Nonpaged (MB)";width=15;align="left"}, `
    	@{Expression={"{0:N0}" -f ($_.PM / 1024)};Label="Paged (MB)";width=15;align="left"}, `
    	@{Expression={"{0:N0}" -f ($_.WS / 1024)};Label="Working (MB)";width=15;align="left"}, `
    	@{Expression={"{0:N0}" -f ($_.VM / 1024)};Label="Virtual (MB)";width=15;align="left"}
    
    Get-Process | Sort-Object CPU -Descending | ft $table
    Script outputs a table sorted by CPU load. You'd need to add additional expressions to get things like the session ID or user. You'd also need to set your powershell signing to executelocal or all.

    I created a user parameter in my zabbix_agentd.conf as follows:

    Code:
    UserParameter=ListAllProcesses,mode con cols=140 && powershell -nologo -file C:\Zabbix\Scripts\ListAllProcesses.ps1
    The reason for the mode command is because the output is wider than the deafult windows command line width of 80 columns.

    Finally, in Zabbix I have an item on my Windows template as follows (note that I'm using active checks):

    Name: Processes on Server (or whatever you want)
    Type: Zabbix agent (active)
    Key: ListAllProcesses
    Type: Text
    Update interval: 480 secs

    If the item ends up in an not supported state just check your settings/scripts and enable it again. For some reason I had to re-enable it twice before it started to work for me.

    The only issue I have with this method is that even though the text returned to Zabbix is formatted as a table, the latest data table in Zabbix doesn't use a fixed width font so the table is all messy. I'll probably end up editing the style for that table to fix it but I wish Zabbix had another text option for "plain text".

    Comment

    • mmarkwitzz
      Senior Member
      • Jan 2011
      • 106

      #3
      If anybody is interested, I have created a template based on this ideea that can create dynamic graphs of processes memory, cpu, disk read/writes per sec.

      You cand find it in: http://www.zabbix.com/forum/showthread.php?t=26987

      Comment

      • sccuser
        Member
        • May 2013
        • 77

        #4
        Allow me dig this thread with a silly question.
        I did exactly as the first post, then how can I view the result in Zabbix?

        Run the script from Agent machine (ServerActive already registered in the zabbix_agentd.win.conf also)


        "ListAllProcesses" item


        The latest data of that host does not show the thing what I'm expecting.


        The "ListAllProcesses" is working fine I think


        Thanks!
        Last edited by sccuser; 05-01-2014, 17:34.

        Comment

        • BrentN
          Member
          • Mar 2012
          • 37

          #5
          Try checking the item from the host you are monitoring. This might give you some additional info on why you aren't seeing it show up in Zabbix. Also make sure you have all of the active agent settings configured correctly in your conf file. I can post what I use if you aren't sure.

          To check the item from system you are monitoring:

          Log into the system and open a command prompt (run as admin if needed). CD to the location of your Zabbix executables (ex: c:\zabbix\bin). Run the following command:

          Code:
          Zabbix_agentd.exe -c [path to your Zabbix conf file] -t [name of item to check]
          Example:
          Code:
          Zabbbix_agentd.exe -c c:\zabbix\conf\zabbixa_agentd.conf -t ListAllProccesses
          This should return the output from the script just as you would expect to see it in Zabbix. See what this does and let me know.

          Comment

          • sccuser
            Member
            • May 2013
            • 77

            #6
            Hi BrentN,

            Yes it worked for now.
            But I have a problem with text display format as your warning, how can I workaround with below?



            Thanks!

            Comment

            • steveboyson
              Senior Member
              • Jul 2013
              • 582

              #7
              Add html tags to the script and configure the screen item in zabbix as "html".

              see https://www.zabbix.com/forum/showpos...10&postcount=2
              (reason for not opening too many threads for the same topic)
              Last edited by steveboyson; 09-01-2014, 21:11. Reason: link

              Comment

              • sccuser
                Member
                • May 2013
                • 77

                #8
                I'm not expert in scripting then please show me how can I approach the goal.
                Your image looks very nice for me.

                Comment

                • steveboyson
                  Senior Member
                  • Jul 2013
                  • 582

                  #9
                  Well, I'm not the powershell guy either ;-)

                  I prefer scripting in Perl.
                  You would need to modify the powershell script
                  Last line could read
                  Code:
                  Get-Process | Sort-Object CPU -Descending | ConvertTo-Html | ft $table
                  I don't know if it fits your needs.

                  See http://technet.microsoft.com/en-us/l.../ff730936.aspx ore http://technet.microsoft.com/en-us/l.../hh849944.aspx for more options.

                  For more advanced options you need to fiddle around with the table elements.
                  The colored bar graph in my table is generated via
                  Code:
                  <td style="vertical-align:top;" class=""><div style="background-color:Gold;width:70px;height:5px;border:1px solid #000;box-shadow: 3px 3px 3px #888888;"></div>279.39 GB</td>
                  statements.
                  Last edited by steveboyson; 10-01-2014, 03:01.

                  Comment

                  • sccuser
                    Member
                    • May 2013
                    • 77

                    #10
                    Awesome it's working.

                    But one problem, too many of info are displayed, it make me quite hard to view the overall.
                    Last 2 questions steveboyson: any suggestions
                    - to remove/hide specific columns in the script?
                    - to show only 10 first rows

                    Much appreciated!

                    Comment

                    • steveboyson
                      Senior Member
                      • Jul 2013
                      • 582

                      #11
                      Hmmm, yeah, that looks quite weird ;-)
                      But I'm really sorry, I ideally have no clue about powershell.

                      Maybe the originator of the script may help?

                      Comment

                      • sccuser
                        Member
                        • May 2013
                        • 77

                        #12
                        It's OK steveboyson, anyway thanks so much for the help.

                        Comment

                        Working...