2017 © Pedro Peláez
 

project idoitcli

Access your CMDB on the command line interface

image

bheisig/idoitcli

Access your CMDB on the command line interface

  • Thursday, June 28, 2018
  • by bheisig
  • Repository
  • 1 Watchers
  • 2 Stars
  • 6 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 5 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

i-doit CLI tool

Access your CMDB on the command line interface, (*1)

Latest Stable Version Minimum PHP Version Build Status, (*2)

About

i-doit is a software application for IT documentation and a CMDB (Configuration Management Database). This application is very useful to collect all your knowledge about the IT infrastructure you are dealing with. i-doit is a Web application and has an exhausting API which is very useful to automate your infrastructure., (*3)

This application provides a simple, but powerful command line interface to access your CMDB data stored in i-doit., (*4)

Features

  • Read information about objects their types and even their attributes
  • Find your needle in the haystack called CMDB
  • Do you need a free IP address in a particular subnet? This app suggests one for you.
  • Stress your system: auto-generate thousands of objects

Requirements

Before using this app your system must meet the following requirements:, (*5)

  • Of course, i-doit pro/open, version 1.13 or higher
  • i-doit API add-on, version 1.10.3 or higher
  • Any POSIX operating system (GNU/Linux, *BSD, MacOS) or Windows
  • PHP >= 7.1 (7.3 is recommended)
  • PHP extensions calendar, cli, cURL, json, phar and zlib
  • PHP extension pcntl is optional, but highly recommended (non-Windows only)

Install and update

You have two good options to download and install this application:, (*6)

  • Download any stable release (recommended)
  • Use PHIVE

Download release

Download the latest stable version of the binary idoitcli from the release site. Then install it system-wide:, (*7)

~~~ {.bash} curl -OL https://github.com/bheisig/i-doit-cli/releases/download/0.7/idoitcli chmod 755 idoitcli sudo mv idoitcli /usr/local/bin/, (*8)


To be up-to-date just repeat the steps above. ### Use PHIVE With [PHIVE](https://phar.io/) you are able to download and install PHAR files on your system. Additionally, it will verify the SHA1 and GPG signatures which is highly recommended. If you have PHIVE already installed you can fetch the latest version of this application: ~~~ {.bash} sudo phive install --global bheisig/i-doit-cli

This will install an executable binary to /usr/bin/idoitcli., (*9)

If a new release is available you can perform an update:, (*10)

~~~ {.bash} sudo phive update --global, (*11)


## Usage Just run the application to show the basic usage: ~~~ {.bash} idoitcli

First steps

This application caches a lot locally to give you the best user experience. Run the init command:, (*12)

~~~ {.bash} idoitcli init, (*13)


Some simple questions will be asked how to access your i-doit installation. Next step is to create cache files: ~~~ {.bash} idoitcli cache

After that some files will be created in your home directory under ~/.idoitcli/: Each i-doit installation has its own cache files under data/. Your user-defined configuration file is called config.json., (*14)

You may check your current status by running:, (*15)

~~~ {.bash} idoitcli status, (*16)


This gives you some basic information about your i-doit installation, your settings and your user. ## Access your CMDB data This is probably the best part: Read information about objects, their types and even attributes. List all object types: ~~~ {.bash} idoitcli read idoitcli read /

List server objects:, (*17)

