forked from centreon/centreon-archived
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue WEB-461 centreonConsole for global resource
- Loading branch information
Toufik MECHOUET
committed
Jun 24, 2015
1 parent
acdcac2
commit d96cf30
Showing
8 changed files
with
303 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
Resource | ||
======== | ||
|
||
Overview | ||
-------- | ||
|
||
Object name: **centreon-configuration:Resource** | ||
|
||
Available parameters are the following: | ||
|
||
=================== =========================== | ||
Parameter Description | ||
=================== =========================== | ||
*--resource-name** Resource name | ||
|
||
--resource-line Resource description | ||
|
||
--resource-pollers Slug name of poller | ||
|
||
--resource-comment Resource comment | ||
|
||
--resource-activate Enable (0 or 1) | ||
|
||
=================== =========================== | ||
|
||
List | ||
---- | ||
|
||
In order to list resource, use **list** action:: | ||
|
||
./centreonConsole centreon-configuration:Resource:list | ||
id;name;slug;line;activate;comment;organization;pollers | ||
1;command;command;polklfd;1;dfdfdfdf;1;central | ||
2;switch;switch;ma ligne;0;rere fdfd;1;central | ||
10;resource1;resource1;;;rere fdfd;1;central | ||
14;$USER1$;user1-2;$1 dfdf/lk $5;1;rere fdfd;1;central | ||
|
||
|
||
|
||
Columns are the following: | ||
|
||
================== =========================== | ||
Column Description | ||
================== =========================== | ||
id Resource id | ||
|
||
name Resource name | ||
|
||
slug Slug of resource | ||
|
||
line Resource description | ||
|
||
comment Comment of the resource | ||
|
||
activate Enable (0 or 1) | ||
|
||
organization Organization | ||
|
||
poller Identifiant of poller | ||
|
||
================== =========================== | ||
|
||
Show | ||
---- | ||
|
||
In order to show a resource, use **show** action:: | ||
|
||
./centreonConsole centreon-configuration:Resource:show --resource "switch" | ||
id: 13 | ||
name: $USER1$ | ||
resource slug: user1 | ||
resource line: $1 dfdf/lk $5 | ||
resource comment: rere fdfd | ||
resource activate: 1 | ||
organization: 1 | ||
poller: 1 | ||
|
||
Create | ||
------ | ||
|
||
In order to create a resource, use **create** action:: | ||
|
||
./centreonConsole centreon-configuration:Resource:create --resource-name "$USER1$" --resource-activate 1 --resource-pollers 'central' --resource-comment 'comment' --resource-line '/usr/lib/nagios/plugins' | ||
Object successfully created | ||
|
||
Update | ||
------ | ||
|
||
In order to update a resource, use **update** action:: | ||
|
||
./centreonConsole centreon-configuration:Resource:update --resource 'user1' --resource-name "$USER1$" --resource-activate 1 --resource-pollers 'central' --resource-comment 'comment' --resource-line '/usr/lib/nagios/plugins' | ||
Object successfully updated | ||
|
||
Delete | ||
------ | ||
|
||
In order to delete a resource, use **delete** action:: | ||
|
||
./centreonConsole centreon-configuration:Resource:delete --resource "linkDown" | ||
Object successfully deleted |
81 changes: 81 additions & 0 deletions
81
modules/CentreonConfigurationModule/api/internal/resourceManifest.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
{ | ||
"liteAttributesSet" : "resource_id,resource_name,resource_slug,resource_line,resource_activate,resource_comment,pollers,organization_id", | ||
"repository" : "\\CentreonConfiguration\\Repository\\ResourceRepository", | ||
"objectBaseUrl" : "resource", | ||
"objectClass" : "\\CentreonConfiguration\\Models\\Resource", | ||
"attributesMap" : { | ||
"id" : "resource_id", | ||
"name" : "resource_name", | ||
"slug" : "resource_slug", | ||
"line" : "resource_line", | ||
"activate" : "resource_activate", | ||
"comment" : "resource_comment", | ||
"pollers" : "name", | ||
"organization" : "organization_id" | ||
}, | ||
"externalAttributeSet" : [ | ||
{ | ||
"type": "pollers", | ||
"fields": "name", | ||
"link": "relation", | ||
"objectClass": "resource_pollers", | ||
"group": false | ||
}, | ||
{ | ||
"type": "resource_pollers", | ||
"fields": "id,slug", | ||
"message": "The poller is not in database", | ||
"link": "simple", | ||
"objectClass": "\\CentreonConfiguration\\Models\\Poller", | ||
"group": false | ||
} | ||
], | ||
"relationMap" : { | ||
"resource_pollers" : "\\CentreonConfiguration\\Models\\Relation\\Resource\\Poller" | ||
}, | ||
"options" : { | ||
"showAction" : { | ||
"resource" : { | ||
"functionParams" : "object", | ||
"help": "The resource", | ||
"type": "string", | ||
"toTransform" : "resource", | ||
"multiple" : false, | ||
"required" : true | ||
} | ||
}, | ||
"createAction" : { | ||
|
||
}, | ||
"updateAction" : { | ||
"resource" : { | ||
"functionParams" : "object", | ||
"help": "The resource", | ||
"type": "string", | ||
"toTransform" : "resource", | ||
"multiple" : false, | ||
"required" : true | ||
} | ||
}, | ||
"deleteAction" : { | ||
"resource" : { | ||
"functionParams" : "object", | ||
"help": "The resource", | ||
"type": "string", | ||
"toTransform" : "resource", | ||
"multiple" : false, | ||
"required" : true | ||
} | ||
}, | ||
"duplicateAction" : { | ||
"resource" : { | ||
"functionParams" : "object", | ||
"help": "The resource", | ||
"type": "string", | ||
"toTransform" : "resource", | ||
"multiple" : false, | ||
"required" : true | ||
} | ||
} | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
modules/CentreonConfigurationModule/commands/ResourceCommand.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
/* | ||
* Copyright 2005-2015 CENTREON | ||
* Centreon is developped by : Julien Mathis and Romain Le Merlus under | ||
* GPL Licence 2.0. | ||
* | ||
* This program is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU General Public License as published by the Free Software | ||
* Foundation ; either version 2 of the License. | ||
* | ||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY | ||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A | ||
* PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along with | ||
* this program; if not, see <http://www.gnu.org/licenses>. | ||
* | ||
* Linking this program statically or dynamically with other modules is making a | ||
* combined work based on this program. Thus, the terms and conditions of the GNU | ||
* General Public License cover the whole combination. | ||
* | ||
* As a special exception, the copyright holders of this program give CENTREON | ||
* permission to link this program with independent modules to produce an executable, | ||
* regardless of the license terms of these independent modules, and to copy and | ||
* distribute the resulting executable under terms of CENTREON choice, provided that | ||
* CENTREON also meet, for each linked independent module, the terms and conditions | ||
* of the license of that module. An independent module is a module which is not | ||
* derived from this program. If you modify this program, you may extend this | ||
* exception to your version of the program, but you are not obliged to do so. If you | ||
* do not wish to do so, delete this exception statement from your version. | ||
* | ||
* For more information : [email protected] | ||
* | ||
*/ | ||
namespace CentreonConfiguration\Commands; | ||
|
||
use Centreon\Api\Internal\BasicCrudCommand; | ||
|
||
/** | ||
* | ||
*/ | ||
class ResourceCommand extends BasicCrudCommand | ||
{ | ||
/** | ||
* | ||
* @var type | ||
*/ | ||
public $objectName = 'resource'; | ||
|
||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 54 additions & 49 deletions
103
modules/CentreonConfigurationModule/install/forms/Resource.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,60 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<forms> | ||
<form name="resource_form"> | ||
<route>/centreon-configuration/resource/update</route> | ||
<redirect>1</redirect> | ||
<redirect_route>/centreon-configuration/resource</redirect_route> | ||
<section name="General"> | ||
<block name="General information"> | ||
<field name="resource_name" label="Name" default_value="" advanced="0" type="text" parent_field="" mandatory="1"> | ||
<validators> | ||
<validator rules="remote" serverside="centreon-main.unique" /> | ||
</validators> | ||
<help>Name which will be used for identifying the resource.</help> | ||
<form name="resource_form"> | ||
<route>/centreon-configuration/resource/update</route> | ||
<redirect>1</redirect> | ||
<redirect_route>/centreon-configuration/resource</redirect_route> | ||
<section name="General"> | ||
<block name="General information"> | ||
<field name="resource_name" label="Name" default_value="" advanced="0" type="text" parent_field="" mandatory="1"> | ||
<validators> | ||
<validator rules="remote" serverside="centreon-main.unique" /> | ||
</validators> | ||
<help>Name which will be used for identifying the resource.</help> | ||
</field> | ||
<field name="resource_line" label="MACRO Expression" default_value="" advanced="0" type="text" parent_field="" mandatory="0"> | ||
<field name="resource_line" label="MACRO Expression" default_value="" advanced="0" type="text" parent_field="" mandatory="0"> | ||
<help>A short description of the resource.</help> | ||
</field> | ||
<field name="resource_pollers" label="Linked instances" default_value="" advanced="0" type="select" parent_field="" mandatory="0"> | ||
<attributes> | ||
<object_type>object</object_type> | ||
<defaultValuesRoute>/centreon-configuration/poller/formlist</defaultValuesRoute> | ||
<listValuesRoute>/centreon-configuration/resource/[i:id]/poller</listValuesRoute> | ||
<multiple>true</multiple> | ||
<ordered>false</ordered> | ||
</attributes> | ||
<help>This is the list of all pollers using this resource.</help> | ||
</field> | ||
<field name="resource_comment" label="Comment" default_value="" advanced="0" type="textarea" parent_field="" mandatory="0"> | ||
<help>This will be executed by Centreon Engine, note that this line contains macros that will be replaced before execution. e.g: centreon_resource_perl.</help> | ||
</field> | ||
<field name="resource_activate" label="Status" default_value="1" advanced="0" type="radio" parent_field="" mandatory="1"> | ||
<attributes> | ||
<choices> | ||
<Enabled>1</Enabled> | ||
<Disabled>0</Disabled> | ||
</choices> | ||
</attributes> | ||
<help>Whether or not the resource is enabled.</help> | ||
</field> | ||
</block> | ||
</section> | ||
</form> | ||
<wizard name="add_resource"> | ||
<route>/centreon-configuration/resource/add</route> | ||
<step name="General"> | ||
<field name="resource_name" mandatory="1"></field> | ||
<field name="resource_line" mandatory="1"></field> | ||
<field name="resource_comment" mandatory="0"></field> | ||
<field name="resource_activate" mandatory="1"></field> | ||
</step> | ||
<step name="Relation"> | ||
<field name="resource_pollers" mandatory="0"></field> | ||
</step> | ||
</wizard> | ||
<field name="resource_pollers" label="Linked instances" default_value="" advanced="0" type="select" parent_field="" mandatory="0"> | ||
<attributes> | ||
<object_type>object</object_type> | ||
<defaultValuesRoute>/centreon-configuration/poller/formlist</defaultValuesRoute> | ||
<listValuesRoute>/centreon-configuration/resource/[i:id]/poller</listValuesRoute> | ||
<multiple>true</multiple> | ||
<ordered>false</ordered> | ||
</attributes> | ||
<help>This is the list of all pollers using this resource.</help> | ||
</field> | ||
<field name="resource_comment" label="Comment" default_value="" advanced="0" type="textarea" parent_field="" mandatory="0"> | ||
<help>Comment of the resource.</help> | ||
</field> | ||
<field name="resource_activate" label="Status" default_value="1" advanced="0" type="radio" parent_field="" mandatory="1"> | ||
<attributes> | ||
<choices> | ||
<Enabled>1</Enabled> | ||
<Disabled>0</Disabled> | ||
</choices> | ||
</attributes> | ||
<help>Whether or not the resource is enabled.</help> | ||
<validators> | ||
<validator rules="remote" serverside="core.AuthorizedValues"> | ||
<argument name="values">0,1</argument> | ||
</validator> | ||
</validators> | ||
</field> | ||
</block> | ||
</section> | ||
</form> | ||
<wizard name="add_resource"> | ||
<route>/centreon-configuration/resource/add</route> | ||
<step name="General"> | ||
<field name="resource_name" mandatory="1"></field> | ||
<field name="resource_line" mandatory="1"></field> | ||
<field name="resource_comment" mandatory="0"></field> | ||
<field name="resource_activate" mandatory="1"></field> | ||
</step> | ||
<step name="Relation"> | ||
<field name="resource_pollers" mandatory="0"></field> | ||
</step> | ||
</wizard> | ||
</forms> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters