summaryrefslogtreecommitdiffstats
path: root/plugins/discovery.py
Commit message (Collapse)AuthorAgeFilesLines
* server-addons: pep8 fixes.Darshan N2015-08-161-1/+1
| | | | | | | Change-Id: I920ed33f0e257dd741d1c6df39b46efebe9abd02 Signed-off-by: Darshan N <dnarayan@redhat.com> Reviewed-on: http://review.gluster.org/11836 Reviewed-by: Sahina Bose <sabose@redhat.com>
* autoconf: validate the nagios server address in auto-configRamesh Nachimuthu2015-05-191-17/+17
| | | | | | | | | | | | | | | | | | | | | Currently Nagios server address entered by the user during auto config was not being verified. This patch helps to verify the address entered by the user. If IP address is given as the nagios server address then it checks the pattern and verifies that it is mapped to one of the non loopback device in the host If user enters fqdn name, then it tries to resolve it, also it verifies that resolved IP address maps to one of the non loopback device in the host. Bug-Url: https://bugzilla.redhat.com/1127657 Change-Id: I88d67cc6d8fa05f2934922fbc0d8e757b1d73e43 Signed-off-by: Ramesh Nachimuthu <rnachimu@redhat.com> Reviewed-on: http://review.gluster.org/7740 Reviewed-by: darshan n <dnarayan@redhat.com> Reviewed-by: Sahina Bose <sabose@redhat.com>
* autoconf: unregister the temp_node1 instead of deleting it.Ramesh Nachimuthu2014-11-171-13/+14
| | | | | | | | | | | | | | | | | | | | | | | Unregistering the temp_node1 instead of deleting it while configuring nagios . new field 'register' will be added to temp_node1 and its services with value 0, so that it won't be considered by nagios. If both files, temp_node1.cfg and temp_node1.cfg.sample are present during upgrade then we will remove the file temp_node1.cfg.sample and add the 'register 0' flag to definitions in temp_node1.cfg file. Bug-Url: https://bugzilla.redhat.com/1162446 Bug-Url: https://bugzilla.redhat.com/1162443 Bug-Url: https://bugzilla.redhat.com/1115387 Change-Id: I3c76d6c6a9a9e411315859e07238a7902ddd2380 Signed-off-by: Ramesh Nachimuthu <rnachimu@redhat.com> Reviewed-on: http://review.gluster.org/9123 Reviewed-by: Kanagaraj M <kmayilsa@redhat.com> Reviewed-by: Sahina Bose <sabose@redhat.com>
* autoconf: fix the error message for duplicate hostRamesh Nachimuthu2014-10-291-1/+1
| | | | | | | | | | | Modified the error message for the case when there is already a host with same name existing. Change-Id: I2e6b5ef80baa0a45d94f069980ac81b1fbd8c058 Bug-Url: https://bugzilla.redhat.com/1112201 Signed-off-by: Ramesh Nachimuthu <rnachimu@redhat.com> Reviewed-on: http://review.gluster.org/8658 Reviewed-by: Sahina Bose <sabose@redhat.com>
* autoconfig: avoid renaming hostnames in nagiosRamesh Nachimuthu2014-10-291-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Auto Config tries to use the output of 'hostname' command as a host_name for node in nagios. But if the hostnames are not unique, then it uses IP Address as node_name name in nagios. If after removal of a node, hostnames becomes unique then auto config renames all the host configuration in nagios to their hostnames instead of ip address. It creates multiples issues like removing all the nodes, loss of time series data and unnecessary confusion to the user. Fixing this issue by retaining the perviously configured host names always by going through the host uuid. So if duplication comes after a node addition then only that node will be configured with ip address as host_name but all other existing hosts will not be touched. Similary, even though there is no duplication after the removal of a node with duplicate name, auto config will retain the previously configured hostnames (which are ip addresss becasue there was a hostname duplication earlier) instead of renaming. Change-Id: I0abef47e2e495a591dd3901d2b1766a04c59a701 Bug-Url: https://bugzilla.redhat.com/1139228 Bug-Url: https://bugzilla.redhat.com/1139505 Signed-off-by: Ramesh Nachimuthu <rnachimu@redhat.com> Reviewed-on: http://review.gluster.org/8699 Reviewed-by: darshan n <dnarayan@redhat.com> Reviewed-by: Sahina Bose <sabose@redhat.com>
* autoconf: verify the configurations before restarting nagiosRamesh Nachimuthu2014-09-151-8/+26
| | | | | | | | | | | | | Verify the Nagios configuration before restarting the nagios server. It helps in accidently stoping the nagios server because of config error. Change-Id: I8c7cb5663bf42d73812577e9b162434cb2ecfdfe Bug-Url: https://bugzilla.redhat.com/1138943 Signed-off-by: Ramesh Nachimuthu <rnachimu@redhat.com> Reviewed-on: http://review.gluster.org/8131 Reviewed-by: Shubhendu Tripathi <shtripat@redhat.com> Reviewed-by: Sahina Bose <sabose@redhat.com>
* fix pep8 errorsTimothy Asir Jeyasingh2014-06-261-55/+55
| | | | | | | | Change-Id: Ia0f570dfb74d6c41484e509f704df12d3b96db17 Signed-off-by: Timothy Asir Jeyasingh <tjeyasin@redhat.com> Reviewed-on: http://review.gluster.org/8161 Tested-by: Timothy Asir <tim.gluster@gmail.com> Reviewed-by: Shubhendu Tripathi <shtripat@redhat.com>
* autoconfig: fixing issue in finding duplicate hostsRamesh Nachimuthu2014-06-161-4/+6
| | | | | | | | | | | | | | When a host is in disconnected status, we will not communicate with the host and will not be able to get the hostname. So we don't need to consider those disconnected hosts in finding duplicate hosts. Change-Id: Ie3fbef03635d46fd9d95e5b1f4df7435e800c55d Bug-Url: https://bugzilla.redhat.com/1109723 Signed-off-by: Ramesh Nachimuthu <rnachimu@redhat.com> Reviewed-on: http://review.gluster.org/8074 Reviewed-by: Sahina Bose <sabose@redhat.com> Tested-by: Sahina Bose <sabose@redhat.com>
* autoconfig: Handle sync host deletion in auto config.Ramesh Nachimuthu2014-06-111-0/+15
| | | | | | | | | | | | | | | | | Auto config uses a user configured host to periodically sync the gluster configuration. If the host used for sync itself is removed from the cluster, then auto config will detect this as all other hosts are getting removed from cluster. Fixing this issue by not removing all the hosts except sync host in auto mode. User has to run the auto config manually with differnt host to remove sync host. Change-Id: I18fa51b4ed9674264ea8b2d2f615f7680a59c04e Bug-Url: https://bugzilla.redhat.com/1107998 Signed-off-by: Ramesh Nachimuthu <rnachimu@redhat.com> Reviewed-on: http://review.gluster.org/8024 Reviewed-by: Sahina Bose <sabose@redhat.com>
* nagios-server-addons: Fix for dummy config file issue.ndarshan2014-06-031-0/+13
| | | | | | | | | | | | | | | | | | | This patch replaces the configfile node1.cfg(gluster-host) by temp_node1.cfg which is of type linux-server having service PING. And this dummy config file is renamed to temp_node1.cfg.sample during auto-discovery as it is not needed after we configure actual hosts. Also this patch sets the config variable allow_empty_hostgroup_assignment to 1, which is needed for nagios to allow declaration of empty host-group with services. Change-Id: I03cc54975f5ff5857f8d82b66110e049e4195009 Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1091236 Signed-off-by: ndarshan <dnarayan@redhat.com> Reviewed-on: http://review.gluster.org/7952 Reviewed-by: Kanagaraj M <kmayilsa@redhat.com> Reviewed-by: Shubhendu Tripathi <shtripat@redhat.com> Reviewed-by: Sahina Bose <sabose@redhat.com>
* autoconfig: refactoring and adding test casesRamesh Nachimuthu2014-05-281-28/+31
| | | | | | | | | | | | Refactoring the code to use constants for repeatedly used strings and add some test case. Change-Id: I7c88231a51ceea3b1cc94223018ecc704b657512 Bug-Url: https://bugzilla.redhat.com/1099093 Bug-Url: https://bugzilla.redhat.com/1099328 Signed-off-by: Ramesh Nachimuthu <rnachimu@redhat.com> Reviewed-on: http://review.gluster.org/7883 Reviewed-by: Sahina Bose <sabose@redhat.com>
* autoConfig:Support for force syncing specific fields in service configRamesh Nachimuthu2014-05-281-1/+22
| | | | | | | | | | | | | | | | | | | Currently Auto-config won't update any service configurations in nagios. It always adds or deletes services configurations but no update. With the following bugs we have the need to update few values in service configuration. Hence adding the support to update specific fields in service config. All the fields in the list config_generator.SERVICE_FIELDS_TO_FORCE_SYNC will be force updated during auto configuration. With this patch only '_VOL_NAME' and 'notes' field will be updated. Change-Id: I6003ade375d2f0d6e7dee97ef05f7a9af4ce6ffd Bug-Url: https://bugzilla.redhat.com/1099093 Bug-Url: https://bugzilla.redhat.com/1099328 Signed-off-by: Ramesh Nachimuthu <rnachimu@redhat.com> Reviewed-on: http://review.gluster.org/7868 Reviewed-by: Sahina Bose <sabose@redhat.com>
* autoconfig: delete only auto generated configs in auto-configRamesh Nachimuthu2014-05-231-0/+4
| | | | | | | | | | | | | | | | Currently auto-config removes all the custom services and hosts defined by user. So with this issue, user can't add any extra services on top of services generated by auto-config. Adding a custom filed '__GENERATED_BY_AUTOCONFIG' as part of all the services added by auto-config. Only services with the above custom field will be deleted by auto-config when respective volume/brick/ is removed in gluster. Change-Id: I85d3d971d3b99f52ff603044f7f974746e247737 Signed-off-by: Ramesh Nachimuthu <rnachimu@redhat.com> Reviewed-on: http://review.gluster.org/7750 Reviewed-by: Sahina Bose <sabose@redhat.com>
* autoconf:check if host is already being monitoredRamesh Nachimuthu2014-05-221-0/+20
| | | | | | | | | | | | | | | User may have a host configuration defined already for the host being discovered by auto config. So checking if the host already exist as part of another cluster before auto configuring. Same issue may happen when user gives a differnt cluster name in autoconfig after running for the first time. Change-Id: Ia3dbf8e4895cfe4d24e99eda49313b44dbd25aef Bug-Url: https://bugzilla.redhat.com/1085320 Signed-off-by: Ramesh Nachimuthu <rnachimu@redhat.com> Reviewed-on: http://review.gluster.org/7755 Reviewed-by: Sahina Bose <sabose@redhat.com>
* autoconfig: fix for timeout param issue in auto modeRamesh Nachimuthu2014-05-201-1/+1
| | | | | | | | | | | Passing the timeout parameter to writeDelta() in auto mode also. Change-Id: Ia18ae225e5b6e239b4d4b09357d51844d5a868f5 Signed-off-by: Ramesh Nachimuthu <rnachimu@redhat.com> Reviewed-on: http://review.gluster.org/7817 Reviewed-by: Shubhendu Tripathi <shtripat@redhat.com> Reviewed-by: Kanagaraj M <kmayilsa@redhat.com> Reviewed-by: Timothy Asir <tim.gluster@gmail.com>
* nagios-server-addons: NRPE command with timeoutShubhendu Tripathi2014-05-201-47/+39
| | | | | | | | | | | | | | | | | | | | | | | Introduced a utility method to return a NRPE base command with timeout set externally. Currently if a plugin internally executes NRPE to get the details from the node, there is no mechanism that timeout could be set to more than 10 sec. This method provides the NRPE command with timeout (if passed). This is required for some of the NRPE calls where gluster commands get executed and they might take more time. All the plugins, which execute a NRPE within, can provide optional command line argument for timeout, and same can be used for forming the proper NRPE call with timeout value. Change-Id: Id97624df743664a320a585acc4a85cfcf64d0a07 Signed-off-by: Shubhendu Tripathi <shtripat@redhat.com> Reviewed-on: http://review.gluster.org/7682 Reviewed-by: Sahina Bose <sabose@redhat.com> Tested-by: Sahina Bose <sabose@redhat.com>
* autoconf: don't remove disconnected hosts from nagiosRamesh Nachimuthu2014-05-121-24/+37
| | | | | | | | | | | | | | | | | | | | | | | | | Currently auto-config removes all the hosts with disconnected status in 'peer status' from nagios configuration. But that is not correct as a host can goto disconnected status for many differnt reasons and we should not remove the configuration. Similarly disconnected hosts need not be added to nagios configuration during auto discovery. Fixing this by ingnoring all the disconnected hosts in delta calculation. Note: Host name can't be used to identify disconnected hosts as we may not be able to communicate the disconnected host to get the host name. Hence Host UUID in peer status is used to intentify the host. Bug-Url: https://bugzilla.redhat.com/1091170 Change-Id: I3fe730d2545f8cbc8224c576712b09bb4c16e712 Signed-off-by: Ramesh Nachimuthu <rnachimu@redhat.com> Reviewed-on: http://review.gluster.org/7677 Reviewed-by: Sahina Bose <sabose@redhat.com>
* autoconf: handle exceptions in nrpe commandsRamesh Nachimuthu2014-05-041-18/+25
| | | | | | | | | Handling the exceptions and failure from NRPE commands. Change-Id: I36cba2d6adf8484ba134ad3f7aec77437ba07857 Signed-off-by: Ramesh Nachimuthu <rnachimu@redhat.com> Reviewed-on: http://review.gluster.org/7659 Reviewed-by: Sahina Bose <sabose@redhat.com>
* autoconf: send email notification for auto syncRamesh Nachimuthu2014-05-021-11/+33
| | | | | | | | | | | | | | | | Sending a cusotm email notification whenever nagios configurations are changed by auto-config service. note: By default, nagios mail notification command 'notify-service-by-email' doesn't include the comments macro. But in auto config, all the changes are sent as comment to the custom notificiation command. Hence nagios command 'notify-service-by-email' should be changed to include the macro '$NOTIFICATIONCOMMENT$' as part of mail template. Change-Id: Ie5dd23578e08fbc757c46a884a79923ff3c403b2 Signed-off-by: Ramesh Nachimuthu <rnachimu@redhat.com> Reviewed-on: http://review.gluster.org/7626 Reviewed-by: Sahina Bose <sabose@redhat.com>
* autoconf: discover volume list and info separatelyRamesh Nachimuthu2014-05-021-2/+16
| | | | | | | | | | | | | NRPE doesn't support transfering large junk of data as a result. Hence we have to discover the volume details one by one. First fetch the volume list using 'discover_volume_list' NRPE command then fetch the brick details of volume one by one using 'discover_volume_info' NRPE command Change-Id: I2cd3c2309ffa2f1bf5c271e06dd03ade75bf5d92 Signed-off-by: Ramesh Nachimuthu <rnachimu@redhat.com> Reviewed-on: http://review.gluster.org/7631 Reviewed-by: Sahina Bose <sabose@redhat.com>
* autoconf:fix for pep8 errorRamesh Nachimuthu2014-05-011-3/+3
| | | | | | | | | fixing a pep8 error in discovery.py Change-Id: I2cbacea466e0d178636c00d7212d107fd82f2719 Signed-off-by: Ramesh Nachimuthu <rnachimu@redhat.com> Reviewed-on: http://review.gluster.org/7628 Reviewed-by: Kanagaraj M <kmayilsa@redhat.com>
* autoconf: fix for empty services in hosts.Ramesh Nachimuthu2014-04-301-6/+6
| | | | | | | | | | There were some key errors when there is no service in the hosts. It fixed by using dict.get(). Change-Id: Ic479f5335240c772a520e4ee0e7b41ce85f905e5 Signed-off-by: Ramesh Nachimuthu <rnachimu@redhat.com> Reviewed-on: http://review.gluster.org/7594 Reviewed-by: Sahina Bose <sabose@redhat.com>
* autoconf: Configure the nodes in auto-config using NRPERamesh Nachimuthu2014-04-301-14/+105
| | | | | | | | | | | Addning an NRPE command to configure all the newly added nodes to used passive check results using NSCA. It is done using the NRPE command 'configure_gluster_node'. Change-Id: I75d0214c8c52afdedd13dac3f38d52abc4ca5a93 Signed-off-by: Ramesh Nachimuthu <rnachimu@redhat.com> Reviewed-on: http://review.gluster.org/7593 Reviewed-by: Sahina Bose <sabose@redhat.com>
* autoconf: fix for pep 8 errorRamesh Nachimuthu2014-04-291-2/+2
| | | | | Change-Id: I8b662cb36921d62f14eb9af7660585ffc30f94d1 Signed-off-by: Ramesh Nachimuthu <rnachimu@redhat.com>
* auto config : Enhance the auto config to preserve user changesRamesh Nachimuthu2014-04-291-33/+258
| | | | | | | | | Enhace the auto configuration in nagios to preserve the user changes. pynag apis are used to read/write/update the nagios config files. Change-Id: I6820928fb2b0baff5d6e65c811a48b5ff718f9e3 Signed-off-by: Ramesh Nachimuthu <rnachimu@redhat.com>
* autoconf: use host uuid to indentity bricksRamesh Nachimuthu2014-04-291-2/+2
| | | | | | | Using host UUIDs to bricks in host Change-Id: Ie5467b05391f709e292644f00495b41af8213b42 Signed-off-by: Ramesh Nachimuthu <rnachimu@redhat.com>
* autoconf: use host name for host configRamesh Nachimuthu2014-04-291-45/+38
| | | | | | | | Discover the host name configured for the gluster node and use the same as host_name in nagios host configuration. Change-Id: Ib9eb8b3f3a1a03d1be28fa2faba44c2fc81fa0cf Signed-off-by: Ramesh Nachimuthu <rnachimu@redhat.com>
* autocof: adding volume name as part of brick servicesRamesh Nachimuthu2014-04-291-13/+8
| | | | | | | | | Currently there is no way to identify the volume from brick services. Hence adding volume name as custom variable and note in brick services Change-Id: If1ef000196dca2239f713fe41d033d8a4161d6c0 Signed-off-by: Ramesh Nachimuthu <rnachimu@redhat.com>
* autoconf: don't restart nagios if it is stoped.Ramesh Nachimuthu2014-04-291-2/+18
| | | | | | | | | | | Autoconfig script get struck when user runs the script without starting the nagios. Fixed it by checking the nagios service status before restarting. Now autoconfig will restart the nagios only if it started already by the user. Bug-Url: https://bugzilla.redhat.com/1084975 Change-Id: I1582d06abe764e6f2ae2c63d4a2e7169f0b11aa5 Signed-off-by: Ramesh Nachimuthu <rnachimu@redhat.com>
* Autoconfig:Modified the discoverlogicalelementsNishanth Thomas2014-04-291-5/+3
| | | | | | | | | | | | to accept the new format of data receieved from the node. removed the call to get the hostname of the gluster node Change-Id: I99a48cfe03672ee419ea5f586aa35b4b3ab325af Signed-off-by: Nishanth Thomas <nthomas@redhat.com> Reviewed-on: https://code.engineering.redhat.com/gerrit/22549 Reviewed-by: Kanagaraj Mayilsamy <kmayilsa@redhat.com> Tested-by: Ramesh Nachimuthu <rnachimu@redhat.com>
* AutoDiscovery: Auto discovery for gluster entitiesRamesh Nachimuthu2014-04-291-0/+138
Basic plugin which will discover all the basic gluster entities and creates nagios configuration. Change-Id: I71f05dec9bcce74969db300393f7f7c178161dba Signed-off-by: Ramesh Nachimuthu <rnachimu@redhat.com> Reviewed-on: https://code.engineering.redhat.com/gerrit/22100 Reviewed-by: Sahina Bose <sabose@redhat.com>