ZTACS Limited http://ztacs.com Thu, 17 May 2018 10:13:09 +0000 en-US hourly 1 https://wordpress.org/?v=5.6 http://ztacs.com/wp-content/uploads/2018/03/cropped-ztacs_logo.fw_-32x32.png ZTACS Limited http://ztacs.com 32 32 How to set up multitenancy @ Appdynamics Controller http://ztacs.com/how-to-set-up-multitenancy-appdynamics-controller/ Thu, 17 May 2018 10:13:09 +0000 http://www.solutioning.eu/?p=1019 Setting up multitenancy in Appdynamics is relatively easy. This is basically a setting at the controller’s admin console not to be confused with the standard console. You can access your controller admin console at  http://hostname:8090/controller/admin.jsp

Once you are logged into the controller’s admin backend click on Controller Settings, then locate multitenant.controller setting and set it to true. Please note that once you set your controller to multitenant mode it can not be switched back anymore.

Click Account Settings to and click Add set up a new customer account. You have to specify the  account admin user, its password.

Also specify the number of licenses you want to use for this account and the account’s name.

Once the account is set up you can log off this console and try logging in to your Appdynamics admin panel by visiting https://hostname:8090.

You should see a new field on the login screen asking for the account name you would like use along with the user id and password. Specify your recently created account name, the account admin user and its password to log in.

You should see an empty console when you log in just like this one below.

If you would like to add agents to this newly created account you will have to use the new account name and its account access key ( can be found at the account setup in the controller admin console ) at installation time or just simply change these settings in the controller-info.xml if you already have agents on those servers. Using separate account name and account access key for each customer is how Appdynamics separates one account from an other.

]]>
Installing configuring the Appdynamics PHP Agent manually on Ubuntu 16.04.4 http://ztacs.com/installing-configuring-the-appdynamics-php-agent-manually-on-ubuntu-16-04-4/ Wed, 16 May 2018 15:46:22 +0000 http://www.solutioning.eu/?p=1004 The first step is to install the Appdynamics PHP Agent which will monitor the internals of PHP on this Ubuntu Server. We have downloaded the agent from https://downloads.appdynamics.com.

This agent has no pre-defined configuration file included so we need to do the installation and configuration manually. Upload the agent and unpack it into a desired location.

root@HUAPPD001-P1:/app/appdynamics/phpagent# bzip2 -d appdynamics-php-agent-x64-linux-4.4.3.1216.tar.bz2
root@HUAPPD001-P1:/app/appdynamics/phpagent# tar xvf appdynamics-php-agent-x64-linux-4.4.3.1216.tar
root@HUAPPD001-P1:/app/appdynamics/phpagent/appdynamics-php-agent-linux_x64# mv * /app/appdynamics/phpagent/
root@HUAPPD001-P1:/app/appdynamics/phpagent/appdynamics-php-agent-linux_x64# cd ..
root@HUAPPD001-P1:/app/appdynamics/phpagent# rm -rf appdynamics-php-agent-linux_x64
root@HUAPPD001-P1:/app/appdynamics/phpagent# ls -ltr
total 64
-rw-r--r-- 1 root root 2343 máj 5 02:50 Install.txt
drwxrwxr-x 9 root root 4096 máj 5 03:00 proxy
-rw-r--r-- 1 root root 5062 máj 5 03:00 phpcheck.sh
drwxrwxr-x 4 root root 4096 máj 5 03:00 php
drwxrwxrwx 2 root root 4096 máj 5 03:00 logs
-rw-rw-r-- 1 root root 35 máj 5 03:00 LICENSE.txt
-rwxrwxr-x 1 root root 30113 máj 5 03:00 install.sh
-rw-r--r-- 1 root root 305 máj 5 03:00 appdynamics_api_header.php

To install the application we will have to call the install.sh command. This command will perform the following:

  • Copy appdynamics_agent.so to the php extension library. This extension is called automatically anytime a php page is invoked.
  • Copy the appdynamics_agent.ini to the same directory where the php.ini resides
  • Configure the controller-info.xml file.
  • Creates the runProxy executable to start the agent.

