Columns in CMBD overview

Moderator: crythias

Post Reply
sova
Znuny newbie
Posts: 1
Joined: 17 Jan 2012, 18:02
Znuny Version: 3.0.8

Columns in CMBD overview

Post by sova »

Hi,
recently we started using OTRS in our company, and we also stated to fill the information in CMDB, but it is very uncomfortable to view information in overview. We would like to change columns in the overview, i.e. we need CustomerCompany and Owner. And it would be really good if we could sort columns by clicking on it's header, like in any other system, because she search option is not very helpful.

Please answer soon, if it's possible or not.
CMDB is really poweful but viewing and serching options are not so quick to use, as I am used to.
jojo
Znuny guru
Posts: 15019
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: Columns in CMBD overview

Post by jojo »

it is not possible as the backend module won't use the XML Data of an CI, just special data from a table
"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
choenig
Znuny newbie
Posts: 36
Joined: 28 Sep 2012, 11:26
Znuny Version: 3.1.10
Location: 49° 54′ N, 10° 54′ O

Re: Columns in CMBD overview

Post by choenig »

Hi Jojo,

is it possible to "adjust" the backend? For example to tell it not to use/show configitem\configitem_number but configitem\class_id in the CMDB Overview?

Greetings
OTRS 3.2.8 - KIX4OTRS - ConfigureCallHome - ZnunyCustomerMap - running on CentOS 6.4 and MySQL
anyone who finds clerical errors can keep it...
artjoms15
Znuny advanced
Posts: 121
Joined: 30 Aug 2011, 10:48
Znuny Version: 3.3.8 && 4.0.9
Real Name: Artjoms Petrovs
Location: Latvia

Re: Columns in CMBD overview

Post by artjoms15 »

Well, it is possible, but it requires a heavy customization in OTRS environment. As well, you should be aware, that it includes XML data parsing for EVERY ticket shown in overview, so be ready for additional slowness (on productional environment load of the page took up to 2-3 seconds)

So steps to produce:

1) ITSMConfigItemOverviewSmall.pm Module - retrieve ConfigItem with all XML data

Code: Select all

       
                 my $ConfigItem = $Self->{ConfigItemObject}->VersionGet(
                    ConfigItemID => $ConfigItemID,
                    XMLDataGet   => 1,
                );
2) Parse XML and retrieve needed values from a config item (not a helper here, it depends on you, if you want custom data retrieval or it is enough with standart Framework parse)

3) Save retrieved value in $ConfigItem variable before it is copied into %Data hash, like

Code: Select all

$ConfigItem -> {YourRetrievedValue} = $MyRetrievedData; 
4) update dtl file AgentITSMConfigItemOverviewSmall.dtl and create a block <!-- dtl:block:RecordYourRetrievedValue --> and header block as well

5) In SysConfig set this column name in output [ITSMConfigItem::Frontend::AgentITSMConfigItem###ShowColumns ]

Well, it is general overview, and mostly done for myself to keep HowTos in memory, so...

Smile :)
A.
Ar cieņu / Kind regards,
----------------------------------------
Artjoms Petrovs
Sistēmu analītiķis/Programmētājs /
Systems Analyst/Programmer
artjoms15
Znuny advanced
Posts: 121
Joined: 30 Aug 2011, 10:48
Znuny Version: 3.3.8 && 4.0.9
Real Name: Artjoms Petrovs
Location: Latvia

Re: Columns in CMBD overview

Post by artjoms15 »

Btw, you can set Class in overview, without any customization, just set it into the SysConfig as 1 (shown columns) ;)
Ar cieņu / Kind regards,
----------------------------------------
Artjoms Petrovs
Sistēmu analītiķis/Programmētājs /
Systems Analyst/Programmer
MDIeragland
Znuny newbie
Posts: 3
Joined: 04 Dec 2012, 01:01
Znuny Version: 3.1.6
Real Name: Eric
Company: Morpho Detection, Inc.

Re: Columns in CMBD overview

Post by MDIeragland »

artjoms15 wrote: 2) Parse XML and retrieve needed values from a config item (not a helper here, it depends on you, if you want custom data retrieval or it is enough with standart Framework parse)

3) Save retrieved value in $ConfigItem variable before it is copied into %Data hash, like

Code: Select all

$ConfigItem -> {YourRetrievedValue} = $MyRetrievedData; 
Hi, Attempting to do this for the Owner field and looking for some assistance. Got a little lost finding the syntax of Property/Value pairs.

