bheisig / i-doit-cli Goto Github PK
View Code? Open in Web Editor NEWAccess your CMDB on the command line interface
License: GNU Affero General Public License v3.0
Access your CMDB on the command line interface
License: GNU Affero General Public License v3.0
idoit create server/mylittleserver
I chanced in issuing idoitcli create file/"Patches MYHOST_2011-05-03.txt"
The file entry showed up in idoit. But how do I upload the file via idoitcli?
idoitcli list
or idoitcli create -h
should show some hints how to upload files to idoit. From using the API, I know that there would be 3 steps:
There are no hints available how to achieve this.
Get a file and try to upload π
idoitcli create file/"Patches MYHOST_2011-05-03.txt"
creates a File object named "Patches MYHOST_2011-05-03.txt" inside idoitidoitcli create ???
uploads the file contentidoitcli create ???
joins the file to another object, like a Server objectI'm sorry if I missed available docs, but I've been too thick to find them. π
Regards, Werner
Examples:
idoit read */model
idoit read server/*/model
idoit read db*/model
Export every single detail from i-doit
For example, create a Word document:
idoitcli export --format markdown | pandoc --from markdown --to docx --output cmdb.docx
Option | Description |
---|---|
--format |
markdown , json , raw (default) |
--toc |
Add table of contents |
--types |
Limit output to comma-separated list of object types (by their titles, constants or identifiers) |
--ids |
Limit output to comma-separated list of objects (by their identifiers) |
rack
idoitcli logbook # Read everything
idoitcli logbook 123 # Read everything about an object by its identifier
idoitcli logbook mylittleserver # Read everything about an object by its title
idoitcli logbook -n100 # Read last 100 entries
idoitcli logbook -f # Follow
idoitcli logbook --since today # Read everything since a specific date
idoit list groups
Options:
--enabled
: List only enabled object type groups--disabled
: List only disabled object type groupsidoit list types
Options:
--enabled
: List only enabled object types--disabled
: List only disabled object typesI executed idoitcli init
and idoitcli configtest
, which told me everything is OK.
I want to execute idoitcli cache
to build the local cache.
Now I'm trying idoicli cache
, and I get
Create cache files needed for faster processing
Clear cache files
Fetch list of object types
No proper configuration for i-doit API calls: Connection to Web server failed [60]: SSL certificate problem: unable to get local issuer certificate
So, since I set curl.cainfo and openssl.capath in my php.ini (all of them, for apache2, cli, and fastcgi), and this does not help any, where does idoitcli expect the certificates? BTW, the only certificates involved are from an offical CA (Telekom), intermediate CA and server CA (both DFN e.V.), so the settings on OS level should suffice.
See above, please.
Question | Answer |
---|---|
bheisig/idoitapi version | 0.9 |
i-doit version | 1.15.2 pro |
i-doit API add-on version | ? has been updated along by the software partner |
The output seems to be on client side only.
"Custom categories" are user-defined categories with custom attributes. These categories should be handled correctly by all commands, including:
cache
categories
read
save
show
When I issue "idoitcli cache", I expect idoitcli to fill the local cache.
> idoitcli cache
Create cache files needed for faster processing
Clear cache files
Fetch list of object types
No proper configuration for i-doit API calls: Connection to Web server failed [60]: SSL certificate problem: unable to get local issuer certificate
Where has this certificate to be located? Do I have to provide the info in the config file? Does only the last issuer matter or do I need to provide the whole chain?
Enter the command "idoitcli cache".
Question | Answer |
---|---|
bheisig/idoitapi version | 0.9 |
i-doit version | 1.14.1 Revision 202011401 pro |
i-doit API add-on version | 1.10 |
The only log I get is shown above.
In version 0.7 it's not possible to set the capacity of memory of a virtual server:
idoitcli save virtual\ server/myserver.example.com/memory
Create/update CMDB objects and their category entries
[Memory] Title?
[Memory] Manufacturer?
[Memory] Type?
[Memory] Memory unit?
[Memory] Description?
Setting a Memory unit of "8 GB" is not possible also.
What am I missing?
Support auto-completion for ZSH (Z Shell)
See issue #9 for details
There is no script available for ZSH's auto-completion.
idoitcli <tab><tab>
idoitcli re<tab>
Question | Answer |
---|---|
idoitcli version |
0.5 |
When using bash the completion script should auto-complete user keyboard interactions for every single command and its options. This includes:
read
--help
or -c
idoitcli read server
Script only supports a subset of available commands, but not a single option/argument.
idoitcli re<tab>
idoitcli read ser<tab>
Question | Answer |
---|---|
idoitcli version |
0.5 |
idoit update server/mylittleserver/location --he 11
idoit update server/mylittleserver/hostaddress/1 --ipv4address 192.168.42.23
idoitcli set server/mylittleserver
idoitcli set server/mylittleserver/model --manufacturer A --title 123
idoitcli set server/mylittleserver/location --he 11
idoitcli set server/mylittleserver/hostaddress/1 --ipv4address 192.168.42.23
First, collect data:
$ idoitcli set
Create new object
Type? server
Title? mylittleserver
Add more attributes [y/N]? y
[Model] Manufacturer? A
[Model] Model? 123
[Hostaddress] Hostname? mylittleserver
[Location] Location? rackXY
[β¦]
Add more attributes
will be asked if template is available (see below)Based on object type specific templates in configuration file create/update objects and their attributes.
{
"templates":
"server": [
{
"category": "C__CATG__MODEL",
"attribute": "manufacturer"
},
{
"category": "C__CATG__MODEL",
"attribute": "title"
},
{
"category": "C__CATG__IP",
"attribute": "hostname"
},
{
"category": "C__CATG__LOCATION",
"attribute": "location"
}
]
}
STDOUT
what happened exactly.sudo apt install idoitcli
Our idoit installation allows to use the API without login, using the API key only.
Since I want to share the idoitcli invocation scripts, it should be sufficient to use the API key in the credentials file. But it is not, idoitcli complains (see below).
I'd like to see idoitcli working without logon. Sharing scrips nearly always includes config files laying around anywhere, and since they are not even encrypted, everyone can read each other's credentials. This is especially bad when using SSO...
12:38 user@host:~/.idoitcli> idoitcli show vsrvr.intranet.my.corp
One or more errors found in configuration settings:
Configuration setting "api.username" is too short. Minimum length is 1 character(s).
Configuration setting "api.password" is too short. Minimum length is 1 character(s).
Cannot proceed unless you fix your configuration
If I use "x" and "y", respectively, I get
No proper configuration for i-doit API calls: i-doit responded with an error: Authentication error [error: Either your username or password is invalid.]
Since username and password are not required, this data should not not be transmitted and thus this error should now show.
Empty the password and username entries. Or enter non-fitting data. And use idoitcli afterwards.
Question | Answer |
---|---|
idoitcli version |
idoitcli 0.7 |
PHP version | PHP 7.2.5 |
i-doit version | i-doit 1.11.1 PRO |
i-doit API add-on version | 1.9 |
Excerpt taken from /var/log/apache2/error.log
:
no access to the system
Excerpt taken from /var/www/html/i-doit/log/api_*.log
:
no access to this system. Might be /srv/www/... on SLES instead ;)
P.S.: according to https://kb.i-doit.com/pages/viewpage.action?pageId=7831613, a user login is not required, it can be configured off.
idoitcli log # interactive mode: ask for object, when open editor for message
idoitcli log 1000 # select object by its identifier; open editor for message
idoitcli log -m "Rebooted because of kernel updates" # interactive mode: ask for object
idoitcli log mylittleserver -m "Rebooted because of kernel updates" # select object by its title
-m
or --message
, otherwise open editorEDITOR
Good practice by Nextcloud: App Deck with guidelines in README.md with links to further resources: How to apply a license, more details, and a Developer Certificate of Origin
idoit create server/mylittleserver/model --manufacturer A --title 123
A "picture" says more than thousand wordsβ¦
$ idoitcli iplist "*0815"
Print list of IP addresses
Cloud Storage VLAN 0815 [#42128]
Contact: [email protected]
John Doe +49 555 12345678
Net address: 10.23.42.0/24 In use: 1/255
VLAN ID: 42 Next free address: 10.23.42.2
Default gateway: 10.23.42.1
βββββββββββββββββββ¦βββββββββββββββββββββββββββββββββββββββββββββββββββββ
β 10.23.42.1 β βΊ β gateway001.example.com [server] [#324712] β
β ββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββββββββββββββ£
β 10.23.42.2 β free βββββββββββββββββββββββββββββββββββββββββββββ β
β ββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββββββββββββββ£
β 10.23.42.254 β free βββββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββ©βββββββββββββββββββββββββββββββββββββββββββββββββββββ
idoit list categories
Options:
--enabled
: List only enabled categories--disabled
: List only disabled categories--global
: List only "global" categories--specific
: List only "specific" categories--custom
: List only custom categoriesCommand: fixip
127.0.0.0/8
)::1
Command: merge-vendors
Affected category: model
Affected attributes: manufacturer
and model
$ idoitcli merge-vendors
List of available vendors:
1: HP
2: Hewlett-Packard
3: HP, Inc.
Which vendors do you like to merge? 1, 2, 3
Which name do you prefer? (Select numer or enter new name): Hewlett-Packard Company
Mergingβ¦
Create new vendor "Hewlett-Packard Company"
Merge models from vendor "HP" [1] to "Hewlett-Packard Company" [4]
Merge models from vendor "Hewlett-Packard" [2] to "Hewlett-Packard Company" [4]
Merge models from vendor "HP, Inc." [3] to "Hewlett-Packard Company" [4]
Purge out-dated models
Purge out-dated vendors
Done
---merge-vendor=VENDOR
: Select vendor to be merged; repeat this option for more vendors--prefered-vendor=VENDOR
: Prefered vendorVENDOR
represents the name or its identifier. A new one will be created if the name does not exist.
$ idoitcli merge-vendors \
--merge-vendors="HP" \
--merge-vendors="Hewlett-Packard" \
--merge-vendors="HP, Inc." \
--prefered-vendor="Hewlett-Packard Company"
Mergingβ¦
Create new vendor "Hewlett-Packard Company"
Merge models from vendor "HP" [1] to "Hewlett-Packard Company" [4]
Merge models from vendor "Hewlett-Packard" [2] to "Hewlett-Packard Company" [4]
Merge models from vendor "HP, Inc." [3] to "Hewlett-Packard Company" [4]
Purge out-dated models
Purge out-dated vendors
Done
Command issued: idoitcli cache
idoitcli starting to build the cache
idoitcli cache
Create cache files needed for faster processing
Clear cache files
Fetch list of object types
No proper configuration for i-doit API calls: i-doit responded with an error: i-doit system error: Unable to get userId by credentials
I guess that this is the relevant part, because nothing else has been changed on my side.
Our DEV system behaves the same. And everything worked fine with a password that didn't use '(' and ')'. Interactive logon with this password also woks fine, so I expect idoitcli to be tha password muncher.
Question | Answer |
---|---|
bheisig/idoitapi version | 0.9, fresh from the site |
i-doit version | 1.13.2 PRO |
i-doit API add-on version | im Source steht Version 1.10 |
Some simple questions will be asked how to access your i-doit installation.
One or more errors found in configuration settings:
Configuration setting "api.username" is too short. Minimum length is 1 character(s).
Configuration setting "api.password" is too short. Minimum length is 1 character(s).
Cannot proceed unless you fix your configuration
idoitcli init
OS: Fedora 29
Question | Answer |
---|---|
idoitcli version |
0.5 |
PHP version | 7.2.11 |
i-doit version | 1.11.1 pro |
i-doit API add-on version | 1.9.1 |
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.