Hi,

On Thu, Feb 28, 2008 at 03:47:04PM +0100, Dominik Klein wrote:
>> thanky you for the script and for pointing to the right direction.
>> May I change the format of the output? (Yes, I also saw the thing with
>> wrong headings)
>
> Here's a newer version. It can now read resource-stickiness and 
> resource_stickiness (notice the - and _). Both is possible, but up to now, 
> only one was looked for.
> Also fixed a problem with the headings being mixed up.

I was wondering if you could do it the other way around, i.e. one
gives failover requirements such as after third failure move to
the other node and the script calculates the various stickiness
values. How about that?

Thanks,

Dejan

> I know this thing produces a lot of logs, but at least it does display the 
> scores, hu? :)
>
> #!/bin/bash
>
> # Feb 2008, Dominik Klein
> # Display scores of Linux-HA resources
>
> # Known issues:
> # * cannot get resource[_failure]_stickiness values for master/slave and 
> clone resources
> #   if those values are configured as meta attributes of the master/slave 
> or clone resource
> #   instead of as meta attributes of the encapsulated primitive
>
> if [ `crmadmin -D | cut -d' ' -f4` != `uname -n|tr "[:upper:]" "[:lower:]"` 
> ]
>   then echo "Warning: Script running not on DC. Might be slow(!)"
> fi
>
> # Heading
> printf "%-16s%-16s%-16s%-16s%-16s%-16s\n" "Resource" "Score" "Node" 
> "Stickiness" "Failcount" "Failure-Stickiness"
>
> 2>&1 ptest -LVVVVVVV|grep -E "assign_node|rsc_location"|grep -w -E "\ 
> [-]{0,1}[0-9]*$"|while read line
> do
>         node=`echo $line|cut -d ' ' -f 8|cut -d ':' -f 1`
>         res=`echo $line|cut -d ' ' -f 6|tr -d ","`
>         score=`echo $line|cut -d ' ' -f 9|sed 's/1000000/INFINITY/g'`
>
>         # get meta attribute resource_stickiness
>         if crm_resource -g resource_stickiness -r $res --meta &>/dev/null
>         then
>                 stickiness=`crm_resource -g resource_stickiness -r $res 
> --meta 2>/dev/null`
>                 else if crm_resource -g resource-stickiness -r $res --meta 
> &>/dev/null
>                 then
>                         stickiness=`crm_resource -g resource-stickiness -r 
> $res --meta 2>/dev/null`
>                         # if that doesnt exist, get syntax like <primitive 
> resource-stickiness="100"
>                         else if ! stickiness=`crm_resource -x -r $res 
> 2>/dev/null | grep -E "<master|<primitive|<clone" | grep -o 
> "resource[_-]stickiness=\"[0-9]*\"" | cut -d '"' -f 2 | grep -v "^$"`
>                                 then
>                                         # if no resource-specific 
> stickiness is confiugured, grep the default value
>                                         stickiness=`cibadmin -Q -o 
> crm_config 2>/dev/null|grep "default[_-]resource[_-]stickiness"|grep -o -E 
> 'value ?= ?"[^ ]*"'|cut -d '"' -f 2|grep -v "^$"`
>                                 fi
>                         fi
>                 fi
>
>         # get meta attribute resource_failure_stickiness
>         if crm_resource -g resource_failure_stickiness -r $res --meta 
> &>/dev/null
>         then
>                 failurestickiness=`crm_resource -g 
> resource_failure_stickiness -r $res --meta 2>/dev/null`
>                 else if crm_resource -g resource-failure-stickiness -r $res 
> --meta &>/dev/null
>                 then
>                         failurestickiness=`crm_resource -g 
> resource-failure-stickiness -r $res --meta 2>/dev/null`
>                         else
>                                 # if that doesnt exist, get the default 
> value
>                                 failurestickiness=`cibadmin -Q -o 
> crm_config 2>/dev/null|grep "resource[_-]failure[_-]stickiness"|grep -o -E 
> 'value ?= ?"[^ ]*"'|cut -d '"' -f 2|grep -v "^$"`
>                         fi
>                 fi
>
>         failcount=`crm_failcount -G -r $res -U $node 2>/dev/null|grep -o -E 
> 'value ?= ?[0-9]*'|cut -d '=' -f 2|grep -v "^$"`
>
>         printf "%-16s%-16s%-16s%-16s%-16s%-16s\n" $res $score $node 
> $stickiness $failcount $failurestickiness
> done|sort -k 1
> _______________________________________________
> Linux-HA mailing list
> [email protected]
> http://lists.linux-ha.org/mailman/listinfo/linux-ha
> See also: http://linux-ha.org/ReportingProblems
_______________________________________________
Linux-HA mailing list
[email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems

Reply via email to