0

Here are things I already know, using vscsistat -t option I can get command traces for "VM/.vmdk" on ESxi.

Steps to get scsi traces are:

  1. Start capturing traces, On Successful starting will generated log_channel (id)

    vscsiStats -s -t -w worldgroupid -i handleid
    
  2. Dump traces to file in binary format

    logchannelloger channelname filename
    
  3. Get human readable fromat from trace file.

    vscsistats -e filename
    

With this steps, each time I fire command vscsistats -e filename to get scsitrace in human readable format from tracefile, It returns trace data from beginning to till time command is fired.

If I fire command after 10 minutes then again it return traces from begining to time of firing command.

So question is there any way to dump traces as they come to binary file directly to stdout like tail -f or blktrace -o - |blkparse -i - like on linux?

Froggiz
  • 3,043
  • 1
  • 19
  • 30
use302432
  • 1
  • 1

1 Answers1

0

It is not designed like that:

  VscsiStats -- This tool controls vscsi data collection for virtual machine disk
                disk I/O workload characterization. Users can start and stop online data
                data collection for particular VMs as well as print out online histogram data.
                Command traces can also be collected and printed.

  The following histogram related options are available:
     -h, --help will print the usage
     -l, --list will list the available virtual machines and their virtual disks
     -r, --reset will reset the stats
     -s, --start will start vscsiStats collection; exclusive of -x
     -x, --stop will stop vscsiStats collection; exclusive of -s
     -w <worldgroup id>, --worldgroupid specifies a worldID to use for this operation
     -i <handle id>, --handleid specifies a vscsi handleID to use for this operation
           requires the -w option
     -p <histoType>, --printhistos will print out the current histograms for the specified
            histogram type. May be used in conjunction with -w and -i.
            histoType must be one and only one of:
                 all, ioLength, seekDistance, outstandingIOs, latency, interarrival
     -c, --csv will use comma as delimiter in conjunction with -p

  The following command trace related options are available:
     -t, --tracecmds will start scsi cmd traces; in conjunction with -s
         Note:- the -t option consumes significant system resources so
                enabling it indefinitely is not advisable
              - try to limit the #virtual disk for which cmd tracing is enabled at any
                given time by using --worldgroupid and/or --handleid options.
              - trace contains NO customer sensitive data
                - only information recorded is:
                  - serialnumber, IO block size, number of scatter-gather elements
                  - command type, block number, timestamp
                - Therefore, actual data/payload of commands is not stored
              - If successfully started, log channel id(s) will be printed out.
                To store the command trace in a file for later processing, invoke:
                $ logchannellogger <log_channel_id> <binary_trace_file>
     -e <trace file name>, --traceprettyprint reads in a vscsi cmd trace from the given
        filename and sends a CSV formatted output to stdout; exclusive of all other options

  vscsiStats Usage:
         vscsiStats [options]

What you can do is launching watch -n 1 cat <file> to refresh the content of your file in another shell. If you don't want to start manually your commands, you can batch them and add them to cron.

By the way be carefull some file in esxi are reset each reboot.

Here the way to add a script to cron without being reset each startup:

  • edit file /etc/rc.local.d/local.sh

      #add to crontab a task
      echo "01 00 1,15 * * root /vmfs/volumes/datastore1/script/yourscript.sh" >> /var/spool/cron/crontabs/root
      #stop crontab process
      kill $(cat /var/run/crond.pid)
      #start crontab process
      crond
    

do not forget to set your script as executable

chmod +x /vmfs/volumes/datastore1/script/yourscript.sh
Froggiz
  • 3,043
  • 1
  • 19
  • 30
  • but still I have to fire vscsistat -e command ,tail -f will not work – use302432 Nov 26 '15 at 10:55
  • Yup you stil have to fire it, but you can cron it to automatize it. And you can use `watch -n 1 cat ` to view full content of the file. – Froggiz Nov 26 '15 at 11:07
  • but it will give traces from the start , how can I distinguished between two subsequent call. – use302432 Nov 26 '15 at 11:11
  • Maybe you should reformulate your question then : `So question is there any way to dump traces as they come to binary file directly to stdout`. If you want to compare file, just create 2 files and compare them with `diff file1 file2` – Froggiz Nov 26 '15 at 11:16
  • each time when I query for human readable format I have to make "diff ", is any workaround for this? – use302432 Nov 27 '15 at 05:00
  • Maybe, maybe not. If you make a script it can be done automatically.You can still ask on VMWare forum if there is another way. what is the goal of what you want to do ? – Froggiz Nov 27 '15 at 09:16
  • well I posted there several days ago, but got no response. I want to get live traces and that's' it. If you used blktrace/blkparse before you will know. Well your workaround is closed to what I looking but can't upvote because of my rating – use302432 Nov 27 '15 at 09:25
  • No, i mean the whole goal of that question ? You didn't get answer on VMWare forum cause it is not designed for it. Anyway try the solution i gave you, it should theorically works. – Froggiz Nov 27 '15 at 09:29
  • thank you very much, I will try to create cronjob as you said – use302432 Nov 27 '15 at 09:32