~~~ {.bash} idoitcli read server/ idoitcli read server/host.example.net idoitcli read server/.example.net idoitcli read server/host..net idoitcli read server/..net idoitcli read server/host* idoitcli read server/*, (*18)


Show common information about server "host.example.net": ~~~ {.bash} idoitcli read server/host.example.net

Show common information about object identifier "42":, (*19)

~~~ {.bash} idoitcli read 42, (*20)


Show common information about one or more objects by their titles: ~~~ {.bash} idoitcli read *.example.net idoitcli read host.*.net idoitcli read *.*.net idoitcli read host*

List assigned categories:, (*21)

~~~ {.bash} idoitcli read server/host.example.net/, (*22)


Show values from category "model" for this server: ~~~ {.bash} idoitcli read server/host.example.net/model

Show values from category "model" for one or more servers:, (*23)

~~~ {.bash} idoitcli read server/.example.net/model idoitcli read server/host..net/model idoitcli read server/..net/model idoitcli read server/host/model idoitcli read server//model, (*24)


Or just show the name of the model: ~~~ {.bash} idoitcli read server/host.example.net/model/model

List available attributes for category "model":, (*25)

~~~ {.bash} idoitcli read server/host.example.net/model/, (*26)


You may leave the object type empty for specific objects, for example: ~~~ {.bash} idoitcli read host.example.net/model

Notice: These examples work great with unique names. That is why it is common practice to give objects unique titles that are not in conflict with object types and categories., (*27)

Show everything about an object

~~~ {.bash} idoitcli show myserver idoitcli show "My Server" idoitcli show 42, (*28)


## Find your data Find your needle in the haystack called CMDB: ~~~ {.bash} idoitcli search myserver idoitcli search "My Server"

Show the next free IPv4 address

Get the next free IPv4 address for a particular subnet:, (*29)

~~~ {.bash} idoitcli nextip SUBNET, (*30)


`SUBNET` may be the object title or its identifier. ## Auto-generate objects For testing purposes stress your i-doit installation and let the app create thousands of objects, attributes and relations between objects: ~~~ {.bash} idoitcli -c FILE random

There are some examples located under docs/., (*31)

Update the caches

If your CMDB configuration has changed you need to re-create the cache files by running the cache command:, (*32)

~~~ {.bash} idoitcli cache, (*33)


## Playground Perform self-defined API requests – pass request as argument: ~~~ {.bash} idoitcli call '{"version": "2.0","method": "idoit.version","params": {"apikey": "c1ia5q","language": "en"},"id": 1}'

Pipe request:, (*34)

~~~ {.bash} echo '{"version": "2.0","method": "idoit.version","params": {"apikey": "c1ia5q","language": "en"},"id": 1}' | idoitcli call, (*35)


Read request from file: ~~~ {.bash} cat request.txt | idoitcli call

Read request from standard input (double-enter to execute):, (*36)

~~~ {.bash} idoitcli call ~~~, (*37)

Configuration

There are some ways to set your configurations settings:, (*38)

  1. System-wide settings are stored under /etc/idoitcli/config.json.
  2. User-defined settings are stored under ~/.idoitcli/config.json.
  3. Pass your run-time settings by using the options -c or --config.

Keep in mind this order matters. Each file is optional. Any combination is possible. Furthermore, to include even more configuration files you can pass the options -c and --config as often as you like., (*39)

The configuration files are JSON-formatted., (*40)

Contribute

Please, report any issues to our issue tracker. Pull requests and OS distribution packages are very welcomed. For further information, see file CONTRIBUTING.md., (*41)

Copyright (C) 2016-19 Benjamin Heisig, (*42)

Licensed under the GNU Affero GPL version 3 or later (AGPLv3+). This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law., (*43)

List of first names and gender: Copyright (C) 2007-2008 Jörg Michael, licensed under GNU Free Documentation License, (*44)

List of surnames: Copyright (C) Heiko Behrens, lisenced under GNU Lesser General Public License, (*45)

The Versions

24/04 2018
21/09 2017

0.4

0.4.0.0 https://github.com/bheisig/i-doit-cli

Access your CMDB on the command line interface

  Sources   Download

AGPL-3.0+

The Requires

 

The Development Requires

api cli json-rpc i-doit cmdb it documentation

25/07 2017

0.3

0.3.0.0 https://github.com/bheisig/i-doit-cli

Access your CMDB on the command line interface

  Sources   Download

AGPL-3.0+

The Requires

 

The Development Requires

api cli json-rpc i-doit cmdb it documentation

06/04 2017

0.2

0.2.0.0 https://github.com/bheisig/i-doit-cli

Access your CMDB on the command line interface

  Sources   Download

AGPL-3.0+

The Requires

 

The Development Requires

api cli json-rpc i-doit cmdb it documentation

06/02 2017

0.1

0.1.0.0 https://github.com/bheisig/i-doit-cli

Access your CMDB on the command line interface

  Sources   Download

AGPL-3.0+

The Requires

 

The Development Requires

api cli json-rpc i-doit cmdb it documentation