I need to create a report. Table: cmdb_ci_server

Prince Sai
Giga Expert

Hi Everyone,

I need to create a report. Table is cmdb_ci_server. The condition is I need to show particular records when the their "status" field is changed.

Ex: I need to show servers which status are changed in this current month.

Thanks in advance.

Prince

 

1 ACCEPTED SOLUTION

Hi @Prince Sai 

Got it. Couple of things you need to implement before configuring the Report to achieve what you are looking for:

1) Metrics works only for Task table and for tables which are coming from Task Table. So by default it will not work for Server9cmdb_ci_server) table.

2) In order to make this work then Navigate to the Business Rule named as "metrics events" as shown below:

find_real_file.png

3) Open this Record and Select Table as "cmdb_ci_server" and Right click on the header  and do Insert and Stay as shown below:

find_real_file.png

4) Now when you change the status Metric will auto calculate it as you want.

5) Now Next part is you want to show columns of Server table in the report so you need to create a Database view here which will join Metric Instance table and Server table and then you can report on the database view and that should be it as explained below:

Navigate to the module Database View as shown below:

find_real_file.png

Click on new and create a Database View by naming it as "server_status" as shown below:

find_real_file.png

 Now scroll down and click on Related list named as View Tables and create entry exactly similar to as shown below:

find_real_file.png

Now you can report on this Database View and will allow you to select both fields from Server table and also on Metric instance which will give you what has changed as shown below:

Change your table in Report to the database view which you have created as shown below:

find_real_file.png

Select your Report as List only and now go to 3rd tab and select Columns from Server table as you want as shown below:

find_real_file.png

Result:

find_real_file.png

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

View solution in original post

9 REPLIES 9

Hi @shloke04 

The steps are I am able to done. But In Configure Tab  Choose columns are not available fields matching with the cmdb_ci_server. and also when I run the report I see that no records are found.

Note: cmdb_ci_server fields and columns in report are not matching.

Thanks

Best Regards,

Prince Sai

Hi @Prince Sai 

Got it. Couple of things you need to implement before configuring the Report to achieve what you are looking for:

1) Metrics works only for Task table and for tables which are coming from Task Table. So by default it will not work for Server9cmdb_ci_server) table.

2) In order to make this work then Navigate to the Business Rule named as "metrics events" as shown below:

find_real_file.png

3) Open this Record and Select Table as "cmdb_ci_server" and Right click on the header  and do Insert and Stay as shown below:

find_real_file.png

4) Now when you change the status Metric will auto calculate it as you want.

5) Now Next part is you want to show columns of Server table in the report so you need to create a Database view here which will join Metric Instance table and Server table and then you can report on the database view and that should be it as explained below:

Navigate to the module Database View as shown below:

find_real_file.png

Click on new and create a Database View by naming it as "server_status" as shown below:

find_real_file.png

 Now scroll down and click on Related list named as View Tables and create entry exactly similar to as shown below:

find_real_file.png

Now you can report on this Database View and will allow you to select both fields from Server table and also on Metric instance which will give you what has changed as shown below:

Change your table in Report to the database view which you have created as shown below:

find_real_file.png

Select your Report as List only and now go to 3rd tab and select Columns from Server table as you want as shown below:

find_real_file.png

Result:

find_real_file.png

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hi @Prince Sai 

Solution proposed above will definitely work for you as I have tested it in my PDI and works fine.

if you have a follow up query then please let me know else please mark my answer as correct and close this thread for others.

Regards,

Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hi @shloke04 

 

The solution you provided is working great as expected. 

1)I have a doubt on where the records are storing and it will impact any performance issues?

2)We are creating report on monthly basis. On Second Month will I get the first month data?

Thanks for your quick and practical explanation.

 

Thanks

Prince Sai

 

Hi,

Below are answer to your query below:

 

1)I have a doubt on where the records are storing and it will impact any performance issues? --> Database view are virtual tables which is utilized for these kind of scenario and will not affect any performance here.

A database view defines table joins for reporting purposes.

For example, a database view can join the Incident table to the Metric Definition and Metric Instance tables. This view can be used to report on incident metrics and may include fields from any of these three tables.

A number of useful database views are installed with the Database View plugin and the Database Views for Service Management plugin. These database views cover most metric reporting needs and greatly reduce the need to define new ones.

Please see doc as below on the same topic just sharing to support my answer:

https://docs.servicenow.com/bundle/sandiego-platform-administration/page/use/reporting/concept/c_DatabaseViews.html

2)We are creating report on monthly basis. On Second Month will I get the first month data?

By default it will show previous month data as well. You just need to apply a filter condition in your report to show only current month data as shown below:

find_real_file.png

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke