This is a little late but maybe still useful. Checking whether a device exists 
is relatively easy as long as you know the landscape it should be on, or you 
can just try each landscape until you find it. Discovering it is more difficult 
because you need to know which container to discover it to.  Here are the basic 
commands you will need. You will probably want to create a script. I use Perl 
but you can use bash if you prefer.

cd $SPECROOT/vnmsh/

# Connect to whatever landscape you want by landscape handle
./connect lh=0x400000

# Search for the IP address using the Network_Address attribute handle (0x12d7f)
./seek attr=0x12d7f,val=<ip_address>

# That will return a list of models including all interfaces on the server, 
which you probably don't want, so you can grep for the sysedge model if that's 
what you're using
./seek attr=0x12d7f,val=<ip_address>| grep -i Host_systemEDGE

# You can get only the model handle by using awk
./seek attr=0x12d7f,val= <ip_address>| grep -i Host_systemEDGE | awk '{print 
$1}'

# The above will give you the model handle if the IP address exists
if [ -z $(./seek attr=0x12d7f,val=<ip_address> | grep -i Host_systemEDGE | awk 
'{print $1}') ]; then
echo Not Found. Need to create the device.
fi

# Create a new sysedge host device by IP address (substitute the model type 
handle for something else if needed eg. 0x10290 for pingable, etc)
./create model mth=0x1160088 attr=0x112d7f,val=<ip_address>

# That command will return the model handle of the new device. You can append 
any other attributes to the create command in the format: 
attr=<attribute_handle>,val=<whatever_value_want>

# The create command will leave the new device in the lostfound container so 
you need to create a "Collects" association to move it into the container you 
want (you need to know the container handle for this)
create association rel=Collects lmh=<server_model_handle> 
rmh=<container_model_handle>

Hope that helps to get you started.

Craig Porter, Enterprise Systems Management - Availability & Performance 
Monitoring
Marsh & McLennan Companies
Global Technology Infrastructure (MGTI) | Centralized Operations
Sackville House 1.6, 143-149 Fenchurch Street, London EC3M 6BN, Great Britain
+44 (0)20 7178 4827 | Mobile +44 (0)7585 803 093 | 
[email protected]<mailto:[email protected]>
www.mmc.com<http://www.mmc.com/>

From: Amitay Ben-ishay [mailto:[email protected]]
Sent: 18 November 2015 17:15
To: spectrum
Subject: [spectrum] working with CLI

Hi all,
I'm not familiar with Spectrum CLI so I need you help.

I'de like to check if a device exist in spectrum
If not create it

Than to add the device to an existing GC

How should I do it using CLI?

Best Regards, Amitay.
__________________
Amitay Ben-Ishay
Senior Software Architecture & Product Manager

[cid:[email protected]]


Work:  +972-54-7814588
Mobile:+972-54-9909149
Fax:     +972-153-54-9909149
Email: [email protected]<mailto:[email protected]>
LinkedIN: Amitay's Profile<http://www.linkedin.com/in/amitay>


P please consider the environment before printing this email




------------------------------------------------------------
This message contains information that may be confidential or privileged.
If you are not the intended recipient, you may not use, copy or disclose
to anyone any of the information in this message. If you have received
this message and are not the intended recipient, kindly notify the sender
and delete this message from your computer.

 *   --To unsubscribe from spectrum, send email to 
[email protected]<mailto:[email protected]> with the body: unsubscribe spectrum 
[email protected]<mailto:[email protected]>

________________________________

The Insurance Act 2015 - Are you prepared? Check our website, uk.marsh.com, or 
ask your Marsh contact for further details.

Marsh Ltd. Registered in England and Wales Number: 1507274
Registered office 1 Tower Place West, Tower Place, London, EC3R 5BU.

Marsh Ltd is authorised and regulated by the Financial Conduct Authority.

This message and any attachments are confidential.
If you have received this message in error please delete it from your system.
If you require any assistance please notify the sender. Thank you.

---
To unsubscribe from spectrum, send email to [email protected] with the body: 
unsubscribe spectrum [email protected]

Reply via email to