I added this to ITSMConfigItemOverviewSmall.pm

Code: Select all

# get config item data
                my $ConfigItem = $Self->{ConfigItemObject}->VersionGet(
                    ConfigItemID => $ConfigItemID,
                    XMLDataGet   => 1,
                );

$ConfigItem -> {Owner} = $Owner;
Getting this error in the error_log.

Code: Select all

Global symbol "$Owner" requires explicit package name at  /opt/otrs/Kernel/Output/HTML/ITSMConfigItemOverviewSmall.pm line 157.\n
The ConfigItem is for Computer Class,

Code: Select all

  { 
        Key => 'Owner', 
        Name => 'Owner', 
        Searchable => 1, 
        Input => { 
            Type => 'Customer', 
        }, 
    }, 
eturconi
Znuny newbie
Posts: 35
Joined: 27 Dec 2011, 15:18
Znuny Version: 3

Re: Columns in CMBD overview

Post by eturconi »

I got the same issue!
Any tips about the fix?
Regards
MDIeragland
Znuny newbie
Posts: 3
Joined: 04 Dec 2012, 01:01
Znuny Version: 3.1.6
Real Name: Eric
Company: Morpho Detection, Inc.

Re: Columns in CMBD overview

Post by MDIeragland »

Fixed. Though my perl is weak so someone else might be able to show a better way to get to the data in the array/hash.

Finishing my example from earlier, this is what I ended up with.

Code: Select all

               $ConfigItem -> {Owner} = $ConfigItem -> {'XMLData'}[1] -> {'Version'}[1] -> {'Owner'}[1] -> {'Content'};

It tripped me up that the first item in each array was empty, but data dumper saved the day. Also it's not as slow to load as I feared it may be.

For those that want to find the same thing, I dropped $ConfigItem to standard error.

Code: Select all

use Data::Dumper;
print STDERR Dumper(\$ConfigItem);
And thanks artjoms15 for getting me most of the way there!

Cheers,

-e
MDIeragland
Znuny newbie
Posts: 3
Joined: 04 Dec 2012, 01:01
Znuny Version: 3.1.6
Real Name: Eric
Company: Morpho Detection, Inc.

Re: Columns in CMBD overview

Post by MDIeragland »

Been ask to recap what was done. Put altogether here are the 4 steps to add Owner to the CMDB Overview. (works for Search results too)

1) ITSMConfigItemOverviewSmall.pm Module - retrieve ConfigItem with all XML data

Code: Select all

 # get config item data
                my $ConfigItem = $Self->{ConfigItemObject}->VersionGet(
                    ConfigItemID => $ConfigItemID,
                    XMLDataGet   => 1,
                );
2) add this list under the above and before "$ConfigItem -> {YourRetrievedValue} = $MyRetrievedData;"

Code: Select all

 $ConfigItem -> {Owner} = $ConfigItem -> {'XMLData'}[1] -> {'Version'}[1] -> {'Owner'}[1] -> {'Content'};
3) update dtl file AgentITSMConfigItemOverviewSmall.dtl and create a block <!-- dtl:block:RecordYourRetrievedValue --> and header block as well

