
UNSOLVED
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
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
Responses (45)
Solutions (0)
- 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);
}
}
}
}
}Reply - 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
JamesReply 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
JamesReply - 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 ?Reply - 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 ?Reply

Hemulll
2 Intern
•
138 Posts
1197
0
Posted September 16th, 2009 03:00
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);
}
}
}