See the computers that were most associated?

Moderator: crythias

Post Reply
amdkryn
Znuny expert
Posts: 187
Joined: 02 Oct 2012, 02:52
Znuny Version: 5.0.27

See the computers that were most associated?

Post by amdkryn »

How can I do to see the computers / Ci that were most associated with the tickets? The goal is to know which computers had more problems. It can be a SQL query. I can not create a report with this information.

I do not know how to search the database with SQL commands.

My System:
OTRS 3.1.11 / KIX4OTRS / Opensuse 12

Sorry for my english horrible
Last edited by amdkryn on 22 Jun 2013, 14:51, edited 1 time in total.
OTRS version 5.0.27 (With ITSM), Operating System OpenSuse 12 with Mysql.
amdkryn
Znuny expert
Posts: 187
Joined: 02 Oct 2012, 02:52
Znuny Version: 5.0.27

Re: See the computers that were most associated?

Post by amdkryn »

Anybody?
OTRS version 5.0.27 (With ITSM), Operating System OpenSuse 12 with Mysql.
tto
Znuny wizard
Posts: 315
Joined: 09 Jan 2007, 15:24
Znuny Version: OTRS 5.0.x
Real Name: Torsten
Company: c.a.p.e. IT GmbH
Location: Chemnitz
Contact:

Re: See the computers that were most associated?

Post by tto »

amdkryn wrote:How can I do to see the computers / Ci that were most associated with the tickets? The goal is to know which computers had more problems. It can be a SQL query. I can not create a report with this information.

I do not know how to search the database with SQL commands.
The following SQL is VERY BASIC. It just counts the number of links between CI with ID 9999 and tickets. It does not differ between link types and counts any tickets independent from ticket type or state. You may use this as a starter but it's not your final statement. Try to find someone in your team who's speaking SQL:

Code: Select all

SELECT count(*)
FROM link_relation lr, link_object lo1, link_object lo2
WHERE lr.source_object_id = lo1.id
AND lo1.name = 'ITSMConfigItem'
AND lr.target_object_id = lo2.id
AND lo2.name = 'Ticket'
AND lr.source_key = '9999'
regards, T.
Last edited by tto on 24 Jun 2013, 20:27, edited 2 times in total.
--
KIX 17.x (fork of OTRS)
Professional KIX-, or OTRS-integration, development and consulting by c.a.p.e. IT - http://www.cape-it.de
For questions and hints regarding KIX(4OTRS) please go to https://forum.kixdesk.com/
Bei Fragen und Hinweisen zu KIX(4OTRS) bitte an https://forum.kixdesk.com/ wenden.
amdkryn
Znuny expert
Posts: 187
Joined: 02 Oct 2012, 02:52
Znuny Version: 5.0.27

Re: See the computers that were most associated?

Post by amdkryn »

Thanks for the help.

The query is generating an error:
Unknown column 'lo1.source_key' in 'where clause', SQL: "SELECT count (*) FROM link_relation lr, link_object LO1, link_object lo2 = lo1.id AND WHERE lr.source_object_id lo1.name = 'ITSMConfigItem'AND lr.target_object_id lo2.id lo2.name = AND = 'Ticket'AND lo1.source_key = '1032001563' LIMIT 40 '

In place of 999 put the computer ID 1032001563. Where did I go wrong?
OTRS version 5.0.27 (With ITSM), Operating System OpenSuse 12 with Mysql.
tto
Znuny wizard
Posts: 315
Joined: 09 Jan 2007, 15:24
Znuny Version: OTRS 5.0.x
Real Name: Torsten
Company: c.a.p.e. IT GmbH
Location: Chemnitz
Contact:

Re: See the computers that were most associated?

Post by tto »

amdkryn wrote: The query is generating an error:
Unknown column 'lo1.source_key' in 'where clause', SQL: "SELECT count (*) FROM link_relation lr, link_object LO1, link_object lo2 = lo1.id AND WHERE lr.source_object_id lo1.name = 'ITSMConfigItem'AND lr.target_object_id lo2.id lo2.name = AND = 'Ticket'AND lo1.source_key = '1032001563' LIMIT 40 '
my mistake - should work by now. I have no chance to check it. One more thing: the statement counts only the links where the CI is the source of the link. Directional links TO this CI are not counted.

regards, T.
--
KIX 17.x (fork of OTRS)
Professional KIX-, or OTRS-integration, development and consulting by c.a.p.e. IT - http://www.cape-it.de
For questions and hints regarding KIX(4OTRS) please go to https://forum.kixdesk.com/
Bei Fragen und Hinweisen zu KIX(4OTRS) bitte an https://forum.kixdesk.com/ wenden.
amdkryn
Znuny expert
Posts: 187
Joined: 02 Oct 2012, 02:52
Znuny Version: 5.0.27

Re: See the computers that were most associated?

Post by amdkryn »

No longer are occurring error but does not generate any results.
I just changed the value of lr.source_key = '10156000254 '
This IC has a few tickets assigned. Am I doing something wrong?
OTRS version 5.0.27 (With ITSM), Operating System OpenSuse 12 with Mysql.
tto
Znuny wizard
Posts: 315
Joined: 09 Jan 2007, 15:24
Znuny Version: OTRS 5.0.x
Real Name: Torsten
Company: c.a.p.e. IT GmbH
Location: Chemnitz
Contact:

Re: See the computers that were most associated?

Post by tto »

amdkryn wrote:No longer are occurring error but does not generate any results.
I just changed the value of lr.source_key = '10156000254 '
This IC has a few tickets assigned. Am I doing something wrong?
...you're not using the ID, but the number. You find the ID in the URL when editing a CI (for instance).

regards, T.
--
KIX 17.x (fork of OTRS)
Professional KIX-, or OTRS-integration, development and consulting by c.a.p.e. IT - http://www.cape-it.de
For questions and hints regarding KIX(4OTRS) please go to https://forum.kixdesk.com/
Bei Fragen und Hinweisen zu KIX(4OTRS) bitte an https://forum.kixdesk.com/ wenden.
amdkryn
Znuny expert
Posts: 187
Joined: 02 Oct 2012, 02:52
Znuny Version: 5.0.27

Re: See the computers that were most associated?

Post by amdkryn »

Now I understand, thanks
OTRS version 5.0.27 (With ITSM), Operating System OpenSuse 12 with Mysql.
Post Reply