CentOS 7.x Run custom query in iTop
From Notes_Wiki
<yambe:breadcrumb>CentOS_7.x_itop|CentOS 7.x itop</yambe:breadcrumb>
CentOS 7.x Run custom query in iTop
To run custom query in itop use:
- First login as admin user
- Go to "Admin Tools" -> "Data Model", here you can see the table name in (). For example for Web Application table name is WebApplication.
- Clicking on the name will give details of various fields in the table
- Go to "Admin Tools" -> "Run Queries".
- You can run queries such as:
- SELECT PC AS pc, WHERE pc.end_of_warranty > NOW() AND pc.end_of_warranty < DATE_ADD(NOW(), INTERVAL 30 DAY)
-
- The above query searches for PCs whose warranty is expiring between today and next 30 days.
- Various other 'Query Examples' are given at top using link at same page. Note that SELECT, WHERE etc. should be in capital. Table names and field names are case sensitive.
- For useful queries you can go to "Admin Tools" -> "Query phrasebook" and then add this custom query. For adding choose appropriate name and description. Enter query as it is in Expression. In Fields type '*'. (Purpose/Usage of Fields in not clear yet).
- You can also directly connect to Mariadb backend database. For every object type there is a view_<table-name> view. For example for PC there is view_PC view. This can be queried using normal SQL syntax.