Data Protector Practitioners Forum
cancel

export list of clients

tjungs
Absent Member.

export list of clients

I need to extract a list of all the clients with the Dataprotector installed, or a list of clients I can do restore from (just the hostname)

Basically I want a scheduled job to output this to a file every day.

I've looked at CLI reference, but I need some expert help here.

Is this a report, or which of the omni commands can I run to achieve this?

Best regards
Torben
14 REPLIES
Eblyn Solis Acclaimed Contributor..
Acclaimed Contributor..

Re: export list of clients

Hi ,

maybe this command can help:
#omnicellinfo -cell

Run this on cell manager.

Regards
Please assign a kudo to this post, if you find it useful.
Luc Minnaert Outstanding Contributor..
Outstanding Contributor..

Re: export list of clients

all that info is stored in an ascii file called cell_info........
and this is incorporated in the backup of the IDB
hence you probably have already a version on backup media anyway
tjungs
Absent Member.

Re: export list of clients

Thanks for the suggestions. omnicellinfo -cell returns way to much information.

the cell_info file is better, but i need to strip away the host and the rest, so only the hostname remains.

Know any tools for this?

Example file:
-host "raddmz002.dkrmed.internal.rmg" -os "microsoft i386 wNT-5.2-S" -da A.06.00 -ma A.06.00 -cc A.06.00
-host "raddmz008.dkrmed.internal.rmg" -os "microsoft i386 wNT-5.2-S" -da A.06.00 -ma A.06.00 -cc A.06.00
-host "raddmz004.dkrmed.internal.rmg" -os "microsoft i386 wNT-5.2-S" -da A.06.00 -ma A.06.00 -cc A.06.00
-host "raddmz009.dkrmed.internal.rmg" -os "microsoft i386 wNT-6.0-S" -mac -da A.06.00 -ma A.06.00 -cc A.06.00

Change to:
raddmz002
raddmz008
raddmz004
raddmz009

Thanks
brokenwh
Absent Member.

Re: export list of clients

by default, where would this file be located?

brokenwh
Absent Member.

Re: export list of clients

by chance is there a script that outputs this information to a csv or txt file?

Bob_Clark
Absent Member.

Re: export list of clients

You may want to try this, although I have never used it myself

 

(Note: type the command directly, do not Copy/Paste from this Forum string)

 

   omnirpt -report cell_info -tab -log [destination file path]

 

You did not specify whether your Cell Manager is uNIX or Windows, but, assuming it is Windows, your [destination file path]  (Do not include the [  ] marks) might be something like    D:\temp\list_of_hosts.txt

 

As you can see this is output as a 'text' file, but wait, there's more.  The '-tab' argument means that the output fields are seperated by 'tab' characters, and, therefore, the output can be put into a Excel spread sheet, where you can exclude any columns that are not useful. Unfortunately, the 'omnirpt' does not get any more granular than this

 

The command can be put into a 'batch' file or a UNIX script in the 'Program Data -> Omniback -> bin folder, and can be run as a pre-exec or post-exec script

Jaystone Trusted Contributor.
Trusted Contributor.

Re: export list of clients

That is a useful cmd. 

What I need is a report that will list out all the clients by name. what I mean is this. I want DP to go find all the servers that are being backed up, find there hostname and dsiplay it, or even better export this to a txt or csv file.

IE=

servername1

servername2  etc....

without all the other info. is there a command for this? as I have been trying to use the onmicellinfo, and the omnirpt to no avail. 

I have a fully windows environment, with just one cell manager.

Jay Reafs
zitbb Trusted Contributor.
Trusted Contributor.

Re: export list of clients

Hi,

copy and paste the following with Admin rights into Powershell ISE on the Windows Cell Manger and click Run. The output is in a file called hpdp_clients.txt in C:\temp :

