Integrating Intersight Workload Optimizer and AppDynamics

11 March 2021
Post to LinkedIn Post to LinkedIn Post to Twitter | TL;DR

!!! please don't use this in production !!!
!!! Your IWO actions will be exposed publicly (unless you restrict them)!!!

It is possible to add a widget to your AppDynamics Dashboard that provides insight into Intersight Workload Optimizer.
This widget will show all actions for your Application sorted by Application Components, Virtual Machines, Storage, Servers and Databases.
It is also possible to zoom in on the actions or execute them straight from AppD.

$ Creating an AWS instance

The widget will need to be publicly available for the SaaS version of AppD to use it.
In this guide I will use an Amazon Linux EC2 instance to run the widget on.
You are welcome to create you instance with the GUI or you can follow the steps below to use the AWS CLI method.

Get the AMI ID of the latest Amazon Linux 2 Image

AWS_AMI_ID=$(aws ec2 describe-images \
--owners 'amazon' \
--filters 'Name=name,Values=amzn2-ami-hvm-2.0.????????-x86_64-gp2' 'Name=state,Values=available' \
--query 'sort_by(Images, &CreationDate)[-1].[ImageId]' \
--output 'text')

get your AWS default VPC ID

AWS_VPC_ID=$(aws ec2 describe-vpcs --output text --query 'Vpcs[0].VpcId')

Create a Security group in your VPC and open port 22 and 3000 to the world

AWS_SG_ID=$(aws ec2 create-security-group --vpc-id $AWS_VPC_ID --group-name 'iwo-widget-sg' --description 'Security group for our IWO widget for AppD' --out text)
aws ec2 authorize-security-group-ingress \
--group-id $AWS_SG_ID \
--ip-permissions '[{"IpProtocol": "tcp", "FromPort": 22, "ToPort": 22, "IpRanges": [{"CidrIp": "", "Description": "Allow SSH"}]}]' &&
aws ec2 authorize-security-group-ingress \
--group-id $AWS_SG_ID \
--ip-permissions '[{"IpProtocol": "tcp", "FromPort": 3000, "ToPort": 3000, "IpRanges": [{"CidrIp": "", "Description": "Allow HTTPS"}]}]'

!!! CAREFULL we are opening port 3000 to the whole world and anyone that knows the correct URL and your AppID can now access your widget and execute the actions !!! Do not use this in production !!!

now spin up a new ec2 instance

AWS_EC2_INSTANCE_ID=$(aws ec2 run-instances \
--image-id $AWS_AMI_ID \
--instance-type t2.micro \
--key-name boris-aws \
--monitoring "Enabled=false" \
--security-group-ids $AWS_SG_ID \
--query 'Instances[0].InstanceId' \
--output text)

tag your EC2 instance

aws ec2 create-tags --resources $AWS_EC2_INSTANCE_ID --tags "Key=Name,Value=iwo-widget"

get the public dns name of your new instance

AWS_EC2_INSTANCE_IP=$(aws ec2 describe-instances --instance-ids $AWS_EC2_INSTANCE_ID --out text --query 'Reservations[].Instances[].PublicDnsName')

check if your instance is running and output the public dns name for future reference

aws ec2 describe-instances --instance-ids $AWS_EC2_INSTANCE_ID --out text --query 'Reservations[].Instances[].[PublicDnsName, State.Name]'

connect to your instance

ssh ec2-user@$AWS_EC2_INSTANCE_IP -i <private aws key>


$ Installing the widget

Install the repo for nodejs

sudo curl -sL | sudo -E bash -

install nodejs and git

sudo yum install -y nodejs git

get the code from the git repository.
I had to fork the repo and do a little fix so that's why I'm not using the official repo, I submitted a pull request to have the fix pulled into the AppDynamics repo

git clone -b iwo

We need to provide the widget with a API key and private key to access Intersight yet, if you don't have one yet you can create one on this page
You can paste your API and Secret key into the files below like this, or you can edit the files with your preferred text editor.

cd CWOM-Action-Integration
mkdir keys
echo "<apikey>" > keys/iwo_public_key.txt 
echo "<private key>" > keys/iwo_private_key.pem

create certificates to use for our SSL webserver.
Make sure to use the public dns name as the server name.

openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout bin/key.pem -out bin/cert.pem
create a config.json file with the following content
    "iwo_config": {
	    "iwoServer": 		"",
	    "iwoAPIPath": 		"/wo/api/v3",
	    "iwoViewEntityURL": "/view/main/"

install the required nodejs packages

npm install

start the nodejs application

npm start


Get your business app ID from the Entity Information widget on the Overview page of your Business Application in IWO.

Access your dashboard on https://<aws vm ip>:3000/views/examples/cwom.html?businessAppID=<business app ID>
Add the iFrame to your AppD Dashboard