diff --git a/tools/miqssh/.config b/tools/miqssh/.config deleted file mode 100644 index 54b58fdf403..00000000000 --- a/tools/miqssh/.config +++ /dev/null @@ -1,4 +0,0 @@ -TRANSPORT=ansible -#TRANSPORT=ssh -#TRANSPORT=pssh -PARALLELISM=25 diff --git a/tools/miqssh/.doc-tools/FOOT.md b/tools/miqssh/.doc-tools/FOOT.md deleted file mode 100644 index fba7bb372dc..00000000000 --- a/tools/miqssh/.doc-tools/FOOT.md +++ /dev/null @@ -1,126 +0,0 @@ - - -# Examples: -## miqssh -``` -$ miqssh uptime - -*** miq01 *** - 16:19:34 up 5:43, 0 users, load average: 3.10, 3.06, 3.09 - -*** miq02 *** - 16:19:47 up 1:15, 0 users, load average: 0.16, 0.07, 0.01 - -*** miq03 *** - 16:19:53 up 1:15, 0 users, load average: 0.07, 0.15, 0.14 -``` -## miqscp -``` -$ miqscp README.md /tmp/ - -*** miq01 *** -README.md 100% 1020 1.0KB/s 00:00 - -*** miq02 *** -README.md 100% 1020 1.0KB/s 00:00 -``` -## miqcollect -``` -$ miqcollect /etc/hostname /tmp/ - -*** miq1 *** -hostname 100% 22 39.2KB/s 00:00 - -*** miq2 *** -hostname 100% 6 9.0KB/s 00:00 - -*** miq3 *** -hostname 100% 6 9.5KB/s 00:00 - -$ ls /tmp/*hostname* -/tmp/hostname-miq1 /tmp/hostname-miq2 /tmp/hostname-miq3 -``` -## miqgrep pattern -``` -$ miqgrep "MiqEventHandler#log_status" evm - -*** miq1 *** - -*** miq2 *** - -*** miq3 *** - -*** collating results *** - -[miq1] [----] I, [2017-08-11T19:06:20.698103 #2949:b81140] INFO -- : Q-task_id([log_status]) MIQ(MiqEventHandler#log_status) [Event Handler] Worker ID [1000000001071], PID [2922], GUID [c0f9c28a-7ed6-11e7-8b18-525400431635], Last Heartbeat [2017-08-11 23:06:19 UTC], Process Info: Memory Usage [310091776], Memory Size [652206080], Proportional Set Size: [203949000], Memory % [3.01], CPU Time [735.0], CPU % [0.09], Priority [27] -[miq2] [----] I, [2017-08-11T19:06:25.187956 #2765:623130] INFO -- : Q-task_id([log_status]) MIQ(MiqEventHandler#log_status) [Event Handler] Worker ID [1000000002270], PID [2756], GUID [f99103f2-7eda-11e7-a70f-5254003dad57], Last Heartbeat [2017-08-11 23:06:14 UTC], Process Info: Memory Usage [338751488], Memory Size [672755712], Proportional Set Size: [235704000], Memory % [3.28], CPU Time [726.0], CPU % [0.11], Priority [27] -[miq1] [----] I, [2017-08-11T19:11:22.361405 #2949:b81140] INFO -- : Q-task_id([log_status]) MIQ(MiqEventHandler#log_status) [Event Handler] Worker ID [1000000001071], PID [2922], GUID [c0f9c28a-7ed6-11e7-8b18-525400431635], Last Heartbeat [2017-08-11 23:11:14 UTC], Process Info: Memory Usage [310091776], Memory Size [652206080], Proportional Set Size: [203977000], Memory % [3.01], CPU Time [785.0], CPU % [0.09], Priority [27] -[miq2] [----] I, [2017-08-11T19:11:24.019597 #2765:623130] INFO -- : Q-task_id([log_status]) MIQ(MiqEventHandler#log_status) [Event Handler] Worker ID [1000000002270], PID [2756], GUID [f99103f2-7eda-11e7-a70f-5254003dad57], Last Heartbeat [2017-08-11 23:11:21 UTC], Process Info: Memory Usage [338751488], Memory Size [672755712], Proportional Set Size: [235704000], Memory % [3.28], CPU Time [774.0], CPU % [0.12], Priority [27] -``` -## miqgrep -r request_id -``` -$ miqgrep -r 1,000,000,000,088 - -*** looking for tasks associated with request_id: 1000000000088 *** - -*** looking for request_id: 1000000000088 and task_ids: 1000000000088 *** - -*** miq1 *** - -*** miq2 *** - -*** miq3 *** - -*** collating results *** - -[miq2] [----] I, [2017-08-11T19:30:25.616820 #2773:3e3f758] INFO -- : Q-task_id([service_template_provision_task_1000000000087]) Instantiating [/System/Process/REQUEST?MiqProvisionRequest%3A%3Amiq_provision_request=1000000000088&MiqRequest%3A%3Amiq_request=1000000000088&MiqServer%3A%3Amiq_server=1000000000001&User%3A%3Auser=1000000000001&message=get_vmname&object_name=REQUEST&request=UI_PROVISION_INFO&vmdb_object_type=miq_provision_request] -[miq2] [----] I, [2017-08-11T19:30:25.664169 #2773:3e3f758] INFO -- : Q-task_id([service_template_provision_task_1000000000087]) Updated namespace [/System/Process/REQUEST?MiqProvisionRequest%3A%3Amiq_provision_request=1000000000088&MiqRequest%3A%3Amiq_request=1000000000088&MiqServer%3A%3Amiq_server=1000000000001&User%3A%3Auser=1000000000001&message=get_vmname&object_name=REQUEST&request=UI_PROVISION_INFO&vmdb_object_type=miq_provision_request ManageIQ/System] -... -``` -## miqtail pattern -``` -$ miqtail "ERROR|WARN" evm - -Running: multitail -L "ssh miq1 tail -f /var/www/miq/vmdb/log/evm.log \| egrep \"ERROR\|WARN\" | sed -e 's/^/[miq1] /'" -L "ssh miq2 tail -f /var/www/miq/vmdb/log/evm.log \| egrep \"ERROR\|WARN\" | sed -e 's/^/[miq2] /'" -L "ssh miq3 tail -f /var/www/miq/vmdb/log/evm.log \| egrep \"ERROR\|WARN\" | sed -e 's/^/[miq3] /'" - -[miq1] [----] E, [2017-08-11T18:22:56.974519 #2939:b81140] ERROR -- : Ovirt::Service#resource_get: class = Errno::EHOSTUNREACH, message=Failed to open TCP connection to rhvm1.hemlockhill.org:443 (No route to host - connect(2) for "rhvm1.hemlockhill.org" port 443), URI=https://rhvm1.hemlockhill.org/ovirt-engine/api -[miq1] [----] W, [2017-08-11T18:22:56.975316 #2939:b81140] WARN -- : MIQ(ManageIQ::Providers::Redhat::InfraManager#verify_credentials_for_rhevm) Failed to open TCP connection to rhvm1.hemlockhill.org:443 (No route to host - connect(2) for "rhvm1.hemlockhill.org" port 443) -[miq1] [----] W, [2017-08-11T18:22:56.975570 #2939:b81140] WARN -- : MIQ(ManageIQ::Providers::Redhat::InfraManager#authentication_check_no_validation) type: [:default] for [1000000000002] [rhvm1] Validation failed: unreachable, Failed to open TCP connection to rhvm1.hemlockhill.org:443 (No route to host - connect(2) for "rhvm1.hemlockhill.org" port 443) -[miq1] [----] W, [2017-08-11T18:22:56.976243 #2939:b81140] WARN -- : MIQ(AuthUseridPassword#validation_failed) [ExtManagementSystem] [1000000000002], previously valid on: 2017-04-19 04:48:07 UTC, previous status: [Unreachable] -[miq1] [----] W, [2017-08-11T18:22:56.981000 #2931:b81140] WARN -- : MIQ(ManageIQ::Providers::Vmware::InfraManager#verify_credentials) # -[miq1] [----] W, [2017-08-11T18:22:56.981450 #2931:b81140] WARN -- : MIQ(ManageIQ::Providers::Vmware::InfraManager#authentication_check_no_validation) type: ["default"] for [1000000000001] [vcenter1] Validation failed: unreachable, No route to host - connect(2) for "vcenter1.hemlockhill.org" port 443 (vcenter1.hemlockhill.org:443) -[miq1] [----] W, [2017-08-11T18:22:56.982164 #2931:b81140] WARN -- : MIQ(AuthUseridPassword#validation_failed) [ExtManagementSystem] [1000000000001], previously valid on: 2017-04-19 04:59:44 UTC, previous status: [Unreachable] -[miq2] [----] W, [2017-08-11T18:36:44.479934 #2738:623130] WARN -- : MIQ(ManageIQ::Providers::Foreman::ConfigurationManager::RefreshParser#configuration_profile_inv_to_hashes) hostgroup openstack missing: location - -``` -## miqtail -r request_id -``` -$ miqtail -r 1,000,000,000,088 - -*** looking for tasks associated with request_id: 1000000000088 *** - -*** looking for request_id: 1000000000088 and task_ids: 1000000000088 *** - -Running: multitail -L "ssh miq1 tail -f /var/www/miq/vmdb/log/automation.log \| egrep \"1000000000088\|1000000000088\" | sed -e 's/^/[miq1] /'" -L "ssh miq2 tail -f /var/www/miq/vmdb/log/automation.log \| egrep \"1000000000088\|1000000000088\" | sed -e 's/^/[miq2] /'" -L "ssh miq3 tail -f /var/www/miq/vmdb/log/automation.log \| egrep \"1000000000088\|1000000000088\" | sed -e 's/^/[miq3] /'" - -[miq2] [----] I, [2017-08-11T19:31:06.042900 #2765:623130] INFO -- : Q-task_id([miq_provision_request_1000000000088]) Followed Relationship [miqaedb:/infrastructure/VM/Provisioning/Profile/EvmGroup-super_administrator#get_vmname] -[miq2] [----] I, [2017-08-11T19:31:06.043258 #2765:623130] INFO -- : Q-task_id([miq_provision_request_1000000000088]) Followed Relationship [miqaedb:/System/Request/UI_PROVISION_INFO#create] -[miq2] [----] I, [2017-08-11T19:31:09.194610 #2773:623130] INFO -- : Q-task_id([miq_provision_1000000000088]) Instantiating [/System/Process/AUTOMATION?MiqProvision%3A%3Amiq_provision=1000000000088&MiqServer%3A%3Amiq_server=1000000000001&User%3A%3Auser=1000000000001&object_name=AUTOMATION&request=vm_provision&vmdb_object_type=miq_provision] - -``` -# Sample miqhosts file: - -``` -# This file is a sample. See miqhosts-gen script to generate this file by querying the VMDB. -# -# hostname_or_ip groups to assign host to separated by commas. -# -# Lines starting with a # are ignored. -# -miqdb01.example.com db -miqui01.example.com ui -miqwrk01.example.com workers,zone1 -miqwrk02.example.com workers,zone1 -miqwrk03.example.com workers,zone2 -miqwrk04.example.com workers,zone2 -``` diff --git a/tools/miqssh/.doc-tools/HEAD.md b/tools/miqssh/.doc-tools/HEAD.md deleted file mode 100644 index 7a8af7842dd..00000000000 --- a/tools/miqssh/.doc-tools/HEAD.md +++ /dev/null @@ -1,31 +0,0 @@ -# miqssh miqscp miqcollect miqgrep and miqtail utilities - -These tools allow for running commands and copying files and searching log files against multiple ManageIQ workers in an environment based on groups defined in hosts files. - -Also, even if you do have pssh or other tools for running commands on multiple systems, the new miqgrep, miqgrep -r, miqtail, and miqtail -r are worth a look. - -Different transport mechanisms are now supported and can be selected by updating the .config file. By default, Ansible is used since it can work in parallel and is included by default with ManageIQ. Alternatively, if installed and selected, Parallel SSH can be used and is faster opening connections than Ansible. - -**Note that this program can enable you to do things faster, including mistakes, use at your own risk.** - -# Command Descriptions: - -miqssh (connect to each host in group and run provided commands) - -miqscp (copy file TO each host in group) - -miqcollect (copy file FROM each host in group) - -miqgrep (connect to each host in group and grep log_file for pattern or request_id and associated task_ids and collate all results and display using less) - -miqtail (Use multitail to tail log_file and optionally grep for pattern or request_id and associated task_ids) - -miqstatus (run rake evm:status on each host in group) - -miqworkermemcheck (search for memory exceeded messages in automation.log) - -# Installation: - -See INSTALL.txt in this directory. - -# Usages: diff --git a/tools/miqssh/.doc-tools/gen-readme b/tools/miqssh/.doc-tools/gen-readme deleted file mode 100755 index 5ff20fe57c8..00000000000 --- a/tools/miqssh/.doc-tools/gen-readme +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -DIR=$(dirname $(realpath $0)) -DEST=$(dirname $DIR) -cat $DIR/HEAD.md > $DEST/README.md - -if [ ! -f $DEST/miqhosts ] -then - CLEAN_MIQHOSTS=true - cp $DEST/miqhosts-sample $DEST/miqhosts -fi - -commands="miqssh miqscp miqcollect miqgrep miqtail" - -for i in $commands -do - echo "## $i" - echo '```' - $DEST/$i -h - echo '```' -done >> $DEST/README.md - -if [ "$CLEAN_MIQHOSTS" == 'true' ] -then - rm -f $DEST/miqhosts -fi - -cat $DIR/FOOT.md >> $DEST/README.md diff --git a/tools/miqssh/INSTALL.txt b/tools/miqssh/INSTALL.txt deleted file mode 100644 index 5f2a9dd0a8c..00000000000 --- a/tools/miqssh/INSTALL.txt +++ /dev/null @@ -1,8 +0,0 @@ -Installation Instructions - -- Recommended place to configure miqssh tools is on the VMDB in the region. -- Configure your appliances into zones as appropriate for your environment. -- Create an miqhosts file in this directory. See miqhosts-sample and miqhosts-gen can help dynamically generate that by querying server names and zones from the VMDB. -- Generate SSH public/private keys using ssh-keygen, unless they already exist. -- Push the SSH public keys out to all the servers in the region, miqssh-copy-id can help with this. -- To be able to use miqtail, the multitail package from EPEL will need to be installed on this system. diff --git a/tools/miqssh/README.md b/tools/miqssh/README.md deleted file mode 100644 index 5b71c3db433..00000000000 --- a/tools/miqssh/README.md +++ /dev/null @@ -1,331 +0,0 @@ -# miqssh miqscp miqcollect miqgrep and miqtail utilities - -These tools allow for running commands and copying files and searching log files against multiple ManageIQ workers in an environment based on groups defined in hosts files. - -Also, even if you do have pssh or other tools for running commands on multiple systems, the new miqgrep, miqgrep -r, miqtail, and miqtail -r are worth a look. - -Different transport mechanisms are now supported and can be selected by updating the .config file. By default, Ansible is used since it can work in parallel and is included by default with ManageIQ. Ansible is now the recommended transport for best functionality. - -**Note that this program can enable you to do things faster, including mistakes, use at your own risk.** - -# Command Descriptions: - -miqssh (connect to each host in group and run provided commands) - -miqscp (copy file TO each host in group) - -miqcollect (copy file FROM each host in group) - -miqgrep (connect to each host in group and grep log_file for pattern or request_id and associated task_ids and collate all results and display using less) - -miqtail (Use multitail to tail log_file and optionally grep for pattern or request_id and associated task_ids) - -miqstatus (run rake evm:status on each host in group) - -miqworkermemcheck (search for memory exceeded messages in automation.log) - -# Installation: - -See INSTALL.txt in this directory. - -# Usages: -## miqssh -``` - -DESCRIPTION: ssh and run command with args - -USAGE: miqssh [-g group] [-s] command args - -DETAILS: - - -s to run serially - -AVAILABLE GROUPS (default is all): - - all - all_no_db - db - ui - workers - zone1 - zone2 - -To see matching hosts for a given group, use: - -miqssh [-q] -g list - -q to suppress header - -``` -## miqscp -``` - -DESCRIPTION: push files out using scp - -USAGE: miqscp [-g group] [-s] local_file remote_dest_dir - -DETAILS: - - Only one file is supported at a time - - -s to run serially - -AVAILABLE GROUPS (default is all): - - all - all_no_db - db - ui - workers - zone1 - zone2 - -To see matching hosts for a given group, use: - -miqscp [-q] -g list - -q to suppress header - -``` -## miqcollect -``` - -DESCRIPTION: pull files in using scp - -USAGE: miqcollect [-g group] [-s] remote_file local_dest_dir - -DETAILS: - - Wildcards are accepted for remote_file but should only match one file - - local_files are appended with remote hostname - - -s to run serially - -AVAILABLE GROUPS (default is all): - - all - all_no_db - db - ui - workers - zone1 - zone2 - -To see matching hosts for a given group, use: - -miqcollect [-q] -g list - -q to suppress header - -``` -## miqgrep -``` - -DESCRIPTION: grep log_file for pattern or request_id and associated task_ids and collate all results and display using less - -USAGE: miqgrep [-g group] [-s] [-a] [-i] [-o outputfile] [-Q] (pattern | -r request_id) [log_file] - -DETAILS: - - -i is optional to ignore case with grep - - pattern may be specified as a regex suitable for egrep taking care to prevent the shell from interpretation - pattern may be specified as 'nogrep' to have no grep or use cat instead of grep - -r request_id maybe used to search for a request_id and associated task_ids - request_id can be provided with or without commas - - -o outputfile can be used to save output to outputfile - -Q can be used to not less the output file automatically - - log_file is optional and defaults to automation.log - For ManageIQ logs, log_file can be in the format of evm or evm.log - For any other files, use /the/full/path/to/file - - -a can be used to also grep archived logs - - -s to run serially - -AVAILABLE GROUPS (default is all): - - all - all_no_db - db - ui - workers - zone1 - zone2 - -To see matching hosts for a given group, use: - -miqgrep [-q] -g list - -q to suppress header - -``` -## miqtail -``` - -DESCRIPTION: multitail and grep pattern or request_id and associated task_ids - -USAGE: miqtail [-g group] [-s] [-i] [-l] (pattern | -r request_id) [log_file] - -DETAILS: - - -i is optional to ignore case with grep - - pattern may be specified as a regex suitable for egrep taking care to prevent the shell from interpretation - pattern may be specified as 'nogrep' to have no grep or use cat instead of grep - -r request_id maybe used to search for a request_id and associated task_ids - request_id can be provided with or without commas - - log_file is optional and defaults to automation.log - For ManageIQ logs, log_file can be in the format of evm or evm.log - For any other files, use /the/full/path/to/file - - -l can be used to place output in separate window panes, by default output is merged - - In multitail: - Move around the buffer similar to less by pressing 'b' - Exit whatever context you are in by pressing 'q' - - -s to run serially - -AVAILABLE GROUPS (default is all): - - all - all_no_db - db - ui - workers - zone1 - zone2 - -To see matching hosts for a given group, use: - -miqtail [-q] -g list - -q to suppress header - -``` - - -# Examples: -## miqssh -``` -$ miqssh uptime - -*** miq01 *** - 16:19:34 up 5:43, 0 users, load average: 3.10, 3.06, 3.09 - -*** miq02 *** - 16:19:47 up 1:15, 0 users, load average: 0.16, 0.07, 0.01 - -*** miq03 *** - 16:19:53 up 1:15, 0 users, load average: 0.07, 0.15, 0.14 -``` -## miqscp -``` -$ miqscp README.md /tmp/ - -*** miq01 *** -README.md 100% 1020 1.0KB/s 00:00 - -*** miq02 *** -README.md 100% 1020 1.0KB/s 00:00 -``` -## miqcollect -``` -$ miqcollect /etc/hostname /tmp/ - -*** miq1 *** -hostname 100% 22 39.2KB/s 00:00 - -*** miq2 *** -hostname 100% 6 9.0KB/s 00:00 - -*** miq3 *** -hostname 100% 6 9.5KB/s 00:00 - -$ ls /tmp/*hostname* -/tmp/hostname-miq1 /tmp/hostname-miq2 /tmp/hostname-miq3 -``` -## miqgrep pattern -``` -$ miqgrep "MiqEventHandler#log_status" evm - -*** miq1 *** - -*** miq2 *** - -*** miq3 *** - -*** collating results *** - -[miq1] [----] I, [2017-08-11T19:06:20.698103 #2949:b81140] INFO -- : Q-task_id([log_status]) MIQ(MiqEventHandler#log_status) [Event Handler] Worker ID [1000000001071], PID [2922], GUID [c0f9c28a-7ed6-11e7-8b18-525400431635], Last Heartbeat [2017-08-11 23:06:19 UTC], Process Info: Memory Usage [310091776], Memory Size [652206080], Proportional Set Size: [203949000], Memory % [3.01], CPU Time [735.0], CPU % [0.09], Priority [27] -[miq2] [----] I, [2017-08-11T19:06:25.187956 #2765:623130] INFO -- : Q-task_id([log_status]) MIQ(MiqEventHandler#log_status) [Event Handler] Worker ID [1000000002270], PID [2756], GUID [f99103f2-7eda-11e7-a70f-5254003dad57], Last Heartbeat [2017-08-11 23:06:14 UTC], Process Info: Memory Usage [338751488], Memory Size [672755712], Proportional Set Size: [235704000], Memory % [3.28], CPU Time [726.0], CPU % [0.11], Priority [27] -[miq1] [----] I, [2017-08-11T19:11:22.361405 #2949:b81140] INFO -- : Q-task_id([log_status]) MIQ(MiqEventHandler#log_status) [Event Handler] Worker ID [1000000001071], PID [2922], GUID [c0f9c28a-7ed6-11e7-8b18-525400431635], Last Heartbeat [2017-08-11 23:11:14 UTC], Process Info: Memory Usage [310091776], Memory Size [652206080], Proportional Set Size: [203977000], Memory % [3.01], CPU Time [785.0], CPU % [0.09], Priority [27] -[miq2] [----] I, [2017-08-11T19:11:24.019597 #2765:623130] INFO -- : Q-task_id([log_status]) MIQ(MiqEventHandler#log_status) [Event Handler] Worker ID [1000000002270], PID [2756], GUID [f99103f2-7eda-11e7-a70f-5254003dad57], Last Heartbeat [2017-08-11 23:11:21 UTC], Process Info: Memory Usage [338751488], Memory Size [672755712], Proportional Set Size: [235704000], Memory % [3.28], CPU Time [774.0], CPU % [0.12], Priority [27] -``` -## miqgrep -r request_id -``` -$ miqgrep -r 1,000,000,000,088 - -*** looking for tasks associated with request_id: 1000000000088 *** - -*** looking for request_id: 1000000000088 and task_ids: 1000000000088 *** - -*** miq1 *** - -*** miq2 *** - -*** miq3 *** - -*** collating results *** - -[miq2] [----] I, [2017-08-11T19:30:25.616820 #2773:3e3f758] INFO -- : Q-task_id([service_template_provision_task_1000000000087]) Instantiating [/System/Process/REQUEST?MiqProvisionRequest%3A%3Amiq_provision_request=1000000000088&MiqRequest%3A%3Amiq_request=1000000000088&MiqServer%3A%3Amiq_server=1000000000001&User%3A%3Auser=1000000000001&message=get_vmname&object_name=REQUEST&request=UI_PROVISION_INFO&vmdb_object_type=miq_provision_request] -[miq2] [----] I, [2017-08-11T19:30:25.664169 #2773:3e3f758] INFO -- : Q-task_id([service_template_provision_task_1000000000087]) Updated namespace [/System/Process/REQUEST?MiqProvisionRequest%3A%3Amiq_provision_request=1000000000088&MiqRequest%3A%3Amiq_request=1000000000088&MiqServer%3A%3Amiq_server=1000000000001&User%3A%3Auser=1000000000001&message=get_vmname&object_name=REQUEST&request=UI_PROVISION_INFO&vmdb_object_type=miq_provision_request ManageIQ/System] -... -``` -## miqtail pattern -``` -$ miqtail "ERROR|WARN" evm - -Running: multitail -L "ssh miq1 tail -f /var/www/miq/vmdb/log/evm.log \| egrep \"ERROR\|WARN\" | sed -e 's/^/[miq1] /'" -L "ssh miq2 tail -f /var/www/miq/vmdb/log/evm.log \| egrep \"ERROR\|WARN\" | sed -e 's/^/[miq2] /'" -L "ssh miq3 tail -f /var/www/miq/vmdb/log/evm.log \| egrep \"ERROR\|WARN\" | sed -e 's/^/[miq3] /'" - -[miq1] [----] E, [2017-08-11T18:22:56.974519 #2939:b81140] ERROR -- : Ovirt::Service#resource_get: class = Errno::EHOSTUNREACH, message=Failed to open TCP connection to rhvm1.hemlockhill.org:443 (No route to host - connect(2) for "rhvm1.hemlockhill.org" port 443), URI=https://rhvm1.hemlockhill.org/ovirt-engine/api -[miq1] [----] W, [2017-08-11T18:22:56.975316 #2939:b81140] WARN -- : MIQ(ManageIQ::Providers::Redhat::InfraManager#verify_credentials_for_rhevm) Failed to open TCP connection to rhvm1.hemlockhill.org:443 (No route to host - connect(2) for "rhvm1.hemlockhill.org" port 443) -[miq1] [----] W, [2017-08-11T18:22:56.975570 #2939:b81140] WARN -- : MIQ(ManageIQ::Providers::Redhat::InfraManager#authentication_check_no_validation) type: [:default] for [1000000000002] [rhvm1] Validation failed: unreachable, Failed to open TCP connection to rhvm1.hemlockhill.org:443 (No route to host - connect(2) for "rhvm1.hemlockhill.org" port 443) -[miq1] [----] W, [2017-08-11T18:22:56.976243 #2939:b81140] WARN -- : MIQ(AuthUseridPassword#validation_failed) [ExtManagementSystem] [1000000000002], previously valid on: 2017-04-19 04:48:07 UTC, previous status: [Unreachable] -[miq1] [----] W, [2017-08-11T18:22:56.981000 #2931:b81140] WARN -- : MIQ(ManageIQ::Providers::Vmware::InfraManager#verify_credentials) # -[miq1] [----] W, [2017-08-11T18:22:56.981450 #2931:b81140] WARN -- : MIQ(ManageIQ::Providers::Vmware::InfraManager#authentication_check_no_validation) type: ["default"] for [1000000000001] [vcenter1] Validation failed: unreachable, No route to host - connect(2) for "vcenter1.hemlockhill.org" port 443 (vcenter1.hemlockhill.org:443) -[miq1] [----] W, [2017-08-11T18:22:56.982164 #2931:b81140] WARN -- : MIQ(AuthUseridPassword#validation_failed) [ExtManagementSystem] [1000000000001], previously valid on: 2017-04-19 04:59:44 UTC, previous status: [Unreachable] -[miq2] [----] W, [2017-08-11T18:36:44.479934 #2738:623130] WARN -- : MIQ(ManageIQ::Providers::Foreman::ConfigurationManager::RefreshParser#configuration_profile_inv_to_hashes) hostgroup openstack missing: location - -``` -## miqtail -r request_id -``` -$ miqtail -r 1,000,000,000,088 - -*** looking for tasks associated with request_id: 1000000000088 *** - -*** looking for request_id: 1000000000088 and task_ids: 1000000000088 *** - -Running: multitail -L "ssh miq1 tail -f /var/www/miq/vmdb/log/automation.log \| egrep \"1000000000088\|1000000000088\" | sed -e 's/^/[miq1] /'" -L "ssh miq2 tail -f /var/www/miq/vmdb/log/automation.log \| egrep \"1000000000088\|1000000000088\" | sed -e 's/^/[miq2] /'" -L "ssh miq3 tail -f /var/www/miq/vmdb/log/automation.log \| egrep \"1000000000088\|1000000000088\" | sed -e 's/^/[miq3] /'" - -[miq2] [----] I, [2017-08-11T19:31:06.042900 #2765:623130] INFO -- : Q-task_id([miq_provision_request_1000000000088]) Followed Relationship [miqaedb:/infrastructure/VM/Provisioning/Profile/EvmGroup-super_administrator#get_vmname] -[miq2] [----] I, [2017-08-11T19:31:06.043258 #2765:623130] INFO -- : Q-task_id([miq_provision_request_1000000000088]) Followed Relationship [miqaedb:/System/Request/UI_PROVISION_INFO#create] -[miq2] [----] I, [2017-08-11T19:31:09.194610 #2773:623130] INFO -- : Q-task_id([miq_provision_1000000000088]) Instantiating [/System/Process/AUTOMATION?MiqProvision%3A%3Amiq_provision=1000000000088&MiqServer%3A%3Amiq_server=1000000000001&User%3A%3Auser=1000000000001&object_name=AUTOMATION&request=vm_provision&vmdb_object_type=miq_provision] - -``` -# Sample miqhosts file: - -``` -# This file is a sample. See miqhosts-gen script to generate this file by querying the VMDB. -# -# hostname_or_ip groups to assign host to separated by commas. -# -# Lines starting with a # are ignored. -# -miqdb01.example.com db -miqui01.example.com ui -miqwrk01.example.com workers,zone1 -miqwrk02.example.com workers,zone1 -miqwrk03.example.com workers,zone2 -miqwrk04.example.com workers,zone2 -``` diff --git a/tools/miqssh/miqcollect b/tools/miqssh/miqcollect deleted file mode 120000 index 765a54e0ae1..00000000000 --- a/tools/miqssh/miqcollect +++ /dev/null @@ -1 +0,0 @@ -miqssh \ No newline at end of file diff --git a/tools/miqssh/miqgrep b/tools/miqssh/miqgrep deleted file mode 120000 index 765a54e0ae1..00000000000 --- a/tools/miqssh/miqgrep +++ /dev/null @@ -1 +0,0 @@ -miqssh \ No newline at end of file diff --git a/tools/miqssh/miqgrep-collate b/tools/miqssh/miqgrep-collate deleted file mode 120000 index 765a54e0ae1..00000000000 --- a/tools/miqssh/miqgrep-collate +++ /dev/null @@ -1 +0,0 @@ -miqssh \ No newline at end of file diff --git a/tools/miqssh/miqgrep-request b/tools/miqssh/miqgrep-request deleted file mode 120000 index 765a54e0ae1..00000000000 --- a/tools/miqssh/miqgrep-request +++ /dev/null @@ -1 +0,0 @@ -miqssh \ No newline at end of file diff --git a/tools/miqssh/miqhosts-gen b/tools/miqssh/miqhosts-gen deleted file mode 100755 index 39f6218a9a4..00000000000 --- a/tools/miqssh/miqhosts-gen +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# Query VMDB for MIQ Server hostnames and associated zones and dynamically build the content of miqhosts. -# Results printed to STDOUT. Redirect to miqhosts to save. - -echo 1>&2 -echo "Redirect standard output of this command to your miqhosts file if desired." 1>&2 -echo "Enter VMDB database password if prompted." 1>&2 -echo 1>&2 -echo "# miqhosts content generated by miqhosts-gen. See miqhosts-gen to regenerate this file by querying the VMDB if desired." -echo "#" -echo "# hostname_or_ip groups to assign host to separated by commas." -echo "#" -echo "# Lines starting with a # are ignored." -echo "#" - - -cd /var/www/miq/vmdb - -#echo 'select miq_servers.hostname, zones.name from miq_servers join zones on zones.id = miq_servers.zone_id;' | rails db | awk '$1!="hostname" && !/^---/ && !/^\(/ {print}' | sed -e 's/ //g' -e 's/|/ /' -e '/^$/d' -psql -d vmdb_production -c 'select miq_servers.hostname, zones.name from miq_servers join zones on zones.id = miq_servers.zone_id;' | awk '$1!="hostname" && !/^---/ && !/^\(/ {print}' | sed -e 's/ //g' -e 's/|/ /' -e '/^$/d' - -cd - > /dev/null diff --git a/tools/miqssh/miqhosts-sample b/tools/miqssh/miqhosts-sample deleted file mode 100644 index cfdffd5da48..00000000000 --- a/tools/miqssh/miqhosts-sample +++ /dev/null @@ -1,12 +0,0 @@ -# This file is a sample. See miqhosts-gen script to generate this file by querying the VMDB. -# -# hostname_or_ip groups to assign host to separated by commas. -# -# Lines starting with a # are ignored. -# -miqdb01.example.com db -miqui01.example.com ui -miqwrk01.example.com workers,zone1 -miqwrk02.example.com workers,zone1 -miqwrk03.example.com workers,zone2 -miqwrk04.example.com workers,zone2 diff --git a/tools/miqssh/miqhosts.rb b/tools/miqssh/miqhosts.rb deleted file mode 100755 index 83f4dd13c3f..00000000000 --- a/tools/miqssh/miqhosts.rb +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/env ruby -# -# Parse miqhosts file for use with miqssh etc. -# - -# Method load_file to read the hosts file and create useful datastructures. -def load_file(file) - data = {} # Hash keyed on group name. Each hash value to have an array of hosts. - - File.open(file).each do |line| - next if line =~ /^#/ - next if line =~ /^$/ - next if line =~ /^\s+$/ - line.chomp! - line.downcase! - host, group_csv = line.split(/\s+/) - groups = group_csv.split(",") - # Add host to each of the specified groups. - groups.each do |group| - data[group.to_sym] = [] if data[group.to_sym].nil? - data[group.to_sym].push(host) - end - # Add host to the all group. - data[:all] = [] if data[:all].nil? - data[:all].push(host) - # Add host to all_no_db group unless it is the db. - data[:all_no_db] = [] if data[:all_no_db].nil? - data[:all_no_db].push(host) unless groups.include?("db") - end - # Sort and uniq the arrays of hosts. - data.each_key do |k| - data[k].uniq! - data[k].sort! - end -end - -# Method to list the valid groups. -def list_groups(data) - groups = [] - data.each_key { |k| groups.push(k.to_s) } - puts groups.sort.join(" ") -end - -# Method to list the servers belonging to the specified group. -def list_servers(data, group) - groups = group.split(',') - servers = [] - groups.each { |g| servers.push(data[g.to_sym]) } - puts servers.uniq.sort.join(" ") -end - -file = ARGV[0] -command = ARGV[1] -group = ARGV[2] - -data = load_file(file) - -if command == "list_groups" - list_groups(data) -elsif command == "list_servers" - list_servers(data, group) -end diff --git a/tools/miqssh/miqscp b/tools/miqssh/miqscp deleted file mode 120000 index 765a54e0ae1..00000000000 --- a/tools/miqssh/miqscp +++ /dev/null @@ -1 +0,0 @@ -miqssh \ No newline at end of file diff --git a/tools/miqssh/miqssh b/tools/miqssh/miqssh deleted file mode 100755 index dcc6f18bfcc..00000000000 --- a/tools/miqssh/miqssh +++ /dev/null @@ -1,572 +0,0 @@ -#!/bin/bash -# -# Note: This program can enable you to do things faster, including mistakes, use at your own risk. -# - -TAIL_NUMBER=3 -ALL_TAIL_NUMBER=999999999999999 -NAME=$(basename $0) -DIR=$(dirname $0) -miqhosts_cmd="$DIR/miqhosts.rb" -miqhosts_file="$DIR/miqhosts" -USER=$(whoami) -REQUEST=false - -if [ ! -f $miqhosts_file ] -then - echo - echo "$miqhosts_file does not exist." - echo - echo "Some initial setup is required to use this. See $DIR/INSTALL.txt." - echo - exit 1 -fi - -if [ $NAME == "miqgrep-collate" ] -then - NAME=miqgrep -fi - -if [ $NAME == "miqgrep-request" ] -then - NAME=miqgrep - REQUEST=true -fi - -if [ $NAME == "miqtail-request" ] -then - NAME=miqtail - REQUEST=true -fi - -groups=$($miqhosts_cmd $miqhosts_file list_groups) - -function usage_common { - echo "DESCRIPTION: $2" - echo - echo "USAGE: $NAME [-g group1[,groupN]] [-s] $1" - echo - shift 2 - echo "DETAILS:" - if [ $# -ne 0 ] - then - for i in "$@" - do - if [ -n "$i" ] - then - echo "$i" - fi - done - echo - else - echo - fi - echo " -s to run serially" - echo -} - -function usage_case { - echo - echo " -i is optional to ignore case with grep" -} - -function usage_log_file { - echo - echo " log_file is optional and defaults to automation.log" - echo " For ManageIQ logs, log_file can be in the format of evm or evm.log" - echo " For any other files, use /the/full/path/to/file" -} - -function usage_pattern { - echo - echo " pattern may be specified as a regex suitable for egrep taking care to prevent the shell from interpretation" - echo " pattern may be specified as 'nogrep' to have no grep or use cat instead of grep" - echo " -r request_id maybe used to search for a request_id and associated task_ids" - echo " request_id can be provided with or without commas" -} - -function usage_tail { - echo - echo " -l can be used to place output in separate window panes, by default output is merged" - echo - echo " In multitail:" - echo " Move around the buffer similar to less by pressing 'b'" - echo " Exit whatever context you are in by pressing 'q'" -} - -function usage_grep { - echo - echo " -a can be used to also grep archived logs" -} - -function usage_output { - if [ $NAME == 'miqgrep' ] - then - echo - echo " -o outputfile can be used to save output to outputfile" - echo " -Q can be used to not less the output file automatically" - fi -} - -function usage_help { - echo " -h | --help for this usage statement" - echo -} - -function usage_regex { - USAGE=$1 - DESCRIPTION=$2 - shift 2 - usage_common "$USAGE" "$DESCRIPTION" "$(eval usage_case)" "$(eval usage_pattern)" "$(eval usage_output)" "$(eval usage_log_file)" "$@" -} - - -function usage { - echo - case $NAME in - "miqssh") usage_common "command args" "ssh and run command with args" ;; - "miqscp") usage_common "local_file remote_dest_dir" "push files out using scp" " " " Only one file is supported at a time" ;; - "miqcollect") usage_common "remote_file local_dest_dir" "pull files in using scp" " " " Wildcards are accepted for remote_file but should only match one file" " " " local_files are appended with remote hostname" ;; - "miqgrep") usage_regex "[-a] [-i] [-o outputfile] [-Q] (pattern | -r request_id) [log_file]" "grep log_file for pattern or request_id and associated task_ids and collate all results and display using less" "$(eval usage_grep)" ;; - "miqtail") usage_regex "[-i] [-l] (pattern | -r request_id) [log_file]" "multitail and grep pattern or request_id and associated task_ids" "$(eval usage_tail)" ;; - esac - echo "AVAILABLE GROUPS (default is all):" - echo - for i in $groups - do - echo " $i" - done - echo - echo "To see matching hosts for a given group, use:" - echo - echo "$NAME [-q] -g list" - echo " -q to suppress header" - echo - exit 1 -} - -function clean_tmp_files { - rm -f $TMPFILE - clean_pssh_out -} - -function clean_pssh_out { - if [ "$TRANSPORT" == 'pssh' ] - then - rm -rf $PSSH_OUTDIR - fi -} - -if [ $NAME == 'miqtail' ] -then - GREP='grep' -else - GREP='zgrep' -fi - -L='L' - -SAVEOUT=false - -. $DIR/.config - -while getopts ac:g:hilqQo:sr OPT -do - case $OPT in - a) GREP_ARCHIVED=true ;; - c) TAIL_NUMBER=$OPTARG ;; - g) group=$OPTARG ;; - i) GREP="$GREP -i" ;; - l) L='l' ;; - q) QUIET=true ;; - o) SAVEOUT=true - TMPFILE=$OPTARG - ;; - Q) NOLESS=true ;; - s) PARALLELISM=1 ;; - r) REQUEST=true ;; - *) usage ;; - esac -done - -shift $((OPTIND-1)) - -GREP="$GREP -e" - -if [[ "$TRANSPORT" == 'ansible' && $NAME == 'miqcollect' ]] -then - wildcards=( '*' '.' '?' '|' ']' '[' ) - for wildcard in "${wildcards[@]}" - do - if [[ $1 == *"${wildcard}"* ]] - then - echo "*** Switching TRANSPORT to ssh due to wild card in source file name ***" - TRANSPORT=ssh - fi - done -fi - -if [[ -z "$TRANSPORT" || -z "$PARALLELISM" ]] -then - echo "TRANSPORT and/or PARALLELISM not specified, see $DIR/.config." - exit 1 -fi - -which $TRANSPORT > /dev/null 2>&1 -if [ $? -ne 0 ] -then - echo "TRANSPORT=$TRANSPORT and $TRANSPORT is not found." - exit 1 -fi - -if [ "$TRANSPORT" == 'pssh' ] -then - PSSH_OUTDIR="/tmp/.$NAME.pssh.$$" - if [ -e "$PSSH_OUTDIR" ] - then - echo - read -p "PSSH_OUTDIR $PSSH_OUTDIR already exists! Remove? (Y/N) " answer - answer=$(echo $answer | cut -c1 | tr [A-Z] [a-z]) - if [ "$answer" == 'y' ] - then - rm -rf $PSSH_OUTDIR - if [ $? -ne 0 ] - then - echo "Unable to remove $PSSH_OUTDIR!" - exit 1 - fi - else - exit 1 - fi - fi -fi - -if [ $NAME == 'miqgrep' ] -then - if [ -z "$TMPFILE" ] - then - TMPFILE="/tmp/.$NAME.$$" - fi - - if [ -e "$TMPFILE" ] - then - echo - read -p "TMPFILE $TMPFILE already exists! Erase? (Y/N) " answer - answer=$(echo $answer | cut -c1 | tr [A-Z] [a-z]) - if [ "$answer" == 'y' ] - then - > $TMPFILE - if [ $? -ne 0 ] - then - echo "Unable to erase $TMPFILE!" - exit 1 - fi - else - exit 1 - fi - fi -fi - -if [[ $NAME != 'miqgrep' && "$SAVEOUT" == 'true' ]] -then - echo - echo "$NAME does not support -o option." - usage -fi - -if [ "$SAVEOUT" == 'false' ] -then - trap clean_tmp_files EXIT -else - trap clean_pssh_out EXIT -fi - -if [ $NAME == 'miqssh' ] -then - if [ $# -lt 1 ] - then - echo - echo "Not enough arguments!" - usage - fi -elif [ "$1" == "list" ] -then - if [ $# -ne 1 ] - then - echo - echo "Wrong number of arguments!" - usage - fi -elif [[ $NAME == 'miqgrep' || $NAME == "miqtail" ]] -then - if [[ $# -ne 1 && $# -ne 2 ]] - then - echo - echo "Wrong number of arguments!" - usage - fi -else - if [ $# -ne 2 ] - then - echo - echo "Wrong number of arguments!" - usage - fi -fi - -if [ -z "$group" ] -then - group=all -fi - -if [ ! -r "$miqhosts_file" ] -then - echo - echo "$miqhosts_file not available!" - usage -fi - -if [ ! -x "$miqhosts_cmd" ] -then - echo - echo "$miqhosts_file not executable!" - usage -fi - -if [ $REQUEST == 'true' ] -then - if [ ! -d '/var/www/miq/vmdb' ] - then - echo - echo "ERROR: $NAME must be run from a ManageIQ appliance!" - echo - exit 1 - fi -fi - -if [ $NAME == 'miqtail' ] -then - which multitail > /dev/null 2>&1 - if [ $? -ne 0 ] - then - echo - echo "ERROR: $NAME requires multitail be installed in PATH!" - echo - exit 1 - fi -fi - -# Check that we have a ruby available for miqhosts_cmd to use -/usr/bin/env ruby --version > /dev/null 2>&1 -if [ $? -ne 0 ] -then - echo - echo "Unable to find ruby with /usr/bin/env ruby. Please make sure ruby is installed." - echo - exit 1 -fi - -/usr/bin/env perl -v > /dev/null 2>&1 -if [ $? -ne 0 ] -then - echo - echo "Unable to find perl with /usr/bin/env perl. Please make sure perl is installed." - echo - exit 1 -fi - -if [[ "$QUIET" != 'true' && "$TRANSPORT" != 'pssh' && "$TRANSPORT" != 'ansible' || ( $NAME == 'miqgrep' && $REQUEST == 'true' ) ]] -then - echo -fi - -SERVERS=$($miqhosts_cmd $miqhosts_file list_servers $group) - -if [ -z "$SERVERS" ] -then - echo - echo "No servers found matching group(s) $group in $miqhosts_file" - usage -fi - -if [ "$1" == "list" ] -then - if [ "$QUIET" != 'true' ] - then - echo "Matching servers:" - fi - for i in $SERVERS - do - echo $i - done | sort - exit -fi - -if [[ $NAME == 'miqgrep' || $NAME == 'miqtail' ]] -then - PATTERN="$1" - if [ "$PATTERN" == 'nogrep' ] - then - if [ $NAME == 'miqgrep' ] - then - GREP='cat' - PATTERN='' - fi - fi - if [ $REQUEST == 'true' ] - then - REQUEST_ID=$(echo $PATTERN | sed 's/,//g') - echo "*** looking for tasks associated with request_id: $REQUEST_ID ***" - cd /var/www/miq/vmdb - #TASK_IDS=$(echo "select id from miq_request_tasks where miq_request_id = $REQUEST_ID" | rails db | awk '$1!="id" && !/^---/ && !/^\(/ {print $1}' | sort -n) - TASK_IDS=$(psql -d vmdb_production -c "select id from miq_request_tasks where miq_request_id = $REQUEST_ID" | awk '$1!="id" && !/^---/ && !/^\(/ {print $1}' | sort -n) - echo - TASK_IDS=$(echo $TASK_IDS) - cd - > /dev/null - PATTERN="request_$REQUEST_ID$(for i in $TASK_IDS; do echo -n "|task_$i|provision_$i"; done)" - echo "*** looking for request_id: $REQUEST_ID and task_id/provision_id: $TASK_IDS ***" - echo - if [[ $NAME == 'miqtail' && REQUEST == 'true' ]] - then - sleep 1 - fi - fi - PATTERN=$(echo $PATTERN | sed -e 's/|/\\|/g') - LOG=$2 - if [ -z "$LOG" ] - then - LOG='automation.log' - fi - if [ "$(echo $LOG | cut -c1)" != "/" ] - then - LOG="/var/www/miq/vmdb/log/$(echo $LOG | sed 's/\.log$//').log" - fi - if [ $NAME == 'miqgrep' ] - then - if [ "$GREP_ARCHIVED" == 'true' ] - then - LOG="$LOG-* $LOG" - fi - if [ "$TAIL_NUMBER" == 'all' ] - then - TAIL_NUMBER=$ALL_TAIL_NUMBER - fi - TAIL="tail -$TAIL_NUMBER" - else - TAIL="tail" - fi -fi - -ARGS=$* -#ARGS=$(echo $ARGS | sed 's/*/\\*/g') - -if [ $NAME != 'miqtail' ] -then - - if [ "$TRANSPORT" == 'ssh' ] - then - - for i in $SERVERS - do - echo "*** $i ***" - case $NAME in - "miqssh") ssh $USER@$i $ARGS ;; - "miqscp") scp $1 $USER@$i:$2 ;; - "miqcollect") scp $USER@$i:$1 $2/$(basename $1)-$i ;; - "miqgrep") ssh $USER@$i "$GREP \"$PATTERN\" $LOG" | perl -pe 's/^\/.*?://' | sed -e "s/^/[$i] /" >> $TMPFILE ;; - esac - echo - done - - elif [ "$TRANSPORT" == 'pssh' ] - then - - HOSTS="" - for i in $SERVERS - do - HOSTS="$HOSTS -H $USER@$i" - done - - case $NAME in - "miqssh") pssh -t 0 -i $HOSTS $ARGS ;; - "miqscp") pscp.pssh -t 0 $HOSTS $1 $2 ;; - "miqcollect") pslurp -t 0 $HOSTS -L $2 "$1" . ;; - "miqgrep") pssh -t 0 $HOSTS -o $PSSH_OUTDIR "$GREP \"$PATTERN\" $LOG | perl -pe 's/^\/.*?://' | sed -e \"s/^/[\$(hostname -s)] /\"" ;; - esac - - elif [ "$TRANSPORT" == 'ansible' ] - then - - HOSTS=$(echo $SERVERS | sed -e 's/ /,/g') - - case $NAME in - "miqssh") ansible all -i $HOSTS -f $PARALLELISM -m shell -a "$ARGS" ;; - "miqscp") ansible all -i $HOSTS -f $PARALLELISM -m copy -a "src=$1 dest=$2" ;; - "miqcollect") ansible all -i $HOSTS -f $PARALLELISM -m fetch -a "src=$1 dest=$2/$(basename $1)-{{ inventory_hostname }} flat=yes" ;; - "miqgrep") - if [ -n "$PATTERN" ] - then - ansible all -i $HOSTS -f $PARALLELISM -m shell -a "$GREP \"$PATTERN\" $LOG | perl -pe 's/^\/.*?://' | sed -e \"s/^/[\$(hostname -s)] /\"" | tee $TMPFILE | perl -ne "print if /^\S+\s\|\s\S+\s\|\src=\d+\s>>\s*$|^\S+\s\|\s\S+\s=>\s\{\s*$/" - else - ansible all -i $HOSTS -f $PARALLELISM -m shell -a "$GREP $LOG | perl -pe 's/^\/.*?://' | sed -e \"s/^/[\$(hostname -s)] /\"" | tee $TMPFILE | perl -ne "print if /\|\src=\d+\s>>/" - fi ;; - esac - - else - echo "$TRANSPORT must be one of ssh, pssh, or ansible." - exit 1 - fi - - if [ $NAME == 'miqgrep' ] - then - if [ "$TRANSPORT" == 'ansible' ] - then - echo - fi - echo "*** collating results ***" - if [ "$TRANSPORT" == 'pssh' ] - then - cat $PSSH_OUTDIR/* > $TMPFILE - fi - if [ "$TRANSPORT" == 'ansible' ] - then - awk '!/.* \| .* \| rc=.* >>/ {print}' $TMPFILE > $TMPFILE.ansible - mv $TMPFILE.ansible $TMPFILE - sleep 1 - fi - sort -k 4 $TMPFILE > $TMPFILE.sort - mv $TMPFILE.sort $TMPFILE - if [ "$NOLESS" != "true" ] - then - less $TMPFILE - fi - echo - fi - -else - - COMMAND='multitail' - TAIL='tail -f' - if [ "$PATTERN" == 'nogrep' ] - then - CLIENT_CMD="$TAIL $LOG" - else - CLIENT_CMD="$TAIL $LOG | $GREP \\\"$PATTERN\\\"" - fi - - for i in $SERVERS - do - COMMAND="$COMMAND -$L \"ssh $i '$CLIENT_CMD' | sed -u -e 's/^/[$i] /'\"" - done - - echo "Running: $COMMAND" - - eval $COMMAND - -fi - -if [ "$SAVEOUT" == 'true' ] -then - echo "Output File: $TMPFILE" -fi - diff --git a/tools/miqssh/miqssh-copy-id b/tools/miqssh/miqssh-copy-id deleted file mode 100755 index ad5f18e956d..00000000000 --- a/tools/miqssh/miqssh-copy-id +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -DIR=$(dirname $0) - -HOSTS=$(awk '!/^#/ {print $1}' $DIR/miqhosts) -USER=$(whoami) - -for i in $HOSTS -do - ssh-copy-id -o StrictHostKeyChecking=no ${USER}@$i -done diff --git a/tools/miqssh/miqssh_wrapper b/tools/miqssh/miqssh_wrapper deleted file mode 100755 index 390f4a228f9..00000000000 --- a/tools/miqssh/miqssh_wrapper +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -# - -NAME=$(basename $0) -DIR=$(dirname $0) - -function usage { - echo - echo "USAGE: $NAME [-g group] [-s]" - echo - exit 1 -} - -while getopts g:so: OPT -do - case $OPT in - g) group="-g $OPTARG" ;; - s) s="-s" ;; - o) output="-o $OPTARG" ;; - Q) Q="-Q" ;; - *) usage ;; - esac -done - -shift $((OPTIND-1)) - -case $NAME in - miqstatus) tool="miqssh" command="cd /var/www/miq/vmdb && rake evm:status" ;; - miqworkermemcheck) tool="miqgrep" outputfile="/tmp/.miqworkermemcheck.$$" Q="-Q" output="-o $outputfile" command="exceeded limit" ;; - *) echo "Unknown command." - usage - ;; -esac - -$tool $group $s $output $Q "$command" - -case $NAME in - miqworkermemcheck) - cat $outputfile | perl -ne '$_ =~ /^\[(.*?)\] .*(\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d\.\d{6}).*Worker \[(\S+)\] .* (process memory usage) \[(\d+)\] (exceeded limit) \[(\d+)\], /; print "$1 $2 $3 $4 $5 $6 $7\n"' - rm -f $outputfile - ;; -esac diff --git a/tools/miqssh/miqstatus b/tools/miqssh/miqstatus deleted file mode 120000 index bcd16d785b8..00000000000 --- a/tools/miqssh/miqstatus +++ /dev/null @@ -1 +0,0 @@ -miqssh_wrapper \ No newline at end of file diff --git a/tools/miqssh/miqtail b/tools/miqssh/miqtail deleted file mode 120000 index 765a54e0ae1..00000000000 --- a/tools/miqssh/miqtail +++ /dev/null @@ -1 +0,0 @@ -miqssh \ No newline at end of file diff --git a/tools/miqssh/miqtail-request b/tools/miqssh/miqtail-request deleted file mode 120000 index 765a54e0ae1..00000000000 --- a/tools/miqssh/miqtail-request +++ /dev/null @@ -1 +0,0 @@ -miqssh \ No newline at end of file diff --git a/tools/miqssh/miqworkermemcheck b/tools/miqssh/miqworkermemcheck deleted file mode 120000 index bcd16d785b8..00000000000 --- a/tools/miqssh/miqworkermemcheck +++ /dev/null @@ -1 +0,0 @@ -miqssh_wrapper \ No newline at end of file