The following parameters are mandatory – in this order – for the install.sh:

  • -a account-name@account-access-key which is your unique name and key assigned to you by appdynamics.
  • controller’s hostname  ( make sure host is resolvable and you can connect to the controller’s connection port.
  • controller’s port
  • Application’s name ( Appdynamics application you want the agent to report to )
  • Application tier ( The tier inside the application, it doesn’t have to be pre-created )
  • Application node ( The node belonging to the tier, it doesn’t have to be pre-created )

The full syntax looks like this:

./install.sh -a=account-name@account-access-key hostname-of-controller 8090 WordPress_Test_Environment WordPress_Server_Php wp-server

Install script for AppDynamics PHP Agent 4.4.3.0GA.5b071fef580bca60d0ed12ddb96d7be8864f342c
Found PHP installation in /usr/bin

Detected PHP Version:
 PHP 7.0.30-0ubuntu0.16.04.1 (cli) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
 with Zend OPcache v7.0.30-0ubuntu0.16.04.1, Copyright (c) 1999-2017, by Zend Technologies

PHP version id: 7.0
PHP extensions directory: /usr/lib/php/20151012
PHP ini directory: /etc/php/7.0/cli/conf.d
Controller Host: hostname
Controller Port: 8090
Application Name: WordPress_Test_Environment
Tier Name: WordPress_Server_Php
Node Name: wp-server
Account Name: account-name
Access Key: access-key
SSL Enabled: false
HTTP Proxy Host:
HTTP Proxy Port:
HTTP Proxy User:
HTTP Proxy Password File:

Writing '/app/appdynamics/phpagent/php/conf/appdynamics_agent_log4cxx.xml'
Writing '/etc/php/7.0/cli/conf.d/appdynamics_agent.ini'
Writing '/app/appdynamics/phpagent/proxy/conf/controller-info.xml'
rm -f "/usr/lib/php/20151012/appdynamics_agent.so"
ln -s "/app/appdynamics/phpagent/php/modules/appdynamics_agent_php_7.0.so" "/usr/lib/php/20151012/appdynamics_agent.so"
Writing '/app/appdynamics/phpagent/proxy/

As you can see above the installer found most of the settings automatically and installed the agent. In our case the location of the php.ini was incorrect so we manually locate the php.ini files by executing:

find / -name php.ini
/etc/php/7.0/apache2/php.ini
/etc/php/7.0/cli/php.ini

We found 2 php.ini‘s on our system, one of them is responsible for the settings for the client run php scripts and the other one  is responsible for the apache webserver run php processes. We want to monitor wordpress and mysql so we need to modify the apache one.

  • Open /etc/php/7.0/cli/conf.d/appdynamics_agent.ini
  • Copy all the settings in appdynamics_agent.ini to the end of the php.ini located in /etc/php/7.0/apache2/
  • Restart the apache2 server: service apache2 restart

Now we need to generate some traffic for the appdynamics controller. We have created a load plan with the Paessler Web Server Stress Tool and started loading the website heavily.

In a few minutes data starts flowing into the appdynamics application dashboard.

Transactions also show up in the other views.

Database calls are automatically detected and queries are displayed.

]]>
Installing Appdynamics Machine Agent on Ubuntu 16.04.4 http://ztacs.com/installing-appdynamics-machine-agent-on-ubuntu-16-04-4/ Wed, 16 May 2018 13:32:31 +0000 http://www.solutioning.eu/?p=990 Downloading and installing the Appdynamics Machine Agent

We have recently set up a test environment with a PHP/MySQL based test Ubuntu 16.04.4 server. We will now set up monitoring for Linux OS, PHP 7.0 and MySQL.

The first step is downloading the machine agent. Open your Appdynamics console and select the Getting Started Wizard.

Then click the Server button on the What do you want to monitor? screen.

At the next screen check if the connection details are correct then click the click here to download  button to acquire the Machine Agent.

Upload the downloaded zip file to your ubuntu server, unpack it to a desired location. This is where you want to run the machine agent from.

Check if the hostname of the appdynamics server is resolvable by simply pinging it, and also check if you can telnet into the port defined in the Configure the Controller step ( above ). The Machine Agent zip should contain the configuration files pre-configured with all the connection details, so in this case we do not have to do this manually. Run the machine agent as root using the following command:

[Your-agent-director]/bin/machine-agent &

