3.7 Migrating an Agent to a New QDB

If you installed a new QDB and want to maintain existing agents for that QDB, you must migrate the agents to the new QDB. You can migrate version 7.0.4 and version 8.x agents to new QDBs. AppManager 9.2 includes a command line tool, MigrateQ.exe, that automates the migration process and allows you to migrate multiple agents simultaneously, if needed. The tool migrates the following agent attributes to the new QDB:

  • Security Manager settings

  • Custom properties

  • Running discovery jobs

  • Running ad hoc jobs

  • Running jobs that a custom Knowledge Script started

In addition, the tool sets the primary management server for the agent in the new QDB and performs the following clean-up activities in the source QDB following a successful migration:

  • Stops all running jobs for the agent

  • Optionally, deletes the agent

    NOTE:The option to leave the source agent in the source QDB is not available when migrating a UNIX agent. You must delete the agent from the source QDB.

The tool does not migrate data and events to the new QDB.

The tool will not perform a migration in the following situations:

  • The agent is offline.

  • The agent is in maintenance mode.

  • The agent is already present in the destination QDB.

  • The destination QDB is an earlier version than the source QDB.

  • You are using Authentication and encrypted communications, and the source QDB and the destination QDB have different encryption keys. The encryption keys must be identical for successful migration.

The MigrateAgents.vbs script that is included with MigrateQ.exe allows you to select multiple agents for migration based on server or management group membership or a custom property. Server groups must be part of the Master management group.

For example, you could create a management group called Migration and use the script to select all of the agents in the management group for migration, or you could define a custom property called Migrate and use the script to select all of the agent computers with the Migrate custom property defined.

To migrate an individual agent to a new QDB:

  1. Ensure that the agent meets the version requirements for migration.

  2. Ensure that the computer from which you will run the tool meets the following requirements:

    • The computer is running Microsoft .NET Framework 3.5 Service Pack 1

    • The computer can connect to both the source QDB and the destination QDB.

    • The computer has a version 8.x or 9.x Windows agent installed. Even if you are migrating a version 7.0.4 agent, the computer from which you run the migration tool must meet this requirement.

    • If you are migrating a UNIX agent, the computer can connect to the UNIX agent computer through Secure Shell (SSH).

  3. (Conditional) If necessary, from the computer where you saved the AppManager 9.2 installation files, copy the contents of the Agent Migration folder to the computer where you will run the tool.

  4. Open a command prompt and change directory to the location of the Agent Migration folder.

  5. (Conditional) If you are migrating a Windows agent, type the following command, and then press Enter:

    MigrateQ -agent:agent_display_name -source:QDB_computer_name#QDB_name -dest:QDB_computer_name#QDB_name -MS:primary_management_server_name[,secondary_management_server_name] -sauth:{0|1}#[user_name$password] -dauth:{0|1}#[user_name$password] -delete:{0|1} -suffix:suffix

    Sample commands are included at the end of this section.

  6. (Conditional) If you are migrating a UNIX agent, type the following command, and then press Enter:

    MigrateQ -agent:agent_display_name -source:QDB_computer_name#QDB_name -dest:QDB_computer_name#QDB_name -MS:primary_management_server_name[,secondary_management_server_name] -sauth:{0|1}#[user_name$password] -dauth:{0|1}#[user_name$password] -delete:1 -uxuser:user_name -uxpassword:password -port:ssh_port_number

    Sample commands are included at the end of this section.

The command parameters are as follows:

Parameter

Description

agent

Name of the agent you want to migrate, as displayed in the AppManager consoles

To specify multiple agents, use a comma to separate the names of the agents.

source

Name of the computer where the source QDB is installed and the name of the QDB, separated by #

dest

Name of the computer where the destination QDB is installed and the name of the QDB, separated by #

MS

Name of the primary management server for the agent, to be set in the destination QDB

Optionally, you can specify a secondary management server for the agent. Use a comma to separate the primary and secondary management servers. For example, -MS:MyPrimaryMS,MySecondaryMS.

sauth

Whether the source QDB uses Windows or SQL Server authentication

For Windows authentication, specify 0. You do not need to provide credentials for Windows authentication.

For SQL Server authentication, specify 1 and provide the credentials. For example, -sauth:1#sa$Control123.

dauth

