Query the Property Store
search cancel

Query the Property Store

book

Article ID: 323475

calendar_today

Updated On:

Products

VMware Smart Assurance

Issue/Introduction

The purpose of this knowledge base article is to provide syntax and examples for querying the property store using propstore-client.sh.

Environment

Watch4Net/M&R - 7.x

Resolution

1). Property Store script location
     <APG install path>/Databases/APG-Property-Store/Default/bin/propstore-client.sh

2). Property names
     Property names that could be used for the query can be found in <APG install path>/Databases/APG-Property-Store/Default/tmp/DB/<DB name>

NOTE: There will be multiple entries under the DB directory if using a multi-database environment.


3). Syntax

    Usage: Query [-d (--distinct)] -f (--from) <partition directory> [-s (--select) <select clause>] [-w (--where) <where clause>]
 -f (--from) <partition directory> : the partition directory
 -s (--select) <select clause>     : the comma-separated list of selected columns (default is '*')
 -w (--where) <where clause>       : the where clause
 

NOTE: partition directory is the path to your DB name.
 

4). Sample queries
  • Select distinct results of a property (p_device):
     
    [root@APG bin]# ./propstore-client.sh -s p_device -d -f ../tmp/DB/APG-DB/
    p_device
    "SNMP-HOST"
    "VNX5300_II21"
    "APG.smrtsupport.local"
    "localhost"
  • Select multiple columns:
    [root@APG bin]# ./propstore-client.sh -s p_device,p_vstatus -f ../tmp/DB/APG-DB/
    p_device              p_vstatus
    "SNMP-HOST"     "active"
    "SNMP-HOST"     "inactive"
    "VNX5300_II21"   NULL
    "VNX5300_II21"   "active"
    "VNX5300_II21"   "inactive"
    "APG.smrtsupport.local"   "inactive"
    "localhost"            "inactive"

    Columns are separated by commas and cannot have spaces.
     
  • Select with where clause:
    [root@APG bin]# ./propstore-client.sh -s p_part,p_parttype -f ../tmp/DB/APG-DB/ -w p_device='localhost'
    p_part          p_parttype
    "Default"       "Task-Scheduler"
    "Default"       "Task-Scheduler"
    "Default"       "Tomcat"
    "Default"       "Tomcat"
    "Default"       "Webservice-Gateway"
    "Default"       "Webservice-Gateway"
     
     
 



Additional Information

NOTE: The “where” clause works but it appears only on names without the “-“ character. Any properties with “-“ embedded in the entry fail to return. Researching the fastbit error the following information on the ibis:whereParser will allow the query to run and return data with changes to the WHERE syntax:

./propstore-client.sh -d -s p_device,p_name,v_id,v_database -f /opt/APG/Databases/APG-Property-Store/Default/data/DB/1569513814165 -w "v_database IN ('APG\-DB') AND p_device LIKE 'x\-Esx%'"

This returns data from the property-store, for example:
"cloudiq-1.2.4-603.8.8" "Active"        14358   "APG-DB-usrsrm3-4"
"cloudiq-1.2.4-603.8.8" "Availability"  14282   "APG-DB-usrsrm3-4"
"cloudiq-1.2.4-603.8.8" "Availability"  14352   "APG-DB-usrsrm3-4"
"cloudiq-1.2.4-603.8.8" "Balloon"       14355   "APG-DB-usrsrm3-4"
"cloudiq-1.2.4-603.8.8" "Capacity"      14194   "APG-DB-usrsrm3-4"
"cloudiq-1.2.8-862.1.1 (1)"     "Consumed"      30052   "APG-DB-usrsrm3-2"
"cloudiq-1.2.8-862.1.1 (1)"     "CurrentUtilization"    29978   "APG-DB-usrsrm3-2"
"cloudiq-1.2.8-862.1.1 (1)"     "CurrentUtilization"    30051   "APG-DB-usrsrm3-2"
"cloudiq-1.2.8-862.1.1 (1)"     "FreeCapacity"  29981   "APG-DB-usrsrm3-2"
"cloudiq-1.2.8-862.1.1 (1)"     "FreeCapacity"  29984   "APG-DB-usrsrm3-2"