root@HUAPPD001-P1:/app/appdynamics/machineagent/bin# ./machine-agent
Using java executable at /app/appdynamics/machineagent/jre/bin/java
Using Java Version [1.8.0_111] for Agent
Using Agent Version [Machine Agent v4.4.3.1214 GA Build Date 2018-04-28 05:12:10]
[INFO] Agent logging directory set to: [/app/appdynamics/machineagent]
Machine Agent Install Directory :/app/appdynamics/machineagent
Machine Agent Temp Directory :/app/appdynamics/machineagent/tmp
Tasks Root Directory :/app/appdynamics/machineagent/controlchannel
[INFO] Agent logging directory set to: [/app/appdynamics/machineagent]
Redirecting all logging statements to the configured logger
15:05:30.460 [system-thread-0] DEBUG com.appdynamics.common.framework.util.EmbeddedModeSecurityManager - Installed
15:05:30.490 [system-thread-0] INFO com.appdynamics.analytics.agent.AnalyticsAgent - Starting analytics agent with arguments [-p, /app/appdynamics/machineagent/monitors/analytics-agent/conf/analytics-agent.properties, -yr, analytics-agent.yml]
Started AppDynamics Machine Agent Successfully.

Once the agent is started it should automatically show up on the appdynamics console in the servers section.

Click on the machine’s name to open the detailed OS monitoring dashboard.

If you run into connection errors you can check and change the connection settings in the configuration file:

[Your-agent-director]/conf/controller-info.xml

Assign the machine agent automatically to an application and to its tiers and nodes

If you only want to use the machine agent on this server, you can hard wire the Application, Tier and Node details in the contoller-info.xml. Please note that if you use for example the PHP Agent on the same box this might stop the PHP Agent to connect to the controller.

There is no need to create the tiers and nodes manually they will be created on the dashboard automatically. We only added the WordPress_Test_Environment Application before the agent assignment. You will need to add the following to the controller-info.xml configuration file:

<force-agent-registration>true</force-agent-registration>
<application-name>WordPress_Test_Environment</application-name>
<tier-name>WordPress_Server</tier-name>
<node-name>huappd001-p1</node-name>

Change the name of the application, tier and node according to your specifications and restart the agent. Once the agent is restarted navigate into the application and verify if the machine agent has been added successfully.

]]>
Install and configure ODBC Drivers on Linux – SLES http://ztacs.com/install-and-configure-odbc-drivers-on-linux-sles/ Tue, 19 Dec 2017 11:06:10 +0000 http://www.solutioning.eu/?p=982 We ran into this issue that the proper MS SQL drivers for SLES/PHP are unavailable. There is no phpX-mssql package on the official development media to install, therefore we had to find an alternative solution to access and write data into an MS SQL database from our SLES server.

After some research we decided to set up ODBC on SLES to see if that is working. You need to follow the steps below to install and enable ODBC on your SLES Linux Server.

Install the odbc driver packages from the official SLES 11 Media using zypper.If you do not have a compiler installed also install gcc.

zypper install unixODBC unixODBC-devel gcc

Since there is no freetds package available on the installation media we need to compile that ourselves. Download the installation media from http://www.freetds.org/, upload it to your server and unpack it to a location of your choice. Run the following commands from the directory where you unpacked freedts.

./configure
 make
 make install

Now edit the tds configuration file called freetds.conf. Located in /usr/local/etc/ and add the following to the end of the file end of the file and modify the host, port and version number to your requirements.

[sql-server]
 host = 192.168.0.105
 port = 1433
 tds version = 7.0

Now test if you can connect to the database server. Make sure that the server listens on port 1433 and you have the relevant user id and password.

tsql -S sql-server -U sa -P ********
 locale is "LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=C;LC_COLLATE=C;LC_MONETARY=C;LC_MESSAGES=C;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;LC_IDENTIFICATION=C"
 locale charset is "UTF-8"
 using default charset "UTF-8"
 1>

If you do not see any error messages at this stage your connection is working. The next step is to modify the odbc configuration files. First we will do the drivers file. Edit the /etc/unixODBC/odbcinst.ini file by adding the following:

[sql-server]
Description = TDS Connection
Driver = /usr/local/lib/libtdsodbc.so
Setup = /usr/lib64/unixODBC/libtdsS.so
UsageCount = 1
FileUsage = 1

The libtdsodbc.so and libtdsS.so files might be on a different location on your installation check them before you add the lines.

The last step is to add the server information into the odbc.ini file which is located also in /etc/unixODBC directory. Add the following and modify the database name and port if required.

[DsPcDb]
Description = odbc test driver
Driver = sql-server
Servername = sql-server
Database = DsPcDb
UID = sa
Port = 1433

Now run isql to check if your configuration is correct. You have to use the name of the odbc connection after the isql command. In our case this was DsPcDb.

HUITM001-P1:/etc/unixODBC # isql DsPcDb sa *********
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL>

