Start a Conversation

Unsolved

This post is more than 5 years old

S

8437

September 16th, 2009 03:00

ASL script question

Hi,

I would like to make multiple queries for data using ASL and was wondering how I do this ASL.

Example:

I would like to extract all routers and then all cards associtaed with each of the routers.

Thanks in advance
James

138 Posts

September 16th, 2009 03:00

Hi James,

Example of asl script:

START {
.. eol
}
do {
foreach router (getInstances("Router")) {
routerObj = object(router);
print("Router : ".routerObj->Name);
cardObj = routerObj->getCards();
if (!cardObj->isNull()) {
print("Card : ".cardObj->Name);
}
}
}

138 Posts

September 16th, 2009 04:00

Sorry Boss, not tested.

Fixed Code:

START {
.. eol
}
do {
foreach router (getInstances("Router")) {
routerObj = object(router);
if (!routerObj->isNull()) {
print("Router : ".routerObj->Name);
cardList = list();
cardList = routerObj->getCards();
foreach card (cardList) {
cardObj = object(card);
if (!cardObj->isNull()) {
print("Card : ".cardObj->Name);
}
}
}
}
}

138 Posts

September 16th, 2009 04:00

Hi James,

Only a few points of happiness on this forum :-)
Do u have ICQ, Skype etc ... ???

20 Posts

September 16th, 2009 04:00

Hi Hemul,

Thanks, worked like a charm

How much do I owe you ;-)

James

20 Posts

September 16th, 2009 04:00

Hi Hemul

I get the floowing error

ASL-ERROR_OBJECT-Tried to perform a repository operation on a non-object

I think it is todo with some routers not haveing cards, but looking at the code you would think that the if statement should handle that.

Any ideas

Kind Regards
James

20 Posts

September 16th, 2009 05:00

Hi Hemul,

Only skype at home , not allow to use it at work

username is welljam

my email address is james.wells@zxxx.com

I have added a few more checks to the code.

####################################

START {
.. eol
}
do {
foreach router (getInstances("Router"))
{
routerObj = object(router);
if (!routerObj->isNull())
{
RouterStatus = (routerObj->IsUnmanagedOrUnresponsive);
if ( RouterStatus != FALSE )
{
print("Router : ".routerObj->Name." IsUnManaged : ".routerObj->IsUnmanagedOrUnresponsive);
}
cardList = list();
cardList = routerObj->getCards();
foreach card (cardList)
{
cardObj = object(card);
if (!cardObj->isNull())
{
Cardstatus = (cardObj->Status);
if ( Cardstatus != "OK" )
{
print("Card : ".cardObj->Name." Status : ".cardObj->Status);
}
}
}
}
}
stop();
}


####################################

I had another question, is it possible to go through a list like routers and switches and not just routers and I also used a stop(); in my code , is this nessasary ?

Kind Regards
James

138 Posts

September 16th, 2009 06:00

Hi James,

Sure, you should use ICIM_UnitaryCumputerSystem insted router class, for example:



foreach dev (getInstances(ICIM_UnitaryComputerSystem)) {
devObj = object(dev);
if (devObj->Type == Router || devObj->Type == Switch) {
print(devObj->Name);
}
}

Why do you need stop action ?

138 Posts

September 16th, 2009 06:00

Hi James,

Sure, you should use ICIM_UnitaryCumputerSystem insted router class, for example:


foreach dev (getInstances(ICIM_UnitaryComputerSystem)) {
          devObj = object(dev);
          if (devObj->Type == Router || devObj->Type == Switch) {
                         print(devObj->Name);
          }
}


Why do you need stop action ?

138 Posts

September 16th, 2009 07:00

Hi James, exactly so,
rapid writing always leads to the inevitable errors :-)

No time for debug

Message was edited by:
Hemul

20 Posts

September 16th, 2009 07:00

Hi,

The words Router and Switch for devObj->Type must be in uppercase it would seem as SMARTS ASL is case sensitive.

Kind Regards
James

20 Posts

September 16th, 2009 07:00

Hi Hemul

Not sure, why do you use a stop statement in ASL, is there a valid purpose, its just I have seen it used on the EMC support site in some examples.

Kind Regards
James

20 Posts

September 16th, 2009 08:00

Hi Hemul,

Thanks again for all your help, maybe one day I will be able to repay the favour.

Kind Regards
James

138 Posts

September 29th, 2009 08:00

U welcome, thanks for the Forum Point :-)

12 Posts

January 14th, 2010 03:00

Hi. I have similar problem, maybe do you know how to extract data from another instance. I running ASL script under Smarts Open Integration Server, and I want to extract some data from Availability and Performance Manager. In perl it's very simple, but I don't know how to create (open) session to this domain.

I try to look into ics-topology-sync.asl which synchronizes topology of the InCharge server with underlying Domains, but it's to hard :/

Thanks in advance

Tomasz

January 14th, 2010 08:00

Hi Tomasz,

what do you want to do exactly ? If you want to sync. some attributes from IP to OI, and you already have OI subscribing to IP, you can configure the DXA to do so. We need more details to figure out what is the solution which can answer your needs.

--Fred

== Monitor your Smarts environment using APG ReportPack for Smarts health ==
Frederic Meunier
Solutions Watch4Net Inc
APG & Smarts InCharge integration
http://www.watch4net.com

No Events found!

Top