File 0005-medium-scripts-health-Make-health-script-available-a.patch of Package crmsh
From e3d74556a75d387cab51b923873655809651adda Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kristoffer=20Gr=C3=B6nlund?= <krig@koru.se>
Date: Thu, 20 Apr 2017 10:56:52 +0200
Subject: [PATCH] medium: scripts/health: Make health script available as
wizard (fate#320848) (fate#320866)
Enables running the cluster health check directly from hawk.
---
scripts/health/collect.py | 6 +++++-
scripts/health/main.yml | 15 ++++++++++-----
utils/crm_init.py | 5 ++++-
3 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/scripts/health/collect.py b/scripts/health/collect.py
index bb873687..15c2e5ce 100755
--- a/scripts/health/collect.py
+++ b/scripts/health/collect.py
@@ -1,5 +1,6 @@
#!/usr/bin/env python
import os
+import pwd
import hashlib
import platform
import crm_script
@@ -16,6 +17,9 @@ def rpm_info():
def logrotate_info():
return {}
+def get_user():
+ return pwd.getpwuid(os.getuid()).pw_name
+
def sys_info():
sysname, nodename, release, version, machine = os.uname()
#The first three columns measure CPU and IO utilization of the
@@ -38,7 +42,7 @@ def sys_info():
'distname': distname,
'distver': distver,
'distid': distid,
- 'user': os.getlogin(),
+ 'user': get_user(),
'hostname': hostname,
'uptime': uptime[0],
'idletime': uptime[1],
diff --git a/scripts/health/main.yml b/scripts/health/main.yml
index 327fa179..7c59bddc 100644
--- a/scripts/health/main.yml
+++ b/scripts/health/main.yml
@@ -1,11 +1,16 @@
version: 2.2
-category: Script
-shortdesc: Check the health of the cluster
-longdesc: Runs various checks to verify the health of the cluster nodes
+category: Basic
+shortdesc: Verify health and configuration
+longdesc: |
+ Checks and detects issues with the cluster, by creating and
+ analysing a cluster report.
+
+ Requires SSH access between cluster nodes. This command is
+ also available from the command line as "crm cluster health".
actions:
- collect: collect.py
- shortdesc: Collect cluster information
+ shortdesc: Collect information
- apply_local: hahealth.py
- shortdesc: Run HA health check
+ shortdesc: Run cluster health check
- report: report.py
shortdesc: Report cluster state
diff --git a/utils/crm_init.py b/utils/crm_init.py
index 35384539..f695b6dc 100644
--- a/utils/crm_init.py
+++ b/utils/crm_init.py
@@ -1,4 +1,5 @@
import os
+import pwd
import re
import platform
import socket
@@ -43,6 +44,8 @@ def services_info():
'check enabled/active services'
return [service_info(service) for service in SERVICES]
+def get_user():
+ return pwd.getpwuid(os.getuid()).pw_name
def sys_info():
'system information'
@@ -58,7 +61,7 @@ def sys_info():
'distname': distname,
'distver': distver,
'distid': distid,
- 'user': os.getlogin(),
+ 'user': get_user(),
'hostname': hostname,
'fqdn': socket.getfqdn()}
--
2.12.0