If you see the “Connected!” state your setup was successful.

]]>
Install PHP DB2 libraries on CentOS http://ztacs.com/install-php-db2-libraries-on-centos/ Fri, 17 Nov 2017 10:03:54 +0000 http://www.solutioning.eu/?p=977 We came across the requirement to manipulate DB2 using PHP scripts. In order to be able to do that you need to the DB2 libraries installed on your machine. First of all install DB2 Express ( desired version, we used 11.1 ). Make sure you are installing the development libraries with the product as you will need this when you compile the DB2 PHP libraries. Once the server is installed check out the content of the following directory /home/db2inst1/sqllib/include/ if you see a bunch of files in there you have the development pack installed and you are good to go. if you used a different instance name obviously check in there 🙂

The following command sequence will get the rest sorted, we assume you already have php installed on your machine.

  • yum install php-pear
  • yum install php-devel
  • yum install gcc
  • pecl install ibm_db2

The installer will ask where the DB2 directories are located,  just define the directory of your instance. Since we have db2inst1 as the instance the DB2 directory is located at /home/db2inst1/sqllib.

The installer will now compile the PHP libraries. Once it is done just add extension=ibm_db2.so into your php.ini file and you are good to go.

]]>
CTRA Server: no transports available, ffffffff. Server shutting down http://ztacs.com/ctra-server-no-transports-available-ffffffff-server-shutting-down/ Thu, 05 Oct 2017 06:22:55 +0000 http://www.solutioning.eu/?p=971 We run into the CTRA Server: no transports available, ffffffff Server shutting down issue recently on both our Windows and Linux servers. This might happen when the agent starts and the only communication protocol enabled is ip.spipe. The agent doesn’t connect in fact it shuts down after this error message like in this example:

(59D09A0D.0077-1:kraaumsg.cpp,107,"CTRA_msg_no_transports") CTRA Server: no transports available, ffffffff. Server shutting down
(59D09A0D.0078-1:kraafmn.cpp,787,"kglpsrvr") RegisterHandlers() returned error code: -1!
(59D09A0D.0079-1:kraafmn.cpp,788,"kglpsrvr") Ignoring server start-up request!
(59D09A0D.007A-1:kraaumsg.cpp,143,"CTRA_msg_server_exit_status") CTRA Server:  exit status, ffffffff
(59D09A0D.007B-B:signalmanager.cpp,524,"managerThread") Termination signal received.  Exiting...
(59D09A0D.007C-B:khdxprts.cpp,1760,"KHD_stopStatusMgr")  CTExporterStatus object is unavailable!
(59D09A0D.007D-B:kscqueue.cpp,200,"stop") Successfully stopped Audit worker thread
(59D09A0E.0000-C:kcacmdunx.cpp,273,"executeCmd") Shutdown -- before sleep.
(59D09A0E.0001-C:kcacmdunx.cpp,364,"executeCmd") Shutdown processing.
(59D09A0E.0002-C:kcacmdunx.cpp,264,"executeCmd") Shutdown -- before sleep.
(59D09A0E.0003-C:kcacmdunx.cpp,364,"executeCmd") Shutdown processing.

In both cases the solution is very simple.

Linux / Unix

The issue was due to the fact that our custom certificates expired, once the certificates were re-created, copied across and both the remote TEMS and the Linux OS agent restarted, the problem went away.

Windows

On windows the issue was a missing file after upgrading to Fixpack 7. Once the kdebe.dll file is copied from ITM\TMAITM6_x64 to ITM\GSK8_x64\lib64
the problem was solved.

]]>
Agent Builder Agent Workspaces and views are messed up after agent upgrade on TEP http://ztacs.com/agent-builder-agent-workspaces-and-views-are-messed-up-after-agent-upgrade-on-tep/ Fri, 15 Sep 2017 07:14:26 +0000 http://www.solutioning.eu/?p=961 This issue had us puzzled for weeks. The issue was that whenever we changed anything on one of our Agent Builder Agent even though the TEP support was correctly installed and the new support files downloaded by the TEP javaws client the views were still messed up, wrong order, incorrect titles, etc. The problem was still around after stopping the agent, clearing offline entry and starting the agent and getting it again into TEP. Just like this agent here:

We figured out that the issue is basically that the agent has to be cleared out from EVERY navigator view where it is present. For some reason it is not enough to clear the offline entry from the Physical view you have to delete them from all views. After the agent is gone from all views in question do the following:

Restart the agent from TEP.

Wait until the agent greys out on the console, then select Clear offline entry from the dropdown menu. The agent will now be gone from the Physical view.

