Forum Discussion

dragonflymr's avatar
dragonflymr
Icon for Cirrostratus rankCirrostratus
Mar 31, 2017

iStats v13 command help

Hi,

Here is help displayed by cli istats command:

Usage: istats  [-s ]  []
    is one of: 'set' 'incr' 'get' 'remove' 'dump' 'drop_row'
           'drop_column' 'clear_row'
    is a single quoted argument: "keyspace   ...  "
           (like "ltm.pool /Common/mypool counter mystat")
    is one of: 'counter' 'gauge' 'string' 'text' 'signed' 'unsigned' 'bin'
           'dec' 'hex' 'timestamp' 'timeval' 'uinthex'
    must be specified for 'set' and 'incr', and must be an integer for 'incr'
           The  for a gauge may be negative.  Use 2 dashes before the
           negative value (like 'incr "... gauge ..." -- -1')


I wonder if there are is any info how to use operations like drop_row, drop_colum, clear_row
What is [-s ]
 description "keyspace   ...  " - what is keyspace    and column? If possible some example of key using all above elements and multiple columnsIs there any description what can be stored in types: 'text' 'signed' 'unsigned' 'bin' 'dec' 'hex' 'timestamp' 'timeval' 'uinthex'And how those behave in relation to value used. What is difference between timestamp and timeval. I had ipression that those can be set without using value (like automatically place current time at the moment key is created in value) but it seems not be the case.Piotr  



  • Documentation here is atrocious. However, I've been poking around at iStats lately and (through trial and error) I think I can explain how this command actually works.

    Basically, setting an iStat goes like this:

    istats set "<TABLE_KEYSPACE> <ROW_NAME> <MEASURE_TYPE> <COLUMN_NAME>"
     
    # or (via iRule)
    ISTATS::set "<TABLE_KEYSPACE> <ROW_NAME> <MEASURE_TYPE> <COLUMN_NAME>"

    So to create iStats tables that (in our heads) look like this:

    #
    # ---------------- table_1 ----------------
    #              [column_1]  |  [column_2]
    #   [ row_1 ]    lorem     |    ipsum
    #   [ row_2 ]    dolor     |    magna
    #
     
    # 
    # ----------------------- table_2 ------------------------
    #              [column_1]  |  [column_2]  |  [column_3]
    #   [ row_1 ]     amet     |    dolore    |    aliqua
    #

    we would:

    istats set "table_1 row_1 string column_1" "lorem"
    istats set "table_1 row_1 string column_2" "ipsum"
    istats set "table_1 row_2 string column_1" "dolor"
    istats set "table_1 row_2 string column_2" "magna"
    istats set "table_2 row_1 string column_1" "amet"
    istats set "table_2 row_1 string column_2" "dolore"
    istats set "table_2 row_1 string column_3" "aliqua"

    and to pull that back out we would use:

    istats get "table_1 row_2 string column_2"
     
    # or grab all iStats
    istats dump

    Straightforward so far, but now we get to those other commands, which should make a lot more sense now that we know what keyspace/row/column all mean in this context.

    # istats remove "<TABLE_KEYSPACE> <ROW_NAME> <MEASURE_TYPE> <COLUMN_NAME>"
    # sets the value to default (does not actually remove anything from the table)
    istats remove "table_2 row_1 string column_2"
     
    # istats drop_row "<TABLE_KEYSPACE> <ROW_NAME>"
    # actually removes a row from the table
    istats drop_row "table_1 row_2"
     
    # istats drop_column "keyspace <TABLE_KEYSPACE> <MEASURE_TYPE> <COLUMN_NAME>"
    # removes a column from all rows in a particular table
    istats drop_column "keyspace table_2 string column_3"

    PLEASE NOTE:

    It is very dangerous to add too many columns to a particular table. The maximum length of the line (the sum of all columns) is 4032 bytes. If you exceed this limit (which is surprisingly easy to do), you will corrupt your iStats and running any further istats commands will

    1. produce weird, inconsistent results
    2. cause the BIG-IP to core and tmm to restart
  • How did you even get this much information to display? Could you provide a bit more context for the command?

     

  • How did you even get this much information to display? Could you provide a bit more context for the command?

     

  • This is a CLI command equivilant to the iRule

    ISTAT
    commands (see here for more info DevCentral Wiki - iRules ISTAT).

    Start with

    key
    which is made up of class, object, measure type (counter, gauge, string, text, signed, unsigned, bin, dec, hex, timestamp, timeval, uinthex), and measure name to be separated by whitespace and enclosed in double quotes.

    e.g.

    istats set "uri /12345 counter Requests
    would set an iStat named
    Requests
    under the class
    uri
    , object named
    /12345
    and a type of a
    counter

    The

    -s 
    is simply a way to write iStats to a file for testing e.g.
    istats set -s test.istat "uri /12345 counter Requests" 1
    will write the file
    test.istat
    and create the record
    Requests
    as above.

    You can then use

    istats get -s test.istat "uri /12345 counter Requests"
    or
    istats incr -s test.istat "uri /12345 counter Requests" 1
    which will only read and update the local file and not have any effect on the BIG-IP's actual iStats.

    A good option is to dump the lot using something like

    istats dump -s test.istat
    which would look like the following.

    test.istat [READONLY]: nextBlockId=704, last update at 2019-04-10 10:45:02
    
    all facts:
       [ uri=/12345 ][Requests] = 8 (2019-04-10 10:56:20)
    

    Recommend looking at the following for more info: Introduction to iStats