4) In SysConfig set this column name in output [ITSMConfigItem::Frontend::AgentITSMConfigItem###ShowColumns ]
najaleon
Znuny newbie
Posts: 98
Joined: 09 Jul 2012, 11:13
Znuny Version: 3.1.7
Real Name: Leon

Re: Columns in CMBD overview

Post by najaleon »

I have an additional question. I have successfully added some new columns but i cannot sort by the new columns.

For the example "Owner" i get always this error message:

OrderBy contains invalid value 'Owner' or the value is used more than once!

What i have to change, so it works?
najaleon
Znuny newbie
Posts: 98
Joined: 09 Jul 2012, 11:13
Znuny Version: 3.1.7
Real Name: Leon

Re: Columns in CMBD overview

Post by najaleon »

No ideas?
najaleon
Znuny newbie
Posts: 98
Joined: 09 Jul 2012, 11:13
Znuny Version: 3.1.7
Real Name: Leon

Re: Columns in CMBD overview

Post by najaleon »

I´m testing the new ITSM version 3.2.1 and it looks as if the ITSMChangeOverwievSmall.pm has changed.

For example, i didn´t find the "XMLDataGet" entry etc.

How can i add custom colmuns like "Owner" now?
Calsonic
Znuny newbie
Posts: 44
Joined: 07 Nov 2011, 15:00
Znuny Version: 5.0.8

Re: Columns in CMBD overview

Post by Calsonic »

In ITSM 3.1.7 it works for me to change the following:

In ITSMConfigItemOverviewSmall.pm:
# get config item data
my $ConfigItem = $Self->{ConfigItemObject}->VersionGet(
ConfigItemID => $ConfigItemID,
XMLDataGet => 1,
);

$ConfigItem -> {Owner} = $ConfigItem -> {'XMLData'}[1] -> {'Version'}[1] -> {'Owner'}[1] -> {'Content'};

next ConfigItemID if !$ConfigItem;
In AgentITSMConfigItemOverviewSmall.dtl:
<!-- dtl:block:RecordOwnerHeader -->
<th class="Owner $QData{"CSS"}">
<a href="$Env{"Baselink"}Action=$Env{"Action"};$Data{"LinkSort"};SortBy=Owner;OrderBy=$LQData{"OrderBy"}">$Text{"Owner"}</a>
</th>
<!-- dtl:block:RecordOwnerHeader -->

I'm missing the owner data in the linked: configitem. I already got the column, but its not filled.
OTRS 5.0.8
ITSM 5.0.14

CentOS 7
najaleon
Znuny newbie
Posts: 98
Joined: 09 Jul 2012, 11:13
Znuny Version: 3.1.7
Real Name: Leon

Re: Columns in CMBD overview

Post by najaleon »

Add this additional entry in AgentITSMConfigItemOverviewSmall.dtl, only sort by this new colmun doesn´t work.

Code: Select all

<!-- dtl:block:RecordOwner -->
                <td>
<!-- dtl:block:RecordOwnerLinkStart -->
                    <a href="$Env{"Baselink"}Action=AgentITSMConfigItemZoom;ConfigItemID=$LQData{"ConfigItemID"}" title="$LQData{"Owner"}" class="MasterActionLink">
<!-- dtl:block:RecordOwnerLinkStart -->
                        <div title="$QData{"Owner"}">$QData{"Owner","40"}</div>
<!-- dtl:block:RecordOwnerLinkEnd -->
                    </a>
<!-- dtl:block:RecordOwnerLinkEnd -->
                </td>
<!-- dtl:block:RecordOwner -->
Calsonic
Znuny newbie
Posts: 44
Joined: 07 Nov 2011, 15:00
Znuny Version: 5.0.8

Re: Columns in CMBD overview

Post by Calsonic »

I forget to mention this part. I have added it already.
Thats how it looks at the moment:

Image
OTRS 5.0.8
ITSM 5.0.14

CentOS 7
ismael
Znuny newbie
Posts: 2
Joined: 14 Mar 2013, 17:29
Znuny Version: 3.2.2
Company: RS Consulting

Re: Columns in CMBD overview

Post by ismael »

I just started using OTRS a couple of days ago and was looking for a similar solution. Just for those who are still searching for an option to add Customer Company Information to the CMDB Overview window...

I managed to link the CustomerCompany information in OTRS Version 3.2.2 by doing the following :

1) In the Admin panel, go to Config Items (under "Ticket Settings") and change the class definitions to include the following code (if you haven't already):

Code: Select all

{
        Key        => 'CustomerCompany',
        Name       => 'CustomerCompany',
        Searchable => 1,
        Input => {
            Type => 'CustomerCompany',
            Required => 1,
        },
    },
The above code will allow you to assign the related CustomerCompany when adding new Config Items.
Now, to show the info in the Overview window...

2) In ITSMConfigItemOverviewSmall.pm, I updated the code just before "next ConfigItemID if !$ConfigItem;" to look like this:

Code: Select all

# get config item data
                my $ConfigItem = $Self->{ConfigItemObject}->VersionGet(
                    ConfigItemID => $ConfigItemID,
                    XMLDataGet   => 1,
                );

		$ConfigItem -> {CustomerCompany} = $ConfigItem -> {'XMLData'}[1] -> {'Version'}[1] -> {'CustomerCompany'}[1] -> {'Content'};
3)In AgentITSMConfigItemOverviewSmall.dtl added the following header in the header area (make sure to notice where you place the column header):

Code: Select all