Once the agent has been restarted, it pops back in to the TEP console but now with the correct views and workspaces. Now all you have to do is to assign the agent back to its navigator views.

We can summarize that the whole problem was because the agent was present in multiple navigator views…

]]>
How to remotely list Vmware VMs using python and turn off SSL certificate verification http://ztacs.com/how-to-remotely-list-vmware-vms-using-python-and-turn-off-ssl-certificate-verification/ Thu, 09 Mar 2017 12:33:34 +0000 http://www.solutioning.eu/?p=920 Since we are automating a number of things in our environment there was a need to list vms remotely using a script. We tried using PHP or the vmware vi perl toolkit but we couldn’t make any of them work.

The problem with that PHP script we tried to use was that the SSL certificate on the vcenter host doesn’t match the hostname and even though we tried everything it was impossible to turn the SSL certificate verification off. We tried to use this script:

https://gist.github.com/scr34m/3490246

The problem with the VI perl toolkit was that the toolkit is kind of old and requires libraries that are not available any longer. It also requires perl version 5.8 so we had to install an older perl version parallel with the current one. After a day spent trying to get it working we gave it up.

The last option was to use the  VMware vSphere API Python Bindings and the pyvmomi-community-samples.  We did the following:

Determine the python version:

Python 2.7.12 (default, Nov 19 2016, 06:48:10)
 [GCC 5.4.0 20160609] on linux2
 Type "help", "copyright", "credits" or "license" for more information.
 >>> import sys
 >>> print (sys.version)
 2.7.12 (default, Nov 19 2016, 06:48:10)
 [GCC 5.4.0 20160609]
 >>>

Since Python 2.7 doesn’t have PIP ( Pip Installs Packages ) installed by default we had to get that downloaded and installed first.

Download get-pip.py from here
python get-pip.py

This installs PIP. Now we need to download and install the vmware python extensions.

pip install pyvmomi

We also need to install git if it is not already installed

apt-get install git

Now install the community samples part. The libraries will be installed into the directory you issue this command from.

git clone https://github.com/vmware/pyvmomi-community-samples.git

Locate and run getallvms.py to list all vms from your vcenter. It is very important that you run this script from the community samples location otherwise it will fail with the following error:

root@zoltan-VirtualBox-kk:/app/images/IPM/python# python getallvms.py
 Traceback (most recent call last):
 File "getallvms.py", line 27, in <module>
 import tools.cli as cli
 ImportError: No module named cli

Run the command using the following syntax:

python getallvms.py -s [vcentername]  -u [vmwreuser] -p [vmwarepassword]

If your hostname doesn’t match the certificate you will be getting the error below. If it matches you should be seeing the list of vms now.

Traceback (most recent call last):
 File "getallvms.py", line 104, in <module>
 main()
 File "getallvms.py", line 78, in main
 port=int(args.port),
 File "build/bdist.linux-x86_64/egg/pyVim/connect.py", line 836, in SmartConnect
 File "build/bdist.linux-x86_64/egg/pyVim/connect.py", line 718, in __FindSupportedVersion
 File "build/bdist.linux-x86_64/egg/pyVim/connect.py", line 638, in __GetServiceVersionDescription
 File "build/bdist.linux-x86_64/egg/pyVim/connect.py", line 604, in __GetElementTree
 File "/usr/lib/python2.7/httplib.py", line 1057, in request
 self._send_request(method, url, body, headers)
 File "/usr/lib/python2.7/httplib.py", line 1097, in _send_request
 self.endheaders(body)
 File "/usr/lib/python2.7/httplib.py", line 1053, in endheaders
 self._send_output(message_body)
 File "/usr/lib/python2.7/httplib.py", line 897, in _send_output
 self.send(msg)
 File "/usr/lib/python2.7/httplib.py", line 859, in send
 self.connect()
 File "/usr/lib/python2.7/httplib.py", line 1278, in connect
 server_hostname=server_hostname)
 File "/usr/lib/python2.7/ssl.py", line 353, in wrap_socket
 _context=self)
 File "/usr/lib/python2.7/ssl.py", line 601, in __init__
 self.do_handshake()
 File "/usr/lib/python2.7/ssl.py", line 830, in do_handshake
 self._sslobj.do_handshake()
 ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)

There is no way to switch certificate verification off using a command line parameter so the code has to be changed from:

