<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question HDFS sorting  files in GB in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/HDFS-sorting-files-in-GB/m-p/85657#M2988</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to automate the HDFS user space utilisation mail.&lt;/P&gt;
&lt;P&gt;Everything went correct exept the sorting of the files in gb.when i tried with bytes it is giving the correct result but in other it is not coming the expected output.&lt;/P&gt;
&lt;P&gt;please help me the get the correct output.&lt;/P&gt;
&lt;P&gt;i ll provide the script which i run in bytes as well as human readable -h in hdfs file system.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;#!/bin/bash&lt;/P&gt;
&lt;P&gt;#getting the current hdfs percentage in numeric value&lt;/P&gt;
&lt;P&gt;CURRENT=$(hdfs dfs -df -h/ | grep / | awk '{ print $8}' | sed 's/%//g')&lt;/P&gt;
&lt;P&gt;#current hdfs space utilisation&lt;BR /&gt;DiskFile=$(hdfs dfs -df -h)&lt;/P&gt;
&lt;P&gt;HdfsReport=$(hdfs dfsadmin -report)&lt;/P&gt;
&lt;P&gt;Diskuse=&lt;STRONG&gt;$(hdfs dfs -du&amp;nbsp; /user | sort -nr | head -10)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;#To get results GB i have provided&amp;nbsp;&lt;STRONG&gt;$(hdfs dfs -du -h&amp;nbsp; /user | sort -r | head -10)&lt;/STRONG&gt;&lt;BR /&gt;THRESHOLD=70&lt;BR /&gt;Critical=90&lt;/P&gt;
&lt;P&gt;if [ "$CURRENT" -gt "$THRESHOLD" ] ; then&lt;/P&gt;
&lt;P&gt;mail -s 'HDFS Usage Housekeeping required' &lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/33520"&gt;@ABC&lt;/a&gt;.com, &lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/33520"&gt;@ABC&lt;/a&gt;.com &amp;lt;&amp;lt; EOF&lt;BR /&gt;HDFS usage in Cluster is above the threshold please run the clean-up scripts asap. Used: $CURRENT%&lt;/P&gt;
&lt;P&gt;Current disk utilization report is&lt;BR /&gt;$DiskFile&lt;/P&gt;
&lt;P&gt;Please find the Utilisation report of top ten users consuming the cluster&lt;/P&gt;
&lt;P&gt;$Diskuse&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;EOF&lt;BR /&gt;fi&lt;/P&gt;
&lt;P&gt;if [ "$CURRENT" -gt "$Critical" ] ; then&lt;/P&gt;
&lt;P&gt;mail -s 'HDFS Admin Report' yy@abc.com, yyy@abc.com &amp;lt;&amp;lt; EOF&lt;BR /&gt;HDFS usage in Cluster is above critical storage, please Find the Cluster report below&lt;/P&gt;
&lt;P&gt;$HdfsReport&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;EOF&lt;BR /&gt;fi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please help me to sort out the this.&lt;/P&gt;
&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
    <pubDate>Fri, 16 Sep 2022 14:06:19 GMT</pubDate>
    <dc:creator>Jibinjks</dc:creator>
    <dc:date>2022-09-16T14:06:19Z</dc:date>
  </channel>
</rss>

