This post is more than 5 years old
20 Posts
0
890
March 3rd, 2015 05:00
APG Web Service question with DatabaseAccessor
Hello,
We are trying to use the web service with the DatabaseAccessor, we have started our test with the getDistinctPropertyRecords function and it works well.
SOAP request for retrieving the part & partwwn for the Ports SAN switch works with following code:
devtype=='FabricSwitch' & parttype=='Port'
part
parwwn
Now we would like to retrieve values from the database in our case the ifInOctets from the ports, so we are trying with the getAggregatedData function. But it does not work, it produces a error "An error occurred when accessing the Database APG-DB". Here is the SOAP code we are using:
devtype=='FabricSwitch' & parttype=='Port' & name=='ifInOctets'
1423388730
1425388730
3600
Could someone help us to understand how we have to provide the data because the info from APG-Web-Service-Tutorial.pdf simply provide the syntax but does provide useful example.
Thanks & regards,
Jean-Michel
Flo_csI
2 Intern
•
166 Posts
0
March 5th, 2015 14:00
Hi Guillaume,
You are on a good path. But your start & end timestamp are too close (ie 0 second) therefore there will be no data for that timeframe.
fyi, there is an open-source contrib to query the Web-Service from a command line. It is available here : https://github.com/emcvipr/mnrcli
It runs with ruby therefore you need to :
* install ruby 2.0 or higher (works on Windows, Linux & OSX)
* install bundle via : gem install bundle
* download the code on github
* run command : bundle
* then execute : ruby mnrcli.rb -h -l
With the -l option you will have a debug of the executed queries.
To achieve what you want to do ; execute the script then run the command in red in the cli :
[4] (Cli)> "devtype=='FabricSwitch' & parttype=='Port' & name='ifInOctets'".get(:device, :part, :partwwn, :last_rv).table
---------------------------------+------------------+--------------+----------------------------------+----------
id | partwwn | part | device | value
---------------------------------+------------------+--------------+----------------------------------+----------
APG-DB:DB-lglbw242-2-group-5169 | 2EBB0027F8E4E698 | 8/27 | DCX8510_Chassis-10000027F8E4E797 |
APG-DB:DB-lglbw242-2-group-8676 | 202000051E436C01 | 3/0 | DCX1_losas247-100000051E436CFF |
APG-DB:DB-lglbw242-2-group-38231 | 200F00051E436C00 | 1/15 | DCX1_losas247-100000051E436CFF |
APG-DB:DB-lglbw242-4-group-3912 | 20230027F868EA53 | 35 | DS_6520B-10000027F868EA92 |
APG-DB:DB3-group-43326 | 2EB5000533E94F00 | 8/21 | ED_DCX8510_8B-1000000533E94FFF |
APG-DB:DB3-group-35703 | 20A8000533E94F02 | 3/24 | ED_DCX8510_8B-1000000533E94FFF |
APG-DB:DB-lglbw242-3-group-610 | 2EB100051E439800 | 8/17 | DCX2_losas250-100000051E4398FF |
APG-DB:DB-lglbw242-2-group-7353 | 2E970027F8E4E698 | 5/23 | DCX8510_Chassis-10000027F8E4E797 |
APG-DB:DB3-group-41142 | 200600051E345472 | 6 | SilkWorm 4100-100000051E345472 |
APG-DB:DB3-group-33519 | 2E
APG-DB:DB2-group-19696 | 201E00051E345472 | 30 | lglad200 | 43.3311
APG-DB:DB-lglbw242-2-group-1536 | 20D500051E436C02 | 10/21 | DCX1_losas247-100000051E436CFF |
APG-DB:DB2-group-19695 | 201D00051E345472 | 29 | lglad200 | 41.6
APG-DB:DB2-group-19697 | 201F00051E345472 | 31 | lglad200 | 23.9213
APG-DB:DB2-group-19692 | 201A00051E345472 | 26 | lglad200 | 0.0
APG-DB:DB2-group-19691 | 201900051E345472 | 25 | lglad200 | 0.0
APG-DB:DB3-group-37383 | 5000533E94FF7341 | 9/49 | ED_DCX8510_8B-1000000533E94FFF |
APG-DB:DB2-group-19694 | 201C00051E345472 | 28 | lglad200 | 43.1738
APG-DB:DB2-group-19693 | 201B00051E345472 | 27 | lglad200 | 0.0
APG-DB:DB3-group-35199 | 20290027F84A8E5B | 41 | DS_6520B-10000027F84A8E9A |
APG-DB:DB3-group-41877 | 2EB6000533E94F00 | 8/22 | ED_DCX8510_8B-1000000533E94FFF |
APG-DB:DB3-group-38223 | 206C000533E94F03 | 11/12 | ED_DCX8510_8B-1000000533E94FFF |
APG-DB:DB2-group-19689 | 201700051E345472 | 23 | lglad200 | 0.0
APG-DB:DB2-group-19688 | 201600051E345472 | 22 | lglad200 | 0.0
APG-DB:DB-lglbw242-4-group-3030 | 202F0027F868EA53 | 47 | DS_6520B-10000027F868EA92 |
APG-DB:DB-lglbw242-2-group-8172 | 2EB40027F8E4E698 | 8/20 | DCX8510_Chassis-10000027F8E4E797 |
APG-DB:DB-lglbw242-1-group-32092 | 200E00051E07B58F | 14 | Brocade300-100000051E07B59E |
---------------------------------+------------------+--------------+----------------------------------+----------
That CLI is simple and doesn't support everything you might need (like customize the timeframe, get aggregates, etc.).
If you want more features & keywords feel free to open an issue to the github project.
Enjoy your journey with the Web-Service API ; and let us know if you do anything cool ;-)