Starting Perfmon on all Windows machines with a single Batch file

In one of our project we have more than 4 Windows servers. We use perfmon to monitor the resource utilization. Each time we run load test we start the perfmon on all the servers.
So created the below batch file to do the job.

The batch file does the below:
  • Create a directory with current date and time
  • Start perfmon on all 4 AR servers
  • Wait for 1 hr
  • Copy the result file (.csv) from each server into the director created in step1.
  • Stop perfmon on all 4 AR servers.

@echo off

for /f %%I in ('wmic os get localdatetime ^|find "20"') do set dt=%%I
REM dt format is now YYYYMMDDhhmmss...
REM set dt=%dt:~4,2%-%dt:~2,2%-%dt:~0,4%

set dt=%dt:~6,2%%dt:~4,2%%dt:~2,2%%dt:~8,2%%dt:~10,2%
echo %dt%

mkdir D:\Perfmon\Perfmon_%dt%

logman start "Counter" -s server1
logman start "Counter" -s server2
logman start "Counter" -s server3
logman start "Counter" -s server4

timeout /t 3600

copy \\server1\c$\PerfLogs\Admin\Counter\*%dt%*.csv D:\Perfmon\Perfmon_%dt%\. 
copy \\server2\c$\PerfLogs\Admin\Counter\*%dt%*.csv D:\Perfmon\Perfmon_%dt%\. 
copy \\server3\c$\PerfLogs\Admin\Counter\*%dt%*.csv D:\Perfmon\Perfmon_%dt%\.
copy \\server4\c$\PerfLogs\Admin\Counter\*%dt%*.csv D:\Perfmon\Perfmon_%dt%\.

logman stop "Counter" -s server1
logman stop "Counter" -s server2
logman stop "Counter" -s server3
logman stop "Counter" -s server4

Note: The Data collector with name "Counter" is already added or created in perfmon under "Data Collector Sets"-> "User Defined" on all the servers.
Note: The .csv file created was ending with ddMMyyyyhhmm format.

Comments

  1. Useful information that i have found. don't stop sharing and Please keep updating us..... Thanks

    ReplyDelete
  2. Really thankful to you. We were looking for exact same answer.

    ReplyDelete
  3. Worthful testing tutorial. Appreciate a lot for taking up the pain to write such a quality content on testing tutorial. Just now I watched this similar testing tutorial and I think this will enhance the knowledge of other visitors for suretesting training institute in hyderabad

    ReplyDelete
  4. thank your valuable content.we are very thankful to you.one of the recommended blog.which is very useful to new learners and professionals.content is very useful for hadoop learners


    Best Spring Classroom Training Institute
    Best Devops Classroom Training Institute
    Best Corejava Classroom Training Institute
    Best Advanced Classroom Training Institute
    Best Hadoop Training Institute
    Best PHP Training Institute

    ReplyDelete
  5. Nice Information
    "Pressure Vessel Design Course is one of the courses offered by Sanjary Academy in Hyderabad. We have offer professional
    Engineering Course like Piping Design Course,QA / QC Course,document Controller course,pressure Vessel Design Course,
    Welding Inspector Course, Quality Management Course, #Safety officer course."
    Piping Design Course
    Piping Design Course in India­
    Piping Design Course in Hyderabad
    QA / QC Course
    QA / QC Course in india
    QA / QC Course in Hyderabad
    Document Controller course
    Pressure Vessel Design Course
    Welding Inspector Course
    Quality Management Course
    Quality Management Course in india
    Safety officer course

    ReplyDelete
  6. I am impressed. I don't think Ive met anyone who knows as much about this subject as you do. You are truly well informed and very intelligent. You wrote something that people could understand and made the subject intriguing for everyone. Really, great blog you have got here
    BCOM 1st, 2nd & Final Year Exam Time Sheet 2020
    Maharaja Surajmal Brij University BCOM 1st Year Exam Time Schedule 2020

    ReplyDelete
  7. I perceived a lots of new Technical things in this wonderful site.Unique information's are shared through it.Keep working Like this
    Java training in chennai | Java training in annanagar | Java training in omr | Java training in porur | Java training in tambaram | Java training in velachery

    ReplyDelete
  8. Thank you for sharing this useful article with us. This blog is a very helpful to me in future. Keep sharing informative articles with us.

    https://www.ahmedabadcomputereducation.com/course/laravel-training-course/

    ReplyDelete
  9. I am really happy to say it’s an interesting post to read . I learn new information from your article , you are doing a great job . Keep it up






    ReplyDelete
  10. Useful information that I have found. don't stop sharing and Please keep updating
    Selenium training in HYD

    ReplyDelete
  11. This comment has been removed by the author.

    ReplyDelete

Post a Comment

Popular posts from this blog

Steps to Analyze AWR Report in Oracle

Vmstat Output explained

Verifications and Error Handling in LoadRunner *Web_reg_find and Web_reg_save_param*