Index: controltower/html/languageConfig/content-container.html =================================================================== diff -u -rdb5fc0f444cbbffb2c1b2ac3763ac4d022d148ff -r5b5a32825b7d5d4d48172f71a091a984dc2ee3b1 --- controltower/html/languageConfig/content-container.html (.../content-container.html) (revision db5fc0f444cbbffb2c1b2ac3763ac4d022d148ff) +++ controltower/html/languageConfig/content-container.html (.../content-container.html) (revision 5b5a32825b7d5d4d48172f71a091a984dc2ee3b1) @@ -1 +1,158 @@ -스프링 컨피그를 활용한 동적 변수 처리 \ No newline at end of file +
+
+
+

+ + + Engine 수행 명령어 + +

+ +
+
+
+ +
+ OS 종류 별 Engine 수집 명령어 입니다. + +
+
+
+
+ +
+
+
List View (Excel)
+ +
+
+ +
+
+
+
+ \ No newline at end of file Index: controltower/html/template/page-sidebar.html =================================================================== diff -u -rdb5fc0f444cbbffb2c1b2ac3763ac4d022d148ff -r5b5a32825b7d5d4d48172f71a091a984dc2ee3b1 --- controltower/html/template/page-sidebar.html (.../page-sidebar.html) (revision db5fc0f444cbbffb2c1b2ac3763ac4d022d148ff) +++ controltower/html/template/page-sidebar.html (.../page-sidebar.html) (revision 5b5a32825b7d5d4d48172f71a091a984dc2ee3b1) @@ -18,10 +18,6 @@   Invoice Billing - Index: controltower/js/languageConfig.js =================================================================== diff -u -rdb5fc0f444cbbffb2c1b2ac3763ac4d022d148ff -r5b5a32825b7d5d4d48172f71a091a984dc2ee3b1 --- controltower/js/languageConfig.js (.../languageConfig.js) (revision db5fc0f444cbbffb2c1b2ac3763ac4d022d148ff) +++ controltower/js/languageConfig.js (.../languageConfig.js) (revision 5b5a32825b7d5d4d48172f71a091a984dc2ee3b1) @@ -41,7 +41,8 @@ "../reference/lightblue4/docs/lib/widgster/widgster.js", "../reference/lightblue4/docs/lib/slimScroll/jquery.slimscroll.min.js", "../reference/lightblue4/docs/lib/jquery.sparkline/index.js", - "../reference/lightblue4/docs/js/charts.js" + "../reference/lightblue4/docs/js/charts.js", + "./js/common/jspreadsheet/spreadsheet.js" ], [ @@ -71,10 +72,128 @@ // 사이드 메뉴 색상 설정 $(".widget").widgster(); - setSideMenu("sidebar_menu_security", "sidebar_menu_security_group"); + setSideMenu("sidebar_menu_config", "sidebar_menu_config_language"); + + drawExcel("modal_excel"); }) .catch(function (error) { console.error("플러그인 로드 중 오류 발생"); console.log(error); }); } + + +///////////////////////////////////////////////// +// 엑셀 그리기 +///////////////////////////////////////////////// +function drawExcel(targetId) { + console.log("generalConfig :: drawExcel"); + let $targetId = "#"+targetId; + + if($($targetId)[0].jexcel) { + $($targetId)[0].jexcel.destroy(); + } + + var excel_width = $($targetId).width() - 50; + + // 컬럼 설정 + var columnList = [ + { type: "text", title: "설명", wRatio: 0.16}, + { type: "text", title: "리눅스", wRatio: 0.21}, + { type: "text", title: "윈도우", wRatio: 0.21}, + { type: "text", title: "윈도우 2008 R2 & SP2", wRatio: 0.21}, + { type: "text", title: "유닉스", wRatio: 0.20}, + ]; + + SpreadSheetFunctions.setColumns(columnList); + SpreadSheetFunctions.setColumnWidth(excel_width); + + var customOption = { + search: true, + updateTable: function(instance, cell, col, row, val, id) { + cell.style.textAlign = "left"; + cell.style.whiteSpace = "normal"; + } + }; + + SpreadSheetFunctions.setOptions(customOption); + let data; + $.getJSON('./mock/engine_command.json', function(jsonData) { + data = jsonData.map(arr => arr.slice(0,-1)); + + $($targetId).spreadsheet($.extend({}, { + columns: SpreadSheetFunctions.getColumns(), + data: data + }, SpreadSheetFunctions.getOptions())); + SpreadSheetFunctions.setExcelData(data); + $("#modal_excel .jexcel_content").css("width","100%"); + $("#modal_excel .jexcel_content").css("max-height","420px"); + }).fail(function(jqxhr, textStatus, error) { + console.error("Error loading JSON file: " + textStatus + ", " + error); + }); +} + +var SpreadSheetFunctions = (function () { + + let $tabFunction_data; // 엑셀 데이터 + let $tabFunction_columns;// 엑셀 컬럼 + let $tabFunction_options;// 엑셀 (커스텀)옵션 :: 정의 안할 경우 default + + var setExcelData = function(data) { + $tabFunction_data = data; + }; + var getExcelData = function () { + return $tabFunction_data; + }; + var setColumns = function(columns) { + console.log("setColumns start"); + $tabFunction_columns = columns; + console.log("setColumns fin"); + }; + var getColumns = function () { + return $tabFunction_columns; + }; + var setOptions = function(options) { + $tabFunction_options = options; + }; + var getOptions = function() { + return $tabFunction_options ? $tabFunction_options : null; + }; + var setColumnWidth = function (width) { + console.log("setColumnWidth start"); + if ($tabFunction_columns) { + $tabFunction_columns = $tabFunction_columns.map(column => ({ + ...column, width: width * column.wRatio + })); + } + console.log("setColumnWidth end"); + }; + /* + var resizeObserver = new ResizeObserver(function(entries) { + for (let entry of entries) { + var width = entry.contentRect.width; + var height = entry.contentRect.height; + handleResize(entry.target.id, width, height); + } + }); + + // 모달요소 크기 변화 관찰 + resizeObserver.observe(document.getElementById('modal_excel'));*/ + + function handleResize(id,width, height) { + if (id ==="modal_excel" && height !== 0) { + if ($tabFunction_data) { + drawExcel("modal_excel"); + } else { + console.log("엑셀 데이터 없음"); + } + } + } + + return { + setExcelData, getExcelData, + setColumns, getColumns, + setOptions, getOptions, + setColumnWidth, + }; +})(); Index: controltower/mock/engine_command.json =================================================================== diff -u --- controltower/mock/engine_command.json (revision 0) +++ controltower/mock/engine_command.json (revision 5b5a32825b7d5d4d48172f71a091a984dc2ee3b1) @@ -0,0 +1,163 @@ +[ + ["1.해당 OS의 계정 목록을 조회", + "cat /etc/passwd|grep -v nologin", + "Get-WmiObject -Class Win32_UserAccount -Filter \"LocalAccount=True\" | select Name |Format-Wide", + "powershell -Command \"Get-WmiObject -Class Win32_UserAccount | Select-Object Name\"", + "cat /etc/passwd | grep -v nologin", + "esxcli user list" + ], + ["2. 해당 OS의 Process 정보를 조회", + "whoami \n hostname \n ps -auxfw|grep -v '\\['|awk '{$5=$6=$7=$8=$9=$10=\"\"; print$0}' \n ls -l /proc/%s/exe --color=never \n ls -l /proc/%s/cwd --color=never", + "get-wmiobject win32_process | where commandLine -ne $null | Format-List -Property @{n=\"owner\";e={$_.getowner().user}},ProcessId,@{n=\"mem\";e={$_.ws/1MB*100 / ((Get-CimInstance Win32_PhysicalMemory | Measure-Object -Property capacity -Sum).sum / 1024 / 1024)}},@{n=\"cpu\";e={(Get-CimInstance Win32_PerfFormattedData_PerfProc_Process | where IDProcess -match $_.processId).PercentProcessorTime}},Name,path,commandLine", + "$processes = Get-WmiObject Win32_PerfFormattedData_PerfProc_Process | Sort-Object PercentProcessorTime -Descending | Select-Object; $processes | ForEach-Object { [PSCustomObject]@{ Name = $_.Name; CPUPercent = $_.PercentProcessorTime; Description = $_.Description } }", + "solaris \n /usr/ucb/whoami \n hostname \n pid=YOUR_PID; ps -efo user,pid,pcpu,pmem,ppid,args | grep -v '\\[' | awk '{$5=\"\\\";print$0}'; pmap $pid | egrep -v '\\:|\\[' | head -1 | awk '{print $4}'; pwdx $pid \n\n HPUX \n whoami \n hostname \n totalMemory= /usr/contrib/bin/machinfo|grep Memory \n UNIX95= ps -e -o user,pid,pcpu,vsz,args | grep -v '\\\\[' | awk '{ printf \\\"%.1f \\\", $4/1024*100/\"+totalMemory+\"; print $0}' \n pwd %s", + "" + ], + ["3. 해당 OS의 디스크 정보를 조회", + "df -T 2>/dev/null | grep -v ilesystem |grep -v tmpfs | awk '{$4=$5=$6=\"\";print $0}'", + "Get-WmiObject -Class Win32_LogicalDisk |\n Select-Object @{Name='Drive';Expression={$_.DeviceID.Replace(':', ':\\\\')}}, FileSystem, \n @{Name='SizeKB';Expression={$_.Size / 1KB}}, \n @{Name='DriveType';Expression={\n Switch ($_.DriveType) {\n 0 { 'Unknown' }\n 1 { 'No_Root_Directory' }\n 2 { 'Removable_Disk' }\n 3 { 'Local_Disk' }\n 4 { 'Network_Drive' }\n 5 { 'Compact_Disc' }\n 6 { 'RAM_Disk' }\n default { \\\"Unknown ($($_.DriveType))\\\" }\\n\" \n }\n }} | Format-Table -HideTableHeaders", + "powershell -Command \"Get-WmiObject -Class Win32_LogicalDisk | Select-Object DeviceID, VolumeName, Size, FreeSpace\"", + "solaris \n df -k 2>/dev/null | awk '$2 != 0' | tail +2 | awk '{$3=$4=$5=\\\"\\\";print $0}' \n df -n \n\n HPUX \n bdf | tail +2 | awk '{$3=$4=$5=\\\"\\\";print $0}' \n df -n \n\n AIX \n lsfs -a", + "" + ], + ["4. 해당 OS의 이름을 조회", + "cat /etc/*release*", + "(Get-CimInstance -ClassName CIM_OperatingSystem).Caption", + "powershell -Command \"(Get-ItemProperty -Path \\'HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\').ProductName\"", + "solaris \n more /var/sadm/softinfo/INST_RELEASE \n\n HPUX \n /usr/contrib/bin/machinfo|grep Release \n\n AIX \n uname -a", + "" + ], + ["5. 해당 OS의 버전을 조회", + "cat /etc/*release*", + "(Get-WMIObject win32_operatingsystem) | Select Version | Format-Wide", + "powershell -Command \"(Get-ItemProperty -Path \\'HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\').ProductName\"", + "solaris \n more /var/sadm/softinfo/INST_RELEASE \n\n HPUX \n /usr/contrib/bin/machinfo|grep Release \n\n AIX \n oslevel -s", + "" + ], + ["6. CPU의 코어 개수를 조회", + "cat /etc/*release*", + "$cpu = Get-WmiObject -Class Win32_Processor -ComputerName. | Select-Object -Property NumberOfCores | Sort-object -Property NumberOfCores -Descending; $cpu[0] | Format-wide", + "powershell -Command \"(Get-WmiObject Win32_Processor).NumberOfCores\"", + "solaris \n /usr/bin/kstat -m cpu_info | grep core_id | awk '{ print $2 }' | sort -u | wc -l \n\n HPUX \n ioscan -fknC processor|grep processor|wc -l \n\n AIX \n lparstat -i | grep Entitled", + "" + ], + ["7. CPU소켓의 개수를 조회", + "lscpu|grep Thread", + "$cpu = (Get-CimInstance -ClassName Win32_ComputerSystem).NumberOfProcessors; $cpu[0] | Format-wide", + "\"powershell -Command \\\"(Get-WmiObject Win32_ComputerSystem).NumberOfProcessors\\\"\"", + "solaris \n /usr/sbin/psrinfo -p \n\n AIX \n lscfg -vp |grep WAY", + "" + ], + ["8. CPU의 스레드당 코어 개수를 조회", + "lscpu|grep Socket", + "$cpu = Get-WmiObject -Class Win32_processor | Select-Object @{Name=\\\"Thread(s) per core\\\";Expression={$_.NumberOfLogicalProcessors/\"+corePerSocket+\"}}; $cpu[0] | Format-Wide", + "powershell -Command \"(Get-WmiObject Win32_Processor).NumberOfLogicalProcessors\"", + "solaris \n /usr/bin/kstat -m cpu_info | grep 'module: cpu_info' | awk '{ print $4 }' | sort -u | wc -l \n\n HPUX kctune|grep -i lcpu|awk '{print $2}' \n\n AIX \n bindprocessor -q", + "" + ], + ["9. CPU의 모델명을 조회", + "cat /proc/cpuinfo | grep 'model name' | tail -1", + "$cpu = Get-WmiObject -Class Win32_processor | Select-Object Name; $cpu[0] | Format-Wide", + "powershell -Command \"(Get-WmiObject Win32_Processor).Name\"", + "solaris \n psrinfo -pv|tail -1 \n\n HPUX \n /usr/contrib/bin/machinfo|head -2|tail -1 \n\n AIX \n prtconf | grep \"Processor Type\"", + "" + ], + ["10. os의 bootup 타임을 조회", + "last reboot|tail -n 1", + "Get-CimInstance -ClassName win32_operatingsystem | Select-Object @{Name=\\\"boot up time\\\";Expression={\\\"{0:ddd MMM d HH:mm:ss yyyy}\\\" -f $_.LastBootUpTime}} | Format-Wide", + "powershell -Command \"(Get-WmiObject Win32_OperatingSystem).LastBootUpTime\"", + "solaris \n last reboot|tail -1 \n\n HPUX \n last reboot|tail -1 \n\n AIX \n uptime", + "" + ], + ["11. os의 총 메모리를 조회", + "cat /proc/meminfo | grep MemTotal", + "(Get-CimInstance Win32_PhysicalMemory | Measure-Object -Property capacity -Sum).sum / 1024", + "powershell -Command \"(Get-WmiObject Win32_ComputerSystem).TotalPhysicalMemory\"", + "solaris \n prtconf|grep Mem \n\n HPUX \n /usr/contrib/bin/machinfo|grep Memory \n\n AIX \n lpsratat -i | grep MemTotal", + "" + ], + ["12. cpu의 클럭(mhz)를 조회", + "cat /proc/cpuinfo| head -n 13|grep 'cpu MHz'", + "$cpu = Get-WmiObject -Class Win32_processor | Select-Object MaxClockSpeed; $cpu[0] | Format-Wide", + "powershell -Command \"(Get-WmiObject Win32_Processor).MaxClockSpeed\"", + "solaris \n psrinfo -pv|grep -i 'MHz' \n\n HPUX \n /usr/contrib/bin/machinfo|grep 'GHz' \n\n AIX \n prtconf | grep \"Processor Clock Speed:\"", + "" + ], + ["13. cpu의 벤더사를 조회", + "lscpu|grep Vendor", + "$cpu = Get-WmiObject -Class Win32_processor | Select-Object Manufacturer; $cpu[0] | Format-Wide", + "powershell -Command \"(Get-WmiObject Win32_Processor).Manufacturer\"", + "solaris \n kstat cpu_info|grep -i 'vendor'|awk '{print $2}' | tail -1 \n\n HPUX \n /usr/contrib/bin/machinfo -v|grep Vendor \n\n AIX \n prtconf | grep \"Processor Type\"", + "" + ], + ["14. os의 커널 버전을 조회", + "uname -r", + "$host | select Version | Format-Wide", + "powershell -Command \"(Get-WmiObject Win32_OperatingSystem).Version\"", + "solaris \n uname -r \n\n HPUX \n uname -r \n\n AIX \n uname -r", + "" + ], + ["15. os의 디스크 총량을 조회", + "df -P | grep -v '^Filesystem' | awk '$1 !~ /overlay/ {sum += $2} END { print sum/1024/1024 \" GB\" }'", + "(Get-CimInstance Win32_LogicalDisk | Measure-Object -Property Size -Sum).sum / 1024 / 1024 / 1024", + "03번 command 결과 합산", + "solaris \n df -k | grep -v ilesystem | awk '{sum += $2/1024} END { printf \\\"%d\\\\n\\\",sum}' \n\n HPUX \n bdf | grep -v ilesystem | awk '{sum += $2/1024} END { printf \\\"%d\\\\n\\\",sum}' \n\n AIX \n df -g | grep -v ilesystem | awk '{sum += $2/1024} END { printf \\\"%d\\\\n\\\",sum}'", + "" + ], + ["16. hosts 파일을 조회", + "cat /etc/hosts", + "Get-Content C:\\Windows\\System32\\drivers\\etc\\hosts", + "powershell -Command \"Get-Content C:\\Windows\\System32\\drivers\\etc\\hosts\"", + "solaris \n cat /etc/hosts \n\n HPUX \n cat /etc/hosts \n\n AIX \n cat /etc/hosts", + "" + ], + ["17. netstat 정보를 조회", + "netstat -antplF |grep -v \"::\" | awk '{$2=$3=$6=\"\"; print $0 }'", + "netstat -ano | findstr \"TCP\" | findstr /v \"CLOSE_WAIT\" | findstr /v \"TIME_WAIT\" | findstr /v \"::\" | findstr /v \"127.0.0.1\" | ForEach-Object { $line = $_ -split \"\\s+\"; $line[4] = (Get-Process -Id $line[5]).ProcessName; $line[5] = \"\"; $line -join \" \" }\n", + "powershell -Command \"netstat -ano\"", + "solaris \n netstat -an -P tcp -f inet | awk 'NR>4 {print $1,$2}' \n\n HPUX \n bdf |grep -v Filesystem|awk '{sum += $2} END {print sum/1024/1024}' \n\n AIX \n netstat -an", + "" + ], + ["18. 총 메모리를 조회", + "cat /proc/meminfo | grep MemTotal", + "(Get-CimInstance Win32_PhysicalMemory | Measure-Object -Property capacity -Sum).sum / 1024", + "11번 command와 동일", + "solaris \n prtconf|grep Mem \n\n HPUX \n /usr/contrib/bin/machinfo|grep Memory \n\n AIX \n lparstat -i | grep MemTotal", + "" + ], + ["19. cpu의 상세 정보를 조회(캐시,버퍼,점유율)", + "vmstat | tail -n 1", + "Get-CIMInstance Win32_OperatingSystem | Select FreePhysicalMemory | Format-Wide \n (((Get-Counter -Counter \"\\memory\\*\"|select -ExpandProperty countersamples|? {($_.path -ilike \"*\\memory\\standby*\")-or ($_.path -ilike \"*\\memory\\modified page list bytes\")}).cookedvalue|Measure-Object -Sum).Sum) / 1024 \n $cpu = Get-WmiObject Win32_Processor | Select LoadPercentage;$cpu[0] | Format-wide \n Get-WmiObject -Class WIN32_OperatingSystem | Select-Object @{Name = \"Mem Percentage\"; Expression = {((($_.TotalVisibleMemorySize - $_.FreePhysicalMemory)*100)/ $_.TotalVisibleMemorySize)}} | Format-Wide", + "powershell -Command \"Get-WmiObject Win32_Processor | Select-Object Name,LoadPercentage,L2CacheSize,L3CacheSize,CurrentClockSpeed,CurrentVoltage\"", + "solaris \n vmstat | tail -1 \n\n HPUX \n vmstat | tail -1 \n\n AIX \n vmstat | tail -1", + "" + ], + ["20. 디스크의 총 사이즈를 조회", + "df -P | grep -v ilesystem | awk '$1 !~ /overlay/ {sum += $2/1024} END { printf \"%d\\n\",sum}'", + "(Get-CimInstance Win32_LogicalDisk | Measure-Object -Property Size -Sum).sum / 1024", + "03번 내용과 동일", + "solaris \n df -k | grep -v ilesystem | awk '{sum += $2/1024} END { printf \\\"%d\\\\n\\\",sum}' \n\n HPUX \n bdf | grep -v ilesystem | awk '{sum += $2/1024} END { printf \\\"%d\\\\n\\\",sum}' \n\n AIX \n df -g | grep -v ilesystem | awk '{sum += $2/1024} END { printf \\\"%d\\\\n\\\",sum}'", + "" + ], + ["21. 디스크의 사용량을 조회", + "df -P | grep -v ilesystem | awk '$1 !~ /overlay/ {sum += $3/1024} END { printf \"%d\\n\",sum}'", + "(Get-CimInstance Win32_LogicalDisk | Measure-Object -Property Size -Sum).sum / 1024 - (Get-CimInstance Win32_LogicalDisk | Measure-Object -Property FreeSpace -Sum).sum / 1024", + "03번 내용과 동일", + "solaris \n df -k | grep -v ilesystem | awk '{sum += $3/1024} END { printf \\\"%d\\\\n\\\",sum}' \n\n HPUX \n bdf | grep -v ilesystem | awk '{sum += $3/1024} END { printf \\\"%d\\\\n\\\",sum}' \n\n AIX \n df -g | grep -v ilesystem | awk '{sum += $3/1024} END { printf \\\"%d\\\\n\\\",sum}'", + "" + ], + ["22. 해당 OS의 로컬디스크와 네트워크 디스크의 사용률, 네트워크 디스크의 타입을 조회", + "df -TP | awk 'NR>1 && $2!=\"tmpfs\" && $2!=\"overlay\" {if ($2==\"nfs4\" || $2==\"smbfs\" || $2==\"cifs\") {network_used+=$4; network_total+=$3; network_type[$2]=1} else {local_used+=$4; local_total+=$3}} END {local_percent=(local_used+local_total)>0 ? local_used/local_total*100 : 0; network_percent=(network_used+network_total)>0 ? network_used/network_total*100 : 0; printf \"%d\\n%d\\n\", int(local_percent), int(network_percent); for (type in network_type) printf \"%s \", type; printf \"\\n\"}'", + "Get-PSDrive | ? { $_.Provider -in @('nfs','cifs','smbfs') } | %{ $network_used+=$_.Used; $network_total+=$_.Free + $_.Used }; Get-PSDrive | ? { $_.Provider -notmatch 'nfs|cifs|smbfs' } | %{ $local_used+=$_.Used; $local_total+=$_.Free + $_.Used }; $local_percent = if($local_total -gt 0){ $local_used / $local_total * 100 } else { 0 }; $network_percent = if($network_total -gt 0){ $network_used / $network_total * 100 } else { 0 }; Write-Host \\\"$([math]::Round($local_percent))\\\"; Write-Host \\\"$([math]::Round($network_percent))\\\"; Write-Host \\\"$(Get-PSDrive | ? { $_.Provider -in @('nfs','cifs','smbfs') } | % Provider | Select-Object -Unique | Out-String | %{ $_.TrimEnd() })\\\"", + "powershell -Command \"Get-WmiObject Win32_NetworkConnection | Select-Object LocalName,RemoteName,ProviderName,ConnectionType,Status\" \n powershell -Command \\\"Get-WmiObject -Class Win32_MappedLogicalDisk | Select-Object Caption,DeviceID,FileSystem,FreeSpace,Name,ProviderName,Size\\\"", + "", + "" + ], + ["23. Linux 의 Crontab 정보 조회", + "cat /etc/passwd|grep -v nologin|grep -v /bin/false|grep -v /bin/sync|grep -v /sbin/shutdown|grep -v /sbin/halt \n crontab -u %s -l", + "", + "", + "solaris \n cat /etc/passwd|egrep -v \"nologin|/bin/false|/bin/sync|/sbin/shutdown|/sbin/halt\" \n crontab -l %s \n\n HPUX \n cat /etc/passwd|egrep -v \"nologin|/bin/false|/bin/sync|/sbin/shutdown|/sbin/halt\" \n crontab -l %s \n\n AIX \n ls -al /var/spool/cron/crontabs/", + "" + ] +] \ No newline at end of file