Whether the destination QDB uses Windows or SQL Server authentication

For Windows authentication, specify 0. You do not need to provide credentials for Windows authentication.

For SQL Server authentication, specify 1 and provide the credentials. For example, -sauth:1#sa$Control123.

delete

Whether to delete the agent from the source QDB after successful migration

To delete the agent, specify 1.

To keep the agent, specify 0.

NOTE:0 is not available when migrating UNIX agents. You must specify 1 when migrating UNIX agents.

uxuser

User name for connecting to the remote UNIX agent

Ensure that the user has sudo access.

uxpassword

Password for connecting to the remote UNIX agent

port

If the SSH server is not using port 22, SSH port number to use to connect to the remote UNIX agent

suffix

provide the suffix to be added with the current agent name.

Following are sample commands:

For this situation...

Use this command...

The source and destination QDBs use SQL Server authentication and you do not want to delete the agent from the source QDB

NOTE:If you are migrating a UNIX agent, you must delete the agent from the source QDB.

MigrateQ -agent:MyAgent -source:MySourceQDB#QDB_1 -dest:MyDestQDB\MyDestInstance#QDB_2 -MS:MyManagementServer –sauth:1#sa$Control123 –dauth:1#sa$Control123 –delete:0

The source QDB uses SQL Server authentication, the destination QDB uses Windows authentication, and you want to delete the agent from the source QDB

MigrateQ -agent:MyAgent -source:MySourceQDB#QDB_1 -dest:MyDestQDB\MyDestInstance#QDB_2 -MS:MyManagementServer –sauth:1#sa$Control123 –dauth:0 –delete:1

The source and destination QDBs use Windows authentication and you want to delete the agent from the source QDB

MigrateQ -agent:MyAgent -source:MySourceQDB#QDB_1 -dest:MyDestQDB\MyDestInstance#QDB_2 -MS:MyManagementServerPrimary,MyManagementServerSecondary –sauth:0 –dauth:0 –delete:1

You want to migrate multiple agents in one session

MigrateQ -agent:MyAgent1,MyAgent2,MyAgent3 -source:MySourceQDB#QDB_1 -dest:MyDestQDB\MyDestInstance#QDB_2 -MS:MyManagementServer –sauth:0 –dauth:0 –delete:1

The value for a parameter contains special characters (enclose the parameter in quotes)

MigrateQ -agent:MyAgent "-source:MySourceQDB#QDB123&%" -dest:MyDestQDB\MyDestInstance#QDB_2 -MS:MyManagementServer -sauth:1#sa$Control123 -dauth:1#sa$Control123 -delete:0

You are migrating a UNIX agent

MigrateQ -agent:MyAgent -source:MySourceQDB#QDB_1 -dest:MyDestQDB\MyDestInstance#QDB_2 -MS:MyManagementServerPrimary,MyManagementServerSecondary -sauth:1#sa$Control123 -dauth:1#sa$Control123 -delete:1 -uxuser:sudouser -uxpassword:mypasswd -port:1234

You want to migrate an agent with a suffix name

MigrateQ -agent:MyAgent -source:MySourceQDB#QDB_1-dest:MyDestQDB\MyDestInstance#QDB_2 -MS:MyManagementServer –sauth:1#sa$Control123 –dauth:0 –delete:1 -suffix:dom.lab