<!-- dtl:block:RecordCustomerCompanyHeader -->
                <th class="CustomerCompany $QData{"CSS"}">
				<a href="$Env{"Baselink"}Action=$Env{"Action"};$Data{"LinkSort"};SortBy=Owner;OrderBy=$LQData{"OrderBy"}">$Text{"CustomerCompany"}</a>
			</th>
	<!-- dtl:block:RecordCustomerCompanyHeader -->
4)In AgentITSMConfigItemOverviewSmall.dtl added the following in the Record area (make sure to include the code by following the same location logic as the previous step):

Code: Select all

<!-- dtl:block:RecordCustomerCompany -->
     	           <td>
	<!-- dtl:block:RecordCustomerCompanyLinkStart -->
	                  <a href="$Env{"Baselink"}Action=AgentITSMConfigItemZoom;ConfigItemID=$LQData{"ConfigItemID"}" title="$LQData{"CustomerCompany"}" class="MasterActionLink">
	<!-- dtl:block:RecordCustomerCompanyLinkStart -->
     		                 <div title="$QData{"CustomerCompany"}">$QData{"CustomerCompany","40"}</div>
	<!-- dtl:block:RecordCustomerCompanyLinkEnd -->
                       </a>
	<!-- dtl:block:RecordCustomerCompanyLinkEnd -->
                </td>
	<!-- dtl:block:RecordCustomerCompany -->
5) In SysConfig go to Frontend::Agent::ViewConfigItem (I found it by searching for ShowColumns), and under ITSMConfigItem::Frontend::AgentITSMConfigItem###ShowColumns click on the plus (+) sign and add "CustomerCompany" with content "1".

Sorting still doesn't work...
PaoloCeccacci
Znuny newbie
Posts: 12
Joined: 03 Dec 2012, 19:09
Znuny Version: 3.1.11
Real Name: Paolo Ceccacci
Company: Puntosys

Re: Columns in CMBD overview

Post by PaoloCeccacci »

Thanks to your useful informations I succeded in add the CUSTOMER column to all my CI views.
Now I'd like to add the ExirationDate column but I found that ExpirationDate it's a sub-parameter of LicenseKey and it's only valid for Software CI.
How can I retrieve those data?
I tried:

Code: Select all

$ConfigItem -> {ExpirationDate} = $ConfigItem -> {'XMLData'}[1] -> {'Version'}[1] -> {'ExpirationDate'}[1] -> {'Content'};
and

Code: Select all

$ConfigItem -> {ExpirationDate} = $ConfigItem -> {'XMLData'}[1] -> {'Version'}[1] -> {'LicenseKey::ExpirationDate'}[1]-> {'Content'};
and at least

Code: Select all

$ConfigItem -> {ExpirationDate} = $ConfigItem -> {'XMLData'}[1] -> {'Version'}[1] -> {'LicenseKey'}[1] -> ('ExpirationDate')[1] -> ('Content');
with no success.

Yet. I want to add "CustomerID" column but cannot retrieve CustomerID data from CUSTOMER (owner).
How can I?
Thanks in advance.
SDerksen
Znuny newbie
Posts: 1
Joined: 16 Apr 2013, 11:58
Znuny Version: 3.2.5

Re: Columns in CMBD overview

Post by SDerksen »

Hello all,

I have tried to do the same, and the guide ismael wrote helped me to show the column.

Thanks for that Ismael, and to try to help you back, in step 3 you write the following:

<!-- dtl:block:RecordCustomerCompanyHeader -->
<th class="CustomerCompany $QData{"CSS"}">
<a href="$Env{"Baselink"}Action=$Env{"Action"};$Data{"LinkSort"};SortBy=Owner;OrderBy=$LQData{"OrderBy"}">$Text{"CustomerCompany"}</a>
</th>
<!-- dtl:block:RecordCustomerCompanyHeader -->

In the 3th line, <a href=....... </a> there is a SortBy field. I think you need to change that to the field you want to use.

I hope this might help!
Calsonic
Znuny newbie
Posts: 44
Joined: 07 Nov 2011, 15:00
Znuny Version: 5.0.8

Re: Columns in CMBD overview

Post by Calsonic »

I'm still missing the Owner Data in the linked objects.

Image

This table shows devices which are linked to a license and shown in the detail view of a license.

Have someone a solution for this?
OTRS 5.0.8
ITSM 5.0.14

CentOS 7
Post Reply