#!/usr/bin/env python
# VMware vSphere Python SDK
# Copyright (c) 2008-2013 VMware, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""
Python program for listing the vms on an ESX / vCenter host
"""

import atexit

from pyVim import connect
from pyVmomi import vmodl
from pyVmomi import vim

import tools.cli as cli


def print_vm_info(virtual_machine):
    """
    Print information for a particular virtual machine or recurse into a
    folder with depth protection
    """
    summary = virtual_machine.summary
    print("Name       : ", summary.config.name)
    print("Template   : ", summary.config.template)
    print("Path       : ", summary.config.vmPathName)
    print("Guest      : ", summary.config.guestFullName)
    print("Instance UUID : ", summary.config.instanceUuid)
    print("Bios UUID     : ", summary.config.uuid)
    annotation = summary.config.annotation
    if annotation:
        print("Annotation : ", annotation)
    print("State      : ", summary.runtime.powerState)
    if summary.guest is not None:
        ip_address = summary.guest.ipAddress
        tools_version = summary.guest.toolsStatus
        if tools_version is not None:
            print("VMware-tools: ", tools_version)
        else:
            print("Vmware-tools: None")
        if ip_address:
            print("IP         : ", ip_address)
        else:
            print("IP         : None")
    if summary.runtime.question is not None:
        print("Question  : ", summary.runtime.question.text)
    print("")


def main():
    """
    Simple command-line program for listing the virtual machines on a system.
    """

    args = cli.get_args()

    try:
        service_instance = connect.SmartConnect(host=args.host,
                                                user=args.user,
                                                pwd=args.password,
                                                port=int(args.port))

        atexit.register(connect.Disconnect, service_instance)

        content = service_instance.RetrieveContent()

        container = content.rootFolder  # starting point to look into
        viewType = [vim.VirtualMachine]  # object types to look for
        recursive = True  # whether we should look into it recursively
        containerView = content.viewManager.CreateContainerView(
            container, viewType, recursive)

        children = containerView.view
        for child in children:
            print_vm_info(child)

    except vmodl.MethodFault as error:
        print("Caught vmodl fault : " + error.msg)
        return -1

    return 0

# Start program
if __name__ == "__main__":
    main()

…to the code below. Changes are highlighted with bold ( might not be easy to see at first )

#!/usr/bin/env python
# VMware vSphere Python SDK
# Copyright (c) 2008-2013 VMware, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""
Python program for listing the vms on an ESX / vCenter host
"""

import atexit
import ssl

from pyVim import connect
from pyVmomi import vmodl
from pyVmomi import vim

import tools.cli as cli


def print_vm_info(virtual_machine):
    """
    Print information for a particular virtual machine or recurse into a
    folder with depth protection
    """
    summary = virtual_machine.summary
    print("Name       : ", summary.config.name)
    print("Template   : ", summary.config.template)
    print("Path       : ", summary.config.vmPathName)
    print("Guest      : ", summary.config.guestFullName)
    print("Instance UUID : ", summary.config.instanceUuid)
    print("Bios UUID     : ", summary.config.uuid)
    annotation = summary.config.annotation
    if annotation:
        print("Annotation : ", annotation)
    print("State      : ", summary.runtime.powerState)
    if summary.guest is not None:
        ip_address = summary.guest.ipAddress
        tools_version = summary.guest.toolsStatus
        if tools_version is not None:
            print("VMware-tools: ", tools_version)
        else:
            print("Vmware-tools: None")
        if ip_address:
            print("IP         : ", ip_address)
        else:
            print("IP         : None")
    if summary.runtime.question is not None:
        print("Question  : ", summary.runtime.question.text)
    print("")


def main():
    """
    Simple command-line program for listing the virtual machines on a system.
    """

    args = cli.get_args()

    try:

        context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
        context.verify_mode = ssl.CERT_NONE

        service_instance = connect.SmartConnect(host=args.host,
                                                user=args.user,
                                                pwd=args.password,
                                                port=int(args.port),
                                                sslContext=context
)

        atexit.register(connect.Disconnect, service_instance)

        content = service_instance.RetrieveContent()

        container = content.rootFolder  # starting point to look into
        viewType = [vim.VirtualMachine]  # object types to look for
        recursive = True  # whether we should look into it recursively
        containerView = content.viewManager.CreateContainerView(
            container, viewType, recursive)

        children = containerView.view
        for child in children:
            print_vm_info(child)

    except vmodl.MethodFault as error:
        print("Caught vmodl fault : " + error.msg)
        return -1

    return 0

# Start program
if __name__ == "__main__":
    main()