To select multiple agents for migration:

  1. Ensure that the agents meet the version requirements for migration.

  2. Ensure that the computer from which you will run the tool meets the following requirements:

    • The computer is running Microsoft .NET Framework 3.5 Service Pack 1.

    • The computer can connect to both the source QDB and the destination QDB.

    • The computer has a version 8.x or 9.x Windows agent installed. Even if you are migrating a version 7.0.4 agent, the computer from which you run the migration tool must meet this requirement.

    • If you are migrating a UNIX agent, the computer can connect to the UNIX agent computer through Secure Shell (SSH).

  3. Ensure that you are using the cscript scripting host to run the script. From a command prompt, either:

    • Set cscript as the default. For example, c:\> cscript /h:cscript.

    • Explicitly run the script with cscript. For example, c:\> cscript MigrateAgents.vbs.

  4. Ensure that MigrateQ.exe is in the same folder as MigrateAgents.vbs.

  5. From a command prompt, change directory to the folder that contains MigrateAgents.vbs.

  6. (Conditional) To select multiple Windows agents, type the following command, and then press Enter:

    c:\> cscript MigrateAgents.vbs /s_server:"Source_SQL_Server\SQL_Server_Instance" /s_db:"Source_QDB_Name" /s_uid:"Source_SQL_Server_Username" /s_pwd:"Source_SQL_Server_Password" /d_server:"Destination_SQL_Server\SQL_Server_Instance" d_db:"Destination_QDB_Name" /d_uid:"Destination_SQL_Server_Username" /d_pwd:"Destination_SQL_Server_Password" /ms:"Management_Server_For_Agent" /delete:"0|1" /sg:"Server_Group_Name" /mgname:"Management_Group_Name" /cp_name:"Custom_Property_Name" /cp_val:"Custom_Property_Value"

    Parameter descriptions are provided at the end of this section.

    The script creates a batch file, RunMigration.bat, in the current directory.

  7. (Conditional) To select multiple UNIX agents, type the following command, and then press Enter:

    c:\> cscript MigrateAgents.vbs /s_server:"Source_SQL_Server\SQL_Server_Instance" /s_db:"Source_QDB_Name" /s_uid:"Source_SQL_Server_Username" /s_pwd:"Source_SQL_Server_Password" /uxuser:"UNIX_User_Name" /uxpassword:"UNIX_Password" /port:"Port_Number" /d_server:"Destination_SQL_Server\SQL_Server_Instance" d_db:"Destination_QDB_Name" /d_uid:"Destination_SQL_Server_Username" /d_pwd:"Destination_SQL_Server_Password" /ms:"Management_Server_For_Agent" /delete:"0|1" /sg:"Server_Group_Name" /mgname:"Management_Group_Name" /cp_name:"Custom_Property_Name" /cp_val:"Custom_Property_Value"

    Parameter descriptions are provided at the end of this section.

    The script creates a batch file, RunMigration.bat, in the current directory.

  8. Run the batch file, RunMigration.bat, to migrate the agents.

The command parameters are as follows:

Parameter

Description

/s_server:

Name of the SQL Server that hosts the QDB from which you want to migrate agents. If the SQL Server is on the computer where you are running the script, this parameter is not required.

/s_db:

Name of the QDB from which you want to migrate agents. If you do not specify this parameter, QDB is used.

/s_uid:

If the source SQL Server uses SQL authentication, the user name for connecting to the source SQL Server. This parameter is not required if the source SQL Server uses Windows authentication.

/s_pwd:

If the source SQL Server uses SQL authentication, the password for connecting to the source SQL Server. This parameter is not required if the source SQL Server uses Windows authentication.

/d_server:

Name of the SQL Server that hosts the QDB to which you want to migrate agents. If the SQL Server is on the computer where you are running the script, this parameter is not required.

/d_db:

Name of the QDB to which you want to migrate agents. If you do not specify this parameter, QDB is used.

/d_uid:

If the destination SQL Server uses SQL authentication, the user name for connecting to the destination SQL Server. This parameter is not required if the destination SQL Server uses Windows authentication.

/d_pwd:

If the destination SQL Server uses SQL authentication, the password for connecting to the destination SQL Server. This parameter is not required if the destination SQL Server uses Windows authentication.

/ms:

The primary and, optionally, secondary management server for the agent. To specify a secondary management server, use a comma to separate the primary and secondary management servers. For example, /ms:"MyPrimaryMS,MySecondaryMS".

delete

Whether to delete the agent from the source QDB after successful migration

To delete the agent, specify 1.

To keep the agent, specify 0.

NOTE:0 is not available when migrating UNIX agents. You must specify 1 when migrating UNIX agents.

/uxuser:

User name for connecting to the UNIX agent.

Ensure that the user has sudo access.

/uxpassword:

Password for connecting to the UNIX agent.

/port:

If the SSH server is not using port 22, SSH port number to use to connect to the UNIX agent.

/sg:

Name of the server group that contains the agents to migrate. The server group must be within the Master management group. When selecting the agents to migrate, any child server groups will be included.

/mgname:

Name of the management group that contains the agents to migrate.

/cp_name:

Name of the custom property that is assigned to the agents you want to migrate.

/cp_value:

Value of the custom property that is assigned to the agents you want to migrate.