Centreon
Sommaire
- 1 Centreon
- 1.1 Les valeurs par défaut des ACKNOWLEDGE dans les widgets
- 1.2 Vérification config
- 1.3 RRDTools
- 1.4 Check interface LAN windows
- 1.5 Changer le owner des vue custum
- 1.6 Problème lié à des métriques erronées
- 1.7 Trouver un graphe erreur Centreon.
- 1.8 BAM
- 1.9 Trucs
- 1.9.1 Redimensionnement des Services name en configuration.
- 1.9.2 Mysql recheche des status
- 1.9.3 Clear cashe sonde swap
- 1.9.4 Ajout Vues personnalisées
- 1.9.5 Liste les HG des serveurs actif
- 1.9.6 delock model de service
- 1.9.7 Liste des VM pour un Datcenter
- 1.9.8 Check des TimePeriodes en fonction d'un hoste
Centreon[modifier]
Les valeurs par défaut des ACKNOWLEDGE dans les widgets[modifier]
Il est possible de cocher des cases par défaut (sticky, notify...) en éditant le fichier suivant:
/usr/share/centreon/www/widgets/service-monitoring/src/acknowledge.ihtml La différence est l'ajout du mot "checked".
Vérification config[modifier]
/usr/sbin/centengine -v /etc/centreon-engine/centengine.cfg
RRDTools[modifier]
Check fichier rrdfile: rrdtool "nom du fichier .rrd"
log : tailf /var/log/centreon-broker/central-master-rrd.log
Taille des fichiers de rétention des Graphiques Configuration => Centreon => configuration => Output Maximum size of file : 104857600
Check interface LAN windows[modifier]
Permet de lister vos interfaces Windows
/usr/lib64/nagios/plugins/centreon_plugins.pl --plugin=os::windows::snmp::plugin --hostname=X.X.X.X --snmp-version='2c' --snmp-community='XXX' --mode list-interfaces
Vous pourrez ensuite superviser les interfaces via leur ID ou leur nom.
Voici par exemple comment remonter le trafic d'une interface en utilisant son nom:
/usr/lib64/nagios/plugins/centreon_plugins.pl --plugin=os::windows::snmp::plugin --hostname=X.X.X.X --snmp-version='2c' --snmp-community='XXX' --mode interfaces --name --interface 'ethernet_7' --add-traffic
Vous pouvez remonter le traffic toutes les interfaces avec une seule et même en commande en ne spécifiant ni l'ID ni le nom. Vous pouvez également utiliser des regexp dans le nom pour en remonter plusieurs:
/usr/lib64/nagios/plugins/centreon_plugins.pl --plugin=os::windows::snmp::plugin --hostname=X.X.X.X --snmp-version='2c' --snmp-community='XXX' --mode interfaces --name --interface 'ethernet_*' --add-traffic
Changer le owner des vue custum[modifier]
use centreon; select * from custom_views Verifier le n° de la view dans Centreon en passant la sourie sur l'onglet de la vue. select * from custom_view_user_relation where custom_view_id='ID_VIEW'; update custom_view_user_relation set locked='0' where custom_view_id='320' and user_id='ID_NEW_USER'; update custom_view_user_relation set is_owner='1' where custom_view_id='320' and user_id='ID_NEW_USER'; (user_id=19 >adm-snoulot)
Réaffecter les vues d'un user vers un autre[modifier]
Lui supprime les vues.
Lister les vues du user
select V.custom_view_id, V.name from custom_views as V
inner join custom_view_user_relation as C on C.custom_view_id = V.custom_view_id
where C.user_id = <<ID_USER>> and is_owner = 1;
Lister les vues du nouvel user
select V.custom_view_id, V.name from custom_views as V
inner join custom_view_user_relation as C on C.custom_view_id = V.custom_view_id
where C.user_id = <<ID_USER>>;
Comparer les 2 listes et exclure les vues présentes des 2 cotés et leurs changer le owner avec la procédure précédente. Pour les autres utiliser la requête suivante:
update custom_view_user_relation set user_id='<<New_user_ID>>', locked='0', is_owner='1'
where custom_view_id in (<<liste des custom_view_id séparés par des ','>>) and user_id='<<old_USER_ID>>';
Problème lié à des métriques erronées[modifier]
Certains services étaient associés a des métriques incohérentes (métrique de cpu associé à un contrôle de disque, ou une métrique nommée à l'aide d'une apostrophe). Ces métriques ne contient également aucune données. Toutes ces incohérences étaient la source du dysfonctionnement des graphiques.
Voici la méthode utilisée pour résoudre le problème :
Se connecter au serveur MySQL et lister les métriques du service posant problème : Pour un host mysql> select metric_id, metric_name from index_data i, metrics m where i.host_name = 'FRCCEISSUP01' and i.service_description = 'DISK-Usage' and i.id = m.index_id; Pour tout les host mysql>select i.host_name, metric_id, metric_name from index_data i, metrics m where i.service_description = 'DISK-Usage' and i.id = m.index_id and metric_name like '\; *************************** 1. row *************************** metric_id: 35987 metric_name: /var/lib/centreon *************************** 2. row *************************** metric_id: 35986 metric_name: /var/lib/mysql *************************** 3. row *************************** metric_id: 29686 metric_name: / *************************** 4. row *************************** metric_id: 29687 metric_name: /boot *************************** 5. row *************************** metric_id: 29688 metric_name: /dev/shm *************************** 6. row *************************** metric_id: 38748 metric_name: ' 6 rows in set (0.00 sec)
Pour chaque métrique, vérifier que chacune contient des données à l'aide de la requête suivante (où ID METRIC correspond au champs metric_id précédent) :
mysql> SELECT max(ctime) FROM data_bin WHERE id_metric = 'ID METRIC' ;
Si le requête ne renvoie aucune donnée, ou si la métrique se nomme basiquement 'apostrophe", la supprimer comme ci-dessous :
mysql> update metrics set to_delete = '1' where metric_id = 'ID METRIC' ; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0
Ensuite redémarrer le service cbd pour prendre en compte la suppression.
# /etc/init.d/cbd restart Stopping cbd_central-rrd: [ OK ] Stopping cbd_central-broker: [ OK ] Starting cbd_central-rrd: [ OK ] Starting cbd_central-broker: [ OK ]
Trouver un graphe erreur Centreon.[modifier]
Retourne ID service (collone ID)
select * from centreon_storage.index_data where host_name like 'FRCCEISSUP04';
Retourne les lignes du service (si ' supprimer la ligne) (ID = index_id)
Select * from centreon_storage.metrics where index_id like '4530';
Requette graphe disk KO
Affiche toutes les entrées avec une ' dans le nom
select * from centreon_storage.metrics where metric_name = "'";
Clapi[modifier]
Liste des objets et actions Centreon-Clapi v 1.3.1[modifier]
| Objet | Désignation | Désignation |
|---|---|---|
| English | Français | |
| ACL | Access List | Liste d'accès |
| ACLACTION | Actions Access | Gestion des accès sur les actions |
| ACLGROUP | Access Groups | Gestion des groupe d'accès |
| ACLMENU | Menus Access | Gestion des accès aux menus |
| ACLRESOURCE | Ressources Access | Gestion des accès aux ressources |
| CG | Contact Groups | Groupes de contacts |
| CGICFG | cgi Nagios | cgi Nagios |
| CMD | Commands | Commandes |
| CONTACT | Contacts / Users | Contacts / Utilisateurs |
| CONTACTTPL | Contact Template | Modèles de contact |
| HC | Hosts Catégories | Catégories d'hôtes |
| HG | Hosts Groups | Groupes d'hôtes |
| HOST | Hosts | Hôtes |
| HTPL | Hosts Template | Modèle d'hôtes |
| INSTANCE | Poller | Collecteur |
| LDAP | Ldap | Ldap |
| NAGIOSCFG | nagios.cfg Nagios | nagios.cfg Nagios |
| NDO2DBCFG | ndo2db.cfg NDOutils | ndo2db.cfg NDOutils |
| NDOMODCFG | ndomod.cfg NDOutils | ndomod.cfg NDOutils |
| RESOURCECFG | Resources Nagios | Ressources Nagios |
| SC | Services Catégories | Catégories de services |
| SERVICE | Services | Services |
| SG | Services Groups | Groupes de services |
| STPL | Services Template | Modèle de services |
| TIMEPERIOD | Time periods | Périodes temporelles |
| ACTION | OBJET SUPERVISEUR |
|---|---|
| ADD | ACLACTION, ACLGROUP, ACLMENU, ACLRESOURCE, CGICFG, CMD, CONTACT, CONTACTTPL, CG, HTPL, HOST, HG, HC, INSTANCE, LDAP, NAGIOSCFG,NDO2DBCFG, NDOMODCFG, RESOURCECFG, STPL, SERVICE, SG, SC, TIMEPERIOD |
| ADDCONTACT | CG, HTPL, HOST, STPL, SERVICE |
| ADDCONTACTGROUP | ACLGROUP, HTPL, HOST, STPL, SERVICE |
| ADDHOST | STPL |
| ADDHOSTGROUP | HTPL, HOST |
| ADDMEMBER | HG, HC |
| ADDPARENT | HTPL, HOST |
| ADDRESOURCE | ACLGROUP |
| ADDSERVICE | SG, SC |
| ADDSERVICETEMPLATE | SC |
| ADDTEMPLATE | HTPL, HOST |
| APPLYTPL | HOST |
| CFGMOVE | |
| DEL | ACLACTION, ACLGROUP, ACLMENU, ACLRESOURCE, CGICFG, CMD, CONTACT, CONTACTTPL, CG, HTPL, HOST, HG, HC, INSTANCE, LDAP, NAGIOSCFG, NDO2DBCFG, NDOMODCFG, RESOURCECFG, STPL, SERVICE, SG, SC, TIMEPERIOD |
| DELACTION | ACLGROUP |
| DELCONTACT | ACLGROUP, CG, HTPL, HOST, STPL, SERVICE |
| DELCONTACTGROUP | HTPL, HOST, STPL, SERVICE |
| DELEXCEPTION | TIMEPERIOD |
| DELHOST | STPL, SERVICE |
| DELHOSTGROUP | HTPL, HOST |
| DELHOSTGROUPSERVICE | SG |
| DELMACRO | HTPL, HOST, STPL, SERVICE |
| DELMEMBER | HG, HC |
| DELPARENT | HTPL, HOST |
| DELSERVICE | SG, SC |
| DELSERVICETEMPLATE | SC |
| DELTEMPLATE | HTPL, HOST |
| DISABLE | CONTACT, CONTACTTPL, CG, HTPL, HOST |
| ENABLE | CONTACT, CONTACTTPL, CG, HTPL, HOST |
| GETACTION | ACLGROUP |
| GETACLGROUP | ACLACTION, ACLMENU, ACLRESOURCE, CONTACT, CONTACTTPL |
| GETCONTACT | ACLGROUP, CG, HTPL, HOST, STPL, SERVICE |
| GETCONTACTGROUP | ACLGROUP, HTPL, HOST, STPL, SERVICE |
| GETEXCEPTION | TIMEPERIOD |
| GETHOSTGROUP | HTPL, HOST |
| GETHOSTGROUPSERVICE | SG |
| GETMACRO | HTPL, HOST, STPL, SERVICE |
| GETMEMBER | HG, HC |
| GETMENU | ACLGROUP |
| GETPARENT | HTPL, HOST |
| GETRESOURCE | ACLGROUP |
| GETSERVICE | SG, SC |
| GETSERVICETEMPLATE | SC |
| GETTEMPLATE | HTPL, HOST |
| GRANT | ACLACTION, ACLMENU |
| LASTRELOAD | ACL |
| POLLERGENERATE | |
| POLLERLIST | |
| POLLERRELOAD | |
| POLLERESTART | |
| POLLERTEST | |
| RELOAD ACL | |
| REVOKE | ACLACTION, ACLMENU |
| SETCONTACT | ACLGROUP, CG, HTPL, HOST, STPL, SERVICE |
| SETCONTACTGROUP | HTPL, HOST, STPL, SERVICE |
| SETCONTACTTEMPLATE | LDAP |
| SETEXCEPTION | TIMEPERIOD |
| SETHOST | STPL, SERVICE |
| SETHOSTGROUP | HTPL, HOST |
| SETHOSTGROUPSERVICE | SG |
| SETINSTANCE | HTPL, HOST |
| SETMACRO | HTPL, HOST, STPL, SERVICE |
| SETMEMBER | HG, HC |
| SETMENU | ACLGROUP |
| SETPARAM | ACLACTION, ACLGROUP, ACLMENU, ACLRESOURCE, CGICFG, CMD, CONTACT, CONTACTTPL, CG, HTPL, HOST, HG, INSTANCE, LDAP, NAGIOSCFG, NDO2DBCFG, NDOMODCFG, RESOURCECFG, STPL, SERVICE, SG, SC, TIMEPERIOD |
| SETPARENT | HTPL, HOST |
| SETSERVICE | SG |
| SETTEMPLATE | HTPL, HOST |
| SHOW | ACLACTION, ACLGROUP, ACLMENU, ACLRESOURCE, CGICFG, CMD, CONTACT, CONTACTTPL, CG, HTPL, HOST, HG, HC, INSTANCE, LDAP, NAGIOSCFG, NDO2DBCFG, NDOMODCFG, RESOURCECFG, STPL, SERVICE, SG, SC, TIMEPERIOD |
| UNSETACLGROUP | CONTACT, CONTACTTPL |
BAM[modifier]
ClapiBAM[modifier]
Ajout KPI
centreon -u admin -p BZeGqxtGarc -o KPI -a ADD -v 'service;FRCCESGAPA01|CPU;IBM_Cognos_TM1;Weak;Minor;Major'
Trucs[modifier]
Redimensionnement des Services name en configuration.[modifier]
Modifier la ligne 65 du fichier : /usr/share/centreon/www/include/configuration/configObject/service/listService.ihtml
en
Mysql recheche des status[modifier]
Remonte tout les hosts et services en Critique et / ou inconnue[modifier]
SELECT hostgroups.hostgroup_id, hostgroups.name AS HostGroup, hosts.host_id, hosts.name AS Hosts, hosts.state, services.description AS Services, services.state
FROM hostgroups, hosts_hostgroups, hosts, services
WHERE hostgroups.hostgroup_id = hosts_hostgroups.hostgroup_id
AND hosts_hostgroups.host_id = hosts.host_id
AND services.host_id = hosts.host_id
AND hosts.enabled='1'
AND services.enabled='1'
AND hostgroups.name = 'hg-sextant'
AND hosts.state in ('2','3')
OR hostgroups.hostgroup_id = hosts_hostgroups.hostgroup_id
AND hosts_hostgroups.host_id = hosts.host_id
AND services.host_id = hosts.host_id
AND hosts.enabled='1'
AND services.enabled='1'
AND hostgroups.name = 'hg-sextant'
AND services.state in ('2','3');
Remonte tout les hosts et services en Critique et / ou inconnue non Acknowledged[modifier]
SELECT hostgroups.hostgroup_id, hostgroups.name AS HostGroup, hosts.host_id, hosts.name AS Hosts, hosts.state, hosts.acknowledged As Acknowledged, services.description AS Services, services.state,
services.acknowledged As Acknowledged
FROM hostgroups, hosts_hostgroups, hosts, services
WHERE hostgroups.hostgroup_id = hosts_hostgroups.hostgroup_id
AND hosts_hostgroups.host_id = hosts.host_id
AND services.host_id = hosts.host_id
AND hosts.enabled='1'
AND services.enabled='1'
AND hostgroups.name = 'hg-sextant'
AND hosts.state in ('2','3')
AND hosts.acknowledged = 0
OR hostgroups.hostgroup_id = hosts_hostgroups.hostgroup_id
AND hosts_hostgroups.host_id = hosts.host_id
AND services.host_id = hosts.host_id
AND hosts.enabled='1'
AND services.enabled='1'
AND hostgroups.name = 'hg-sextant'
AND services.state in ('2','3')
AND services.acknowledged = 0;
Remonte les indicateurs sans downtime n'y Acknoledged[modifier]
use centreon_storage;
/*select HOST*/ select concat(count(distinct(hosts.name)),':hosts') as 'RESULT' from hosts inner join hosts_hostgroups on hosts.host_id = hosts_hostgroups.host_id inner join hostgroups on hostgroups.hostgroup_id = hosts_hostgroups.hostgroup_id where hosts.enabled=1 and hosts.state != 0 and hosts.acknowledged = 0 and hostgroups.name = 'HG-SEXTANT' and hosts.host_id not in ( select downtimes.host_id from downtimes where actual_end_time is null and cancelled = 0 ) union /*select services*/ select concat(count(distinct(hosts.name)),':services') as 'RESULT' from services inner join hosts on hosts.host_id = services.host_id inner join hosts_hostgroups on services.host_id = hosts_hostgroups.host_id inner join hostgroups on hostgroups.hostgroup_id = hosts_hostgroups.hostgroup_id where hosts.enabled=1 AND services.enabled=1 AND services.state in (2,3) AND services.acknowledged = 0 AND hostgroups.name = 'HG-SEXTANT' AND services.host_id not in ( select downtimes.host_id from downtimes where actual_end_time is null and cancelled = 0 ) AND hosts.acknowledged = 0 AND services.service_id != '26732';
Liste service template[modifier]
select * from service where service_register = '0';
Liste service Template avec commentaire et exemple argument[modifier]
select service_id,service_description,'|',service_comment,'|',command_command_id_arg from service where service_register = '0' and service_description not like 'Generic%' order by service_id ;
Liste des service Template avec description des arguments[modifier]
select service_id,service_description,'|',macro_description from service inner join command_arg_description on cmd_id = command_command_id where service_register = '0' and service_description not like 'Generic%' order by service_id ;
Check catégorie service[modifier]
SELECT service_id, service_description FROM service WHERE service_id NOT IN (SELECT service_service_id FROM service_categories_relation) AND service_register = '1';
Clear cashe sonde swap[modifier]
sur le poller où est testé le host, supprimer le fichier /var/lib/centreon/centplugins/remote_storage_cache_$HOST$
Ajout Vues personnalisées[modifier]
Récuperation widget_id
select * from widgets where title like 'Proc%' ;
Récuperation custom_view_id
select custom_view_id from widget_views where widget_id = $widget_id$ ;
Récuperation contact_id
select contact_alias, contact_id from contact where contact_alias like '%user%';
Création view pour un utilisateur
insert into custom_view_user_relation (custom_view_id,user_id,locked,is_owner,is_consumed) values($custom_view_id$,$user_id$,1,0,1);
Liste les HG des serveurs actif[modifier]
select h.host_id,h.host_name,h.host_activate, HG.hg_name from host as h inner join hostgroup_relation as HR on HR.host_host_id = h.host_id inner join hostgroup as HG on HG.hg_id = HR.hostgroup_hg_id where h.host_activate = '1';
delock model de service[modifier]
select * from service where service_register = '0' and service_description like '%'; update service set service_locked=0 where service_description like '%';
Liste des VM pour un Datcenter[modifier]
/usr/lib/centreon/plugins/centreon_vmware_connector_client.pl --plugin=apps::vmware::connector::plugin --mode getmap --container='DC1_VDI' --connector-hostname localhost
Check des TimePeriodes en fonction d'un hoste[modifier]
SQL select concat( hosts.name,';',services.display_name,';check_period;',hosts.check_period) from services inner join hosts on services.host_id = hosts.host_id where services.check_period != hosts.check_period and services.check_period ='24X7;
Copier le résultat dans un fichier TMP. Lancer une requête CLAPI: ./ADD_Centreon.sh admin BZeGqxtGarc /tmp/tp_update.txt SERVICE setparam
Recharger Centreon. Faire check EZV