This solution was based on code displayed in this discussion:

https://github.com/vmware/pyvmomi/issues/235

]]>
Installing and Configuring the Netcool Omnibus SCOM 2007 Probe http://ztacs.com/installing-and-configuring-the-netcool-omnibus-scom-2007-probe/ Mon, 15 Feb 2016 10:08:33 +0000 http://www.solutioning.eu/?p=873 In this article we will install and configure the Netcool Omnibus SCOM 2007 Probe. The probe will be installed on a separate machine and will contact the SCOM server across the network.

The following steps will be performed to achieve the integration:

  • Install probe support
  • Install the SCOM probe
  • Configure the SCOM probe to communicate with the probe server and connect to the Omnibus server
  • Configure SCOM to work with the probe

We used Netcool Omnibus version 7.4 and Windows 2008 R2 for the operating systems.

Install probe support

Start the installation by executing the install.exe coming with the Netcool Ombibus Server installation image.

netcool-install-splashClick OK to continue the installation.

pre-installAccept the license agreement then click Next to start the configuration of the Autonomic Deployment Engine.

autonomicnextSelect Do not change at the Deployment Engine Access Permission windows and click Next to continue the installation.

select-destination-folderSelect the Destination Folder and click Next to continue. We used the default folder offered.

choose-install-setSelect Custom at the Install Set selection and click Next.

select-probe-support-onlySelect Probe Support only and continue the installation by clicking the Next button.

click-install-probe-supportClick Install to kick off the installation procedure.

restart-windows-probe-supportReboot your windows system to finalize the installation.

Install the SCOM probe

Unpack the probe zip file into a directory of your choice.

start-installation-probeStart the nco_install_integration.vbs located in C:\IBM\Tivoli\Netcool\omnibus\install if you used the default omnibus installation folder.

netcool-install-splashClick OK to continue the installation.

select-probe-to-installLocate the directory where you unpacked the probe file. You need to specify the directory that contains the COI directory then click Next.

install-probeAccept the License Agreement at the next screen then click Install to start the installation of the SCOM probe.

install-complete-probeThe installation of the SCOM probe is now complete.

Configure the SCOM probe to communicate with the probe server and connect to the Omnibus server

As a first step you need to specify your omnibus servers in the server editor.

start-server-editor-omnibus

You can start the server editor by going to the Start Menu -> Netcool Suite -> System Utilities -> Servers Editor

netcool-configure-objectservers

Add your object servers on the list in the server editor, you can delete whatever you find there by default as it is irrelevant for the current setup.

SDK-locationThe next step is to move the SCOM SDK files from the SCOM Server to the probe machine. You will need to have the copy the following files in the following directories:

  • C:\Program Files\System Center Operations Manager 2007\SDK Binaries\BinariesMicrosoft.EnterpriseManagement.OperationsManager.dll
  • C:\Program Files\System Center Operations Manager 2007\SDK Binaries\Microsoft.EnterpriseManagement.OperationsManager.Common.dll

The following task is to modify the probe’s configuration file.The probe files are located in C:\IBM\Tivoli\Netcool\omnibus\probes\win32 directory if you used the default installation folder. Modify the scom2007r2.props file by adding the following:

Server                        :       “AGG_P”
ServerBackup                  :       “AGG_B”
ConnectorName                    :       “Netcool probe”
ConnectorUser                    :       “youruser”
ConnectorPassword                :       “yourpassword”
ConnectorDomain                :       “yourdomain”
ScomHost                        :       “your_scom_hostname_or_ip”

probe-startedNow you should start the probe with the following command: C:\IBM\Tivoli\Netcool\omnibus\probes\win32\nco_p_scom2007_r2.exe If the probe stays running that means it has successfully connected to both the Object server and the SCOM 2007 Server.

Configure SCOM to work with the probe

netcool-connectorOnce the probe connects to the SCOM server successfully it will create the Netcool Probe product connector.

scom-groupsWe set up a group called netcool and assigned 2 Windows 2008 servers to it.

subsriptionsIf you need to filter on what nodes or events should hit the Probe, you can do so by setting up a groups and assigning them to the Netcool probe connector. Click on the Add button.

add-netcool-test-groupAssign a name to the Subscription then click Next.

approve-groups-scomSelect “netcool” from the groups list then click Next.

approve-targetsLeave the default option at the approve targets screen and click Next.

select-criteria-scomSelect the desired items you would like to have alerts raised for and click Create.