$HPDP_command = @(omnicellinfo -cell brief)
$HPDP_clients= $HPDP_command -like "   host=*"
$HPDP_clients| foreach {
$HPDP_clients_trimmed = $_.split("`"")
$HPDP_clients_trimmed[1]
} | Out-File -FilePath C:\temp\hpdp_clients.txt

Hope that works for you.

Jaystone Trusted Contributor.
Trusted Contributor.

Re: export list of clients

This was great! Thank you. I apologize for the long delay.

this does pull all the machines I see under the "clients" tab. 

Is there a way to pull all of the VM's that are being backed up as well?

Thanks,

Jay Reafs
zitbb Trusted Contributor.
Trusted Contributor.

Re: export list of clients

Hi,

I don't have any VMs in my environment. So unfortunately I can not help you with that. But the first line of that script just executes an Omni (Data Protector) command and pipes the output into a variable. So take the omni command that is helpful with your VMs and go from there in Powershell.

Highlighted
Gamut Super Contributor.
Super Contributor.

Re: export list of clients

Is there a way to pull all of the VM's that are being backed up as well?

The list of clients you got, are NOT necessarily backed up. It is only a list of clients, not a list of backed up clients.

I just found a possible way, but it is not for the faint of heart. More disclaimer: I do not know the data model in the database of DP; I can only guess. I may have guessed incorrectly...

 

First, get the database password. My solution (on Linux):

awk -F\' '/^PGSUPERPASSWORD=/ {print $2}' /etc/opt/omni/server/idb/idb.config | base64 --decode; echo

Second, connect with the PostgreSQL database of DP. (If your DP runs on Raima, you obviously cannot use psql).

/opt/omni/idb/bin/psql -h localhost -p 7112 -U hpdp hpdpidb

 

Third, query away:

select distinct regexp_replace (options, '^.*vmName=''([^'']+).*$', E'\\1') from dp_session_obj_copies where label = 'VEAgent' and end_time > extract (epoch from (date_trunc ('day', now ()) - interval '24 hours')) order by 1;

 

You can also paste the query in a file (say vmquery.sql) and then run the following as root:

/opt/omni/sbin/omnidbutil -run_script /tmp/vmquery.sql -detail

(The only reason to run it as root, is that the default permissions of omnidbutil do not allow it to be run by mortals.)

 

 

Personnally, I scrape all sessions, all session objects and all session messages and put them in my own DB. I scrape them via omnirpt. This gives you another approach to the problem. If you are on Linux, try this oneliner:

CELLMANAGER=localhost; /opt/omni/bin/omnirpt -report list_sessions -timeframe 24 24 -tab -server "${CELLMANAGER}" | awk -F$'\t' '/^[^#]/ {print $23}' | while read -r SESSION_ID; do /opt/omni/bin/omnirpt -report session_objects -session "${SESSION_ID}" -tab -server "${CELLMANAGER}" | awk -F$'\t' '/^[^#]/ {print $2}'; done | sort | uniq

If you are on Windows, then choose an appropriate scripting alternative. For instance, Power Shell should be able to run the commands, loops, and should be able to filter on tab separated field not starting with a hash mark.

Sebastian.Koehler Acclaimed Contributor..
Acclaimed Contributor..

Re: export list of clients

Hi Jaystone,


@Jaystonewrote:

Is there a way to pull all of the VM's that are being backed up as well?


Since the VMs are not part of the cell_info file you need to use a different command. You can use omnirpt -report host_statistics -timeframe 24 24 which will report all backed up clients and VMs in the last 24 hours.

From what I know omnicellinfo -cell brief will also fetch all found VMs in configured ESXi hosts or vCenters (regardless if backed up or not) and report them.

Regards,
Sebastian Koehler

---
Please assign a KUDO to this post, if you find it useful.
Jaystone Trusted Contributor.
Trusted Contributor.

Re: export list of clients

Hello All,

Let me start by thanking you all for your input. 

I think that I have found the limitation here, my understanding of these systems...... DP is backing up VM's thru VCenter, and in this way DP is not "touching" each of the VM's. as such, there is no way for me to pull a list of those machines using DP. 

Again, thank you All!!

Jay Reafs
Gamut Super Contributor.
Super Contributor.

Re: export list of clients

Did you try my solution(s)? This one does list VM's:

CELLMANAGER=localhost; /opt/omni/bin/omnirpt -report list_sessions -timeframe 24 24 -tab -server "${CELLMANAGER}" | awk -F$'\t' '/^[^#]/ {print $23}' | while read -r SESSION_ID; do /opt/omni/bin/omnirpt -report session_objects -session "${SESSION_ID}" -tab -server "${CELLMANAGER}" | awk -F$'\t' '/^[^#]/ {print $2}'; done | sort | uniq

 

To elaborate a bit on this script:

 

The command "/opt/omni/bin/omnirpt -report list_sessions -timeframe 24 24 -tab -server my.cell.server.fqdn" will list all session that ran from 24 hours ago until now; 1 day worth of sessions. You will get an output like:

#List of Sessions
#Cell Manager: my.cell.server.fqdn
#Creation Date: 2018-05-24 16:06:43
# Headers
# Session Type  Specification   Status  Mode    Start Time      Start Time_t    End Time        End Time_t      Queuing Duration        GB Written   # Media  # Errors        # Warnings      # Pending DA    # Running DA    # Failed DA     # Completed DA  # Objects       # Files Success Session OwnerSession ID

Backup  VEAgent somespecification     Completed       incr    2018-05-24 04:00:01     1527127201      2018-05-24 04:03:00     1527127380   0:00     0:02    2,37    6       0       0       0       0       0       6       6       18      100%    root.root@my.cell.server.fqdn     2018/05/24-1

Because of the option "-tab", we get tab separated output. Notice that the last column (column 23) is the session ID. So, we can easily list all session ID's if we only show column 23. The awk part just that: print only column 23. Since we do not want the headers, we skip lines that begin with a hash sign. So we get:

/opt/omni/bin/omnirpt -report list_sessions -timeframe 24 24 -tab -server "${CELLMANAGER}" | awk -F$'\t' '/^[^#]/ {print $23}'

 

With a session ID, we can get the session objects. For example:

/opt/omni/bin/omnirpt -report session_objects -session 2018/05/24-10 -tab | head
#Session Objects Report
#Cell Manager: some.cell.server.fqdn
#Creation Date: 2018-05-24 16:14:25
#Session Type: Backup
#
# Headers
# Object Type   Client  Mountpoint      Description     Object Name     Status  Mode    Start Time      Start Time_t    End Time        End Time_t   Duration [hh:mm] Size [kB]       # Files Performance [MB/min]    Protection      # Errors        # Warnings      Device
BAR     somevm somevc/some/path[some-uuid]     VEAgent       /some/path/to/vm Completed       incr    2018-05-24 01:30:48     1527118248      2018-05-24 01:31:57     1527118317    0:01    1007287 9       855,37  2018-07-08 01:31:57     0       0       somegateway

The second column is the name of the VM. Because of option "-tab", the output is tab seperated, which is why ask awk to print column 2.

Since list_sessions will give us ALL the sessions of the past 24 hours (or whatever period you prefer), and since session_objects will give us ALL VM names for just 1 sessions, we get ALL VM names of ALL sessions. Since we love a sorted and do not like duplicates, we use sort and uniq.

Hope you can now better read the following:

CELLMANAGER=localhost; /opt/omni/bin/omnirpt -report list_sessions -timeframe 24 24 -tab -server "${CELLMANAGER}" | awk -F$'\t' '/^[^#]/ {print $23}' | while read -r SESSION_ID; do /opt/omni/bin/omnirpt -report session_objects -session "${SESSION_ID}" -tab -server "${CELLMANAGER}" | awk -F$'\t' '/^[^#]/ {print $2}'; done | sort | uniq

It should be easy to do the same with Perl, PowerShell, Python, etc.

Top Contributors Last 30 Days