Monthly Archive for June, 2009

Icinga´s very first presentation

Just on Tuesday, Icinga made its first on stage appearance at the Nagios Community Workshop in Kassel. Hendrik introduced Icinga in front of a crowded room, supported by an almost complete Icinga team. From introducing the team members and their respective project roles to the details of Icinga’s core, IDO and libdbi database, the presentation was well received. So well in fact, that we made our first Icinga fanshirt sighting. Cheers to Wolfgang:

icinga_tshirt icinga_presentation

Beyond his merchandising contributions, Wolfgang is particularly active in Icinga documentation which was announced to be available in Docbook for ease of translation. Much to our delight were the offers of translation assistance and great suggestions in the Q&A for a SOAP, REST or JSON interface integration which can be queried by other applications. To all we will keep updated with our mailing list.

Finally, Hendrik let on that the Icinga core was almost finished with the API about 75% of the way there, on target for the October release. All in all, the Kassel workshop was fantastic and Icinga survived without a hint of stage fright. Well ok, maybe a little :-)

  • Share/Bookmark

Icinga Demosystem updated

Together with the release of Icinga 0.8.1 yesterday, we also updated our demo system. To try Icinga without installing it, please go to http://demo.icinga.org and login with username “guest” and password “guest”.

If you have any questions or ideas, let us know on the mailing lists.

  • Share/Bookmark

Icinga 0.8.1 released

Hi there,

we are happy to inform you that the latest Icinga Release V 0.8.1 is
out right now. Just follow the download button on: http://www.icinga.org/

The next release is planned for August, 12th, 2009.

Until then feel free to contribute or provide us with feedback on the
mailing lists, helping hands and vivid minds are always very welcome.

Cheers
Your Icinga Team

  • Share/Bookmark

Vote for your favorite database

We are planing to provide other databases than MySQL within the next Icinga Versions. Would you like to vote for your favourite database so that the Icinga Project fits your needs.

Database implementation needed for Icinga?

View Results

Loading ... Loading ...
  • Share/Bookmark

Using Icinga-API for fun and profit – IDO basics – part 1

Since Icinga-API is finally capable of supporting developers with
data we are going to blog a little to make coders out there feel
comfortable with this wonderful piece of work.

Here you can see the current progress of the API and related interfaces:

  • API overall: 50%
  • IDO interface: 50%
  • file interface: 25%

If you want to fetch data from the IDO you have to take care about the
following requirements:

  • PHP5
  • web-server module for PHP PDOs

Enough talking… let’s see some code!

1.) configuration

Configuration is simply done by using an associative array.

$idoConfig = array (
	‘type’ 		=><Type of database>,
	‘host’ 		=><Database hostname>,
	‘database’ 	=><Databasename>,
	‘user’ 		=><Username>,
	‘password’ 	=><password>,
	‘persistent’ 	=> <true | false>,
	‘table_prefix’ 	=><table prefix>,
);

Example:

$idoConfig = array (
	‘type’ 		=>mysql,
	‘host’ 		=> ‘localhost’,
	‘database’ 	=> ‘ido’,
	‘user’ 		=> ‘idouser’,
	‘password’ 	=> ‘idopassword’,
	‘persistent’ 	=> true,
	‘table_prefix’ 	=> ‘icinga_’,
);

2.) fetching data: hostnames and corresponding states
Create an instance of class IcingaApi:

$api = IcingaApi::getConnection(IcingaApi::CONNECTION_IDO, $idoConfig);

Create your search:

$apiRes = $api->createSearch()
->setSearchTarget(IcingaApi::TARGET_HOST)
->setResultColumns(array(’HOST_NAME’, ‘HOST_CURRENT_STATE’))
->fetch();

By using setSearchFilter() you can define filters to narrow down the result set:

$apiRes = $api->createSearch()
->setSearchTarget(IcingaApi::TARGET_HOST)
->setResultColumns(array(’HOST_NAME’, ‘HOST_CURRENT_STATE’))
->setSearchFilter(HOST_NAME, ‘Switch%, IcingaApi::MATCH_LIKE)
->fetch();

3.) processing result

foreach($apiRes as $apiHandle){
	echo ‘Host ‘.$apiHandle->host_name.’ has state ‘.$apiHandle->host_current_state.<br />;
}

Output without filter:
Host localhost has state 0
Host MySql has state 0
Host router-01 has state 0
Host windows100 has state 0
Host Apache_01 has state 0

Output with filters:
Host switch70 has the current state 0
Host switch71 has the current state 0
Host switch72 has the current state 0
Host switch73 has the current state 0
Host switch74 has the current state 0
Host switch75 has the current state 0
Host switch76 has the current state 0
Host switch77 has the current state 0

4.) complete code without use of filters:

<?
// Path to icinga api file
$apiFile = ‘icinga-api/IcingaApi.php’;
 
// Database connection
$idoConfig = array (
	‘type’ 		=>mysql,
	‘host’ 		=> ‘localhost’,
	‘database’ 	=> ‘ido’,
	‘user’ 		=> ‘idouser’,
	‘password’ 	=> ‘idopass’,
	‘persistent’ 	=> true,
	‘table_prefix’ 	=> ‘icinga_’,
);
 
// Include required files
require_once($apiFile);
 
// Instance the class
$api = IcingaApi::getConnection(IcingaApi::CONNECTION_IDO, $idoConfig);
 
// Create search
$apiRes = $api->createSearch()
->setSearchTarget(IcingaApi::TARGET_HOST)
->setResultColumns(array(’HOST_NAME’, ‘HOST_CURRENT_STATE’))
->fetch();
 
// Create output
foreach($apiRes as $apiHandle){
	echo ‘Host ‘.$apiHandle->host_name.’ has the current state ‘.$apiHandle->host_current_state.<br />;
}
?>

That’s all folks but there’s more to follow!

Please have a look at the git repository for further information:
https://git.icinga.org/index?p=icinga-api.git;a=summary

Have fun!

  • Share/Bookmark