netcool-connectedThe subscription is now created and the events should start flowing across to Omnibus.

SCOM-events

]]>
Integrating Omnibus and PRTG using SNMP probe http://ztacs.com/integrating-omnibus-and-prtg-using-snmp-probe/ Mon, 19 Oct 2015 12:03:00 +0000 http://www.solutioning.eu/?p=840 This guide contains instructions for configuring PRTG Network Monitor software to send SNMP traps to a Omnibus.

Prerequisites:

  • working Omnibus instance
  • SNMP probe (mttrapd) installed and configured

More info on installing and configuring mttrapd.

First step is importing the MIB file.

PRTG Network monitor comes with a MIB file called PRTG-MIB.mib this file you can find in PRTG installation directory. Open mib manager utility to do the import.

/app/IBM/tivoli/netcool/omnibus/bin/nco_mibmanager

PRTG-MIB.mib is depending on SNMPv2-SMI , RFC-1215 and SNMPv2-TC  MIB files, so make sure they are accessible. (all of them are in the default MIB set of Omnibus)

As we see , the trap OID is 0.10  (1.3.6.1.4.1.32446.0.10) , and other attributes can be defined with OIDs 1.1, 1.2, 1.3, and 1.4.

SNMP traps sent by PRTG always use SNMP V1 format. The following OIDs will be included in the trap:

1.3.6.1.4.1.32446.1.1.1: MessageID (as defined by the user in the Field “Message ID”)
1.3.6.1.4.1.32446.1.1.2: An integer representing the event that triggered the notification:
0 = State ended
1 = State started
2 = Volume reached
3 = Speed not reached
4 = Speed reached
5 = Threshold not reached
6 = Threshold reached
7 = Value changed
1.3.6.1.4.1.32446.1.1.3: The state of the object:
0 = None
1 = Unknown
2 = Collecting Data
3 = Up
4 = Warning
5 = Down
6 = No Probe
7 = Paused by User
8 = Paused by Dependency
9 = Paused by Schedule
10 = Unusual
11 = Paused by License
12 = Paused until
13 = Down (Acknowledged)
14 = Down (Partial)
1.3.6.1.4.1.32446.1.1.4: The message text of the notification as defined by the user.

Select the top level enterprise OID from OID browser, click export rules file. Select location for the rules file, and choose rules file type.

Select standalone if you use this SNMP source only, or Netcool knowledge library to export master rules and include rules for more kind of sources.

Now open PRTG Enterprise Console, and navigate to Setup -> Notifications  and create a new notification type clicking “add new notification” button.

Select “Send SNMP Trap” option, and enter connection info:

  • SNMP probe hostname or IP address
  • Port
  • Community string
  • Specific Trap Code  (10)
  • Message ID (used for filtering)
  • Message (configurable using PRTG specific parameters. See PRTG Help for info )

Save the notification and test it clicking “Test” button next to Notification you just created.

Now (if you’re lucky) an event pops up on Omnibus console.

This event is not formatted, ( fe.: Summary field is empty ) so you have to create mappings between PRTG Trap OID values and Omnibus fields. You can do it by editing the rules file you generated before.

Locate the following section :

And edit the Omnibus fields ( @Agent, @Summary, etc. ) enter the information what you want to present on your console. The values of the four OIDs sent with the trap are

  • 1.1 = $paesslerPrtgTrapID
  • 1.2 = $paesslerPrtgTrapEvent
  • 1.3 = $paesslerPrtgTrapSensorstate
  • 1.4 = $paesslerPrtgTrapMessage

In our example Summary field will contain the value of paesslerPrtgTrapMessage OID, but you can customize other fields as well.

Modifications Required on Omnibus Server

Extend the size of the Summary filed in the Alerts table from 255 to at least 1024 as PRTG sends long problem descriptions and it won’t fit into the 255 character default.

modsummaryIn order to make it work with the SNMP probe modify the probe’s def file located in /opt/IBM/tivoli/netcool/omnibus/var/

Replace the value from 255 to 1024:

Identifier 2 255 1
Serial 0 4 0
Node 2 64 0
NodeAlias 2 64 0
Manager 2 64 0
Agent 2 64 0
AlertGroup 2 255 0
AlertKey 2 255 0
Severity 0 4 0
Summary 2 1024 0
StateChange 1 4 0
FirstOccurrence 1 4 0
LastOccurrence 1 4 0
InternalLast 1 4 0
Poll 0 4 0

Restart the probe.

And the final result :

prtgsummary

 

]]>