نمایش نتایج: از شماره 1 تا 1 , از مجموع 1

موضوع: ابزارهای نظارتی لینوکس 1

Threaded View

پست قبلی پست قبلی   پست بعدی پست بعدی
  1. #1
    عضو انجمن MizbanVps آواتار ها
    تاریخ عضویت
    May 2012
    نوشته ها
    108
    تشکر تشکر کرده 
    57
    تشکر تشکر شده 
    271
    تشکر شده در
    193 پست

    پیش فرض ابزارهای نظارتی لینوکس 1

    در این سری مقاله سعی من بر این است تا ابزارهای مونیتورینگ که در این قسمت (1) بیشتر کنسولی هستند را معرفی کنم و همچنین سیستم عامل رو من debian در نظر گرفتم که شما میتونید با نیازهای خودتون تغییراتی بدین.ابزارهای این شماره بنظر ساده میان ولی بسیار کاربردی هستند,در ضمن من ابزارهای متفاوتی معرفی میکنم که شما باید بهترین اونو انتخاب کنید.
    در این شماره تمرکزمون رو روی مونیتورینگ cpu , ram , swap , mount points , network interfaces از طریق کنسول و یصورت لوکال نه ریموت یعنی منابع از روی کامیپوتر دیگه گرفته نمیشه هر چند که شما میتونید از طریق putty نتایج رو از هر جای دیگه هم ببینید.

    در شماره های آینده به معرفی و نصب برنامه های پیشرفته تری میپردازیم.

    بعضی از لغات اگرترجمه بشن معنی خودشون رو از دست میدن پس من از این کار خودداری میکنم,همچنین از مشخصه های یک مدیر شبکه آشنایی با زبان انگلیسی در حد لازم برای برطرف کردن نیازهاش میباشد.
    مقدمه :
    امروزه نظارت برسیستم و منابع سیستم یکی از اساسی ترین نیازهای هر شبکه و مدیر شبکه ای برای بررسی میزان کارایی اون شبکه و سیستم میباشد.اگر منابع سیستم کم باشد یا به مرور مشکلاتی برای سیستم به وجود آمده باشد عدم آگاهی از این رخددادها عواقب وخیمی درآینده در پی خواهد داشت.
    منابع سیستم هم بوسیله کاربر می تواند مصرف شود هم بواسطه سرویس هایی که بر روی سرور قرار دارنداز قبیل وب یا میل .توانایی در جهت شناخت اتفاقاتی که در معرض روی دادن است می تواند به تشخیص اینکه سیستم احتیاج به بروزرسانی دارد یا نه کمک شایانی کند یا حتی اگر سیستم نیاز دارد تا یک سرویس به سرور دیگری منتقل شود.



    1-free
    نمایش دهنده میزانmemory آزاد و مصرف شده

    free is a UNIX command which displays the total amount of free and used physical and swap memory in the system, as well as the shared memory and buffers used by the kernel

    کد:
    free [-b|-k|-m|-g] [-l] [-o] [-t] [-s delay ] [-c count
    برای مشاهده عکس کلیک کنید
    ***************************************
    2-top
    امکان مشاهده پروسه هایی که در cpu و memroy در حال انجام هست رو فراهم میکنه
    top provides an ongoing look at processor activity in real time. It displays a listing of the most CPU-intensive tasks on the system, and can provide an interactive interface for manipulating processes. It can sort the tasks by CPU usage, memory usage and runtime. can be better configured than the standard top from the procps suite. Most features can either be selected by an interactive command or by specifying the feature in the personal or system-wide configuration file. See below for more information

    کد:
    top  [-]  [d  delay]  [p  pid]  [q]  [c]  [C]  [S]  [s]  [i]  [n  iter]  [b]
    برای مشاهده عکس کلیک کنید

    ***************************************
    3-htop
    htop تو مایه های top هستش ولی خیلی بهتر و interactive تر هست.همونطور که از عکسش معلومه براحتی میتونید پروسه ها رو Kill کنید و...من توصیه میکنم ازبجای top از این استفاده کنید منتها برای استفاده از htop باید نصبش کنید روی سیستمتون
    htop is a very competent interactive process viewer for the shell, providing all the functionality - and more - that the top utility does, in an easier and more intuitive way. htop provides easy-to-use menus for most operations and also has support for using a mouse.
    htop is an easier to use and friendlier version of top. While it hasn’t as much time behind it and therefore is less tested, it seems to work very well both locally and over SSH, and it’s well worth taking it for a spin. It’s just one of those small utilities that makes life a bit easier.
    نصب :

    کد:
    #apt-get install htop






    Comparison between htop and top
    In ‘htop’ you can scroll the list vertically and horizontally to see all processes and complete command lines.
    In ‘top’ you are subject to a delay for each unassigned key you press (especially annoying when multi-key escape sequences are triggered by accident).
    ‘htop’ starts faster (’top’ seems to collect data for a while before displaying anything).
    In ‘htop’ you don’t need to type the process number to kill a process, in ‘top’ you do.
    In ‘htop’ you don’t need to type the process number or the priority value to renice a process, in ‘top’ you do.
    ‘htop’ supports mouse operation, ‘top’ doesn’t
    ‘top’ is older, hence, more used and tested.
    ***************************************
    4-slmon
    Slmon هم برنامه جالبیه که میزان مصرف cpu ,ram همچین مقدار فضای خالی یا مصرفی mount ها ازقبیل هارد, فلش و... رو نشون میده.برای دیدن پروسه هایی که در حال انجام هستن باید روی p کیک کنید تا پروسه های لیست بشه براتون...
    SLmon is a tool for monitoring a system's performance. It displays results using a nice and easilyreadable text-based UI. It has the ability to monitor CPU load (SMP is supported), memory/filesystems usage, network interfaces, uptime, date and time, and the number of logged in users.
    نصب :

    کد:
    #apt-get install slmo

    برای مشاهده عکس کلیک کنید
    ***************************************
    5-sysstat
    sysstat حاوی sar,mpstat,iostat هستش که هر کدوم کاری انجام میدن.(منکه اصلا باهاش حال نکردم)
    نصب :

    کد:
    #apt-get install sysstat

    #apt-get install sysstat
    sar command
    The sar command collects and reports system activity information. The statistics reported by sar concern I/O transfer rates, paging activity, process-related activities, interrupts, network activity, memory and swap space utilization, CPU utilization, kernel activities and TTY statistics, among others. Both UP and SMP machines are fully supported.
    mpstat command

    The mpstat command reports global and per-processor statistics
    iostat command
    The iostat will display the current CPU load average and disk I/O information. This is a great command to monitor your disk I/O usage.
    For 2.4 kernels the devices is names using the device's major and minor number. In this case the device listed is SCSI. To have iostat print this out for you, use the -x.
    برای مشاهده عکس کلیک کنید
    ***************************************
    6-ps
    ps لیستی از پروسه هایی که الان در حال اجراست را نشان میده
    The ps will provide you a list of processes currently running. There is a wide variety of options that this command gives you

    کد:
    ps [-a] [-A] [-c] [-d] [-e] [-f] [-j] [-l] [-L] [-P] [-y] [ -g grplist ] [ -n namelist ] [-o format ] [ -p proclist ] [ -s sidlist ] [ -t term] [ -u uidlist ] [ -U uidlist ] [ -G gidlist ]



    برای اینکه لیست تمام پروسه هایی که در حال انجام هست رو ببینیم از دستور زیر استفاده میکنیم
    کد:
    #ps -ef

    برای اینکه پروسه های یک کاربر خاص رو ببینیم از دستور زیر استفاده میکنیم


    کد:
    #ps -u(defualt is current user)#ps -u zabbix
    از kill میتونیم بهمراه ps برای پابان دادن به یک پروسه استفاده کنیم..مثلا pid یه پروسه در عکس آخر ۱۱۳۸ هستش..ما برای اینکه فاتحه!! این پروسه رو بخونیم به این طریق عمل میکنیم

    کد:
    #kill -۹ ۱۱۳۸


    ۹ هم برای اطمینان از اجرا شدن مینویسیم
    ***************************************
    7-pstree
    pstree لیست پروسه هایی که الان در حال انجام هستند رو نشون میده
    pstree - display a tree of processes

    کد:
    pstree [ -a ] [ -c ] [ -h | -H pid ] [ -l ] [ -n ] [ -p ] [ -u ][ -A | -G | -U ] [ pid | user]
    برای نمایش پروسه ها بدین طریق عمل میکنیم

    کد:
    #pstree#pstree -p(show PIDs; implies -c)#pstree -n(sort output by PID)#pstree pid(start at pid, default 1 (init))#pstree user(show only trees rooted at processes of that user)
    عکس1
    عکس2
    ***************************************
    8-jmon
    jmon درصد استفاده cpu, memory , swap رو بهمون نشون میده
    The jmon tool monitors selected resources (memory, cpu, I/O) used by a running batch job on a particular machine, as well as overall machine activities


    کد:
    jmon [ -interval <seconds> ] [ -count <count> ] [ -outfile <file> ] [ -path <path> ] [ -(no)fg ] [ -version ] [ -help|? ] <jobstep-id>
    برای مشاهده خروجی :

    کد:
    #jmon
    برای مشاهده عکس کلیک کنید
    ***************************************
    9-dstat
    dstat میتونه یک جایگزین خوب برای vmsta , iostat , ifstat باشه که چند محدودیت اونها رو حل کرده وچندین قابلیت هم اضافه شده.بنظرم اگه سیستمون دچار bottleneck شده dstat میتونه کمک خوبی باشه براتون تا در یک زمان تمام منابع سیستمتون از قبیل cpu , disk usage , network bandwidth ,.... رو میتونید ببینید
    stat allows you to view all of your system resources instantly, you can eg. compare disk usage in combination with interrupts from your IDE controller, or compare the network bandwidth numbers directly with the disk throughput (in the same interval
    کد:
    dstat [-afv] [-cdgilmnpsty] [-D..] [-I..] [-N..] [delay [count]]
    برای مشاهده خروجی

    کد:
    #dstat
    برای مشاهده عکس کلیک کنید

    ***************************************
    10-vmstat
    اطلاعاتی در مورد پروسه ها , memory, cpu,swap, io ,procs در اختیارمون میزاره

    vmstat reports information about processes, memory, paging, block IO, traps, and cpu activity

    کد:
    vmstat [-V] [-n] [delay [count]]
    FIELD DESCRIPTIONS
    Procs
    r: The number of processes waiting for run time.
    b: The number of processes in uninterruptable sleep.
    w: The number of processes swapped out but otherwise runnable. This
    field is calculated, but Linux never desperation swaps.
    Memory
    swpd: the amount of virtual memory used (kB).
    free: the amount of idle memory (kB).
    buff: the amount of memory used as buffers (kB). Swap
    si: Amount of memory swapped in from disk (kB/s).
    so: Amount of memory swapped to disk (kB/s).
    IO
    bi: Blocks sent to a block device (blocks/s).
    bo: Blocks received from a block device (blocks/s).
    System
    in: The number of interrupts per second, including the clock.
    cs: The number of context switches per second.
    These are percentages of total CPU time.
    us: user time
    sy: system time
    id: idle time
    برای مشاهده عکس کلیک کنید
    ***************************************
    11-vnstat
    اگه دنبال یه راه مگیردید که ترافیک کارت شبکه هاتون رو کنترل کنید این یه ابزاره خوبه که باکنسول کار میکنه و بصور روزانه و ماهیانه براتون لاگ برداری میکنه
    vnStat is a console-base network traffic monitor that keeps a log of daily and monthly network traffic for the selected interface(s). However, it isn't a packet sniffer. The traffic information is analyzed from the proc(5) -filesystem, so that vnStat can be used without root permissions.
    نصب :


    کد:
    # apt-get install vnstat

    برای فعال کردن vnstat و ساختن دیتابیس مثلا بر روی eth0 بدین طریق عمل میکنیم

    # vnstat -u -i eth0
    u مجبور میکنه که دیتابیس آپدیت بشه یا اگه دیتابیسی وجود نداره اونو میسازه

    vnstat شروع به جمع آوری دیتا از طریق cronjob میکنه که موقع نصب بصورت خودکار اصافه میشه

    کد:
    0-55/5 * * * *   root    /usr/bin/vnstat -u
    برای دیدن اطلاعات بدیدن طریق عمل میکنیم
    کد:
    #vnstat#vnstat -h(Show traffic for the last 24 hours)#vnstat -d(Show traffic for days)#vnstat -w(Show traffic for 7 days, current and previous week)#vnstat -m(Show traffic for months)#vnstat -t (Show all time top10 traffic days)#vnstat --help

    عکس1
    عکس2
    عکس3
    عکس4
    ***************************************
    12-bwm
    bwm یک برنامه کوچولی مونیتورینگ پهنای باند هست که تا 16 تا کارت شبکه رو همزمان میتونه پشتیبانی کنه
    This is a very tiny bandwidth monitor (not X11). Can monitor up to 16 interfaces in the in the same time, and shows totals too.
    نصب :


    کد:
    #apt-get install  bwm

    برای اینکه خروجی رو ببینید بدین طریق عمل کنبد

    کد:
    #bwm
    برای مشاهده عکس کلیک کنید
    ***************************************
    13-ethstats
    ethstats خروجی کارت شبکه ها رو براساس مگابیت بر ثانیه و پکت بر ثانیه نشان میده..البته همچین با حال نیست!!
    ethstats works by parsing the /proc/net/dev file that the Linux kernel maintains, and thus utilizes a negligible amount of CPU time. ethstats shows the throughput of each device in both megabits per second and packets per second.
    نصب :

    کد:
    #apt-get  install ethstats


    برای مشاهده خروجی این طور عمل میکنیم
    برای مشاهده عکس کلیک کنید
    ***************************************
    14-ethstatus
    Ethstatus is a console-based monitoring utility for displaying statistical data of the ethernet interface on a quantity basis. It is similar to iptraf but is meant to run as a permanent console task to monitor the network load.
    نصب :

    کد:
    #apt-get  install ethstatus
    برای مشاهده خروجی این طور عمل میکنیم

    کد:
    #ethstatus
    برای مشاهده عکس کلیک کنید
    ***************************************
    15-ifstat
    ifstat is a tool to report network interfaces bandwith just like vmstat/iostat do for other system counters. It can monitor local interfaces by polling the kernel counters, or remote hosts interfaces using SNMP.
    نصب:

    کد:
    #apt-get install  ifstat
    برای مشاهده خروجی
    کد:
    #ifstat
    برای مشاهده عکس کلیک کنید
    ***************************************
    16-iftop
    iftop به کارت شبکه هامون گوش میده و بر اساس ip و host و میزان مصرف هر کدام لیست میکنه...که اگر عکس رو نگاه کنید کاملا مشهوده
    iftop does for network usage what top(1) does for CPU usage. It listens to network traffic on a named interface and displays a table of current bandwidth usage by pairs of hosts. Handy for answering the question "why is our ADSL link so slow?".
    نصب :

    کد:
    #apt-get install iftop
    برای مشاهده خروجی بدین طریق عمل میکنیم

    کد:
    #iftop -h | [-nNpbBP] [-i interface] [-f  filter code] [-F net/mask]
    or
    کد:
    #iftop
    برای مشاهده عکس کلیک کنید
    ***************************************
    17-iog

    IOG is a network I/O byte grapher made to graph cumulative KB/MB/GB totals for hours/days and months. It is intended to be simple, fast (support thousands of hosts) and integrate well with MRTG. Data for each host is updated hourly and HTML graphs are created. It uses a data consolidation algorithm which allows for a small, non-growing database file for each host. No external graphing libs or executables are required.

    نصب :
    کد:
    #apt-get install iog
    برای مشاهده خروجی بدین طریق عمل میکنیم

    کد:
    #iog
    بعد در مرورگر این آدرس رو میزنیم

    کد:
    http://serverip/iog

    18-phpsyinfo
    phpsysinfo اسکریپت php هست که اطلاعاتی در مورد سیستم از قبیل cpu,memory,uptime,network usage,.. در اختیارمون میزاره
    phpSysInfo is a customizable PHP script that parses various files in /proc and displays them. It will display information about system facts like Uptime, CPU, Memory, SCSI, IDE, PCI, Ethernet, Floppy, and Video. It now has full internationalization support along with customizable templates.
    نصب :
    این برنامه چون تحت وب هست میباست apache همراه با php رو قبلا نصب کرده باشیم, ولی در حال بدین صورت قابل انجامه

    کد:
    #apt-get install apache php4#apt-get install phpsysinfo
    موقع نصب 4 تا سوال ازتون میپرسه که هر جور که دوست دارین باید جواب بدید این عکس های 2 تا از سوالات مهمش هست
    بعد از نصب یه دایکتوری بنام phpsysinfo در /var/www/ ساخته میشه
    برای دیدن کافیه این آدرس رو در مرورگرتون بزنید
    کد:
    http://serveripaddress/phpsysinfo/
    19-df
    df به شما میگه که چه مقدار فضای آزاد و اشغال شده در هر کدام از mount های خودتون دارید از قبیل هارددیسک , فلش , ....
    The df command is used to show the amount of disk space that is free on file systems.
    کد:
    df [ -F FSType ] [-a [-b] [-e] [-g] [-k] [-l] [-n] [-t] [-V ] [ -o FSTypespecific_options ] [block_device | directory | file | resource ... ] [-P]

    برای دیدن اطلاعات بدیدن طریق عمل میکنیم


    کد:
    #df#df -m(type size in mega)#df -a(all-includinf file system having 0 block)#df - h(human-readable)#df --help

    با حالترین کامندش اینه بنظرم البته من ترجمه نمکنم و متن انگلسیشو میزارم تا با این انگلیسی دست و پاشکستم معنی و مفهمومشو خراب نکنم

    کد:
    #df -i




    This option instructs df to display information about inodes rather that file blocks. Even though you think of directory entries as pointers to files, they are just a convenience for humans. An inode is what the Linux file system uses to identify each file. When a file system is created (using the mkfs command), the file system is created with a fixed number of inodes. If all these inodes become used, a file system cannot store any more files even though there may be free disk space. The df -i command can be used to check for such a problem.
    پس اگر دیدید فضای خالی دارید ولی نمیتونید چیزی رو اضافه کنید حتما از این دستور استفاده کنید,شاید یه لبخند رو لبتون اومد و باعث شادی روح اینجانب شد.
    ***************************************
    20-discus
    discus هم مثل df برای دیدن مقدار فضای آزاد یا اشغال شده mountها کاربرد داره که فکر کنم امکاناتش از df کمتر و فقط یه گراف اضافه کرده ,همچین باید نصبش کرد.
    Discus is a GPL text-mode disk space usage program.Discus aims to make df prettier. Features include color, bar graphs, and smart formatting of numbers (automatically choosing the most suitable size from kilobytes, megabytes, gigabytes, or terabytes). Or choose your own size, along with specifying the number of decimal places.
    نصب :
    کد:
    #apt-get install discus

    برای دیدن اطلاعات بدین طریق عمل میکنیم

    کد:
    #discus#discus -m#discus -p number(number of digits to right of decimal place)#discus --help
    برای دیدن عکس کلیک کنید
    ***************************************
    21-du
    du نمدونم بشه بهش مونیتورینگ گفت یا نه ولی تو حال و هوای همین 2 تا برنامه اخیر هست گفتم معرفیش ضرر نداره که هیچ شاید کلی هم شود داشته باشه...خوب از حاشیه بیام بیرون باید بگم که این دستور برای نمایش دادن میزان فضایی که هر فایل اشغال کرده استفاده میشه
    Tells you how much space a file occupies.


    کد:
    du [-a] [-k] [-s] [-d]             [-L] [-o] [-r] [-x] directories
    بدین طریق عمل میکنیم

    کد:
    #du#du -s *.conf (Would report the size of each conf file in the current directory)#du -h *.conf(Display the size of the conf files in a friendly size format listing)#du-c(see total capacity of all the files combined)
    توجه داشته باشین که شما میتونید این subcommand ها رو با هم ترکیب کنید تا جواب بهتری بگیرید,همچنین میتونید سایز یه فایل خاص رو نگاه کنید,مثلا:
    کد:
    #du -ch reza.zip
    برای مشاهده عکس کلیک کنید
    ***************************************
    نکته:
    توجه کنید که از slmon هم میتونید برای نمایش میزان فضای استفاده شده و فضای آزاد استفاده کنید
    ***************************************








  2. تعداد تشکر ها ازMizbanVps به دلیل پست مفید


اطلاعات موضوع

کاربرانی که در حال مشاهده این موضوع هستند

در حال حاضر 1 کاربر در حال مشاهده این موضوع است. (0 کاربران و 1 مهمان ها)

موضوعات مشابه

  1. پاسخ ها: 1
    آخرين نوشته: May 22nd, 2014, 02:01
  2. پاسخ ها: 0
    آخرين نوشته: February 16th, 2014, 21:36
  3. پاسخ ها: 5
    آخرين نوشته: November 25th, 2013, 20:38
  4. پاسخ ها: 12
    آخرين نوشته: July 4th, 2013, 15:44

مجوز های ارسال و ویرایش

  • شما نمیتوانید موضوع جدیدی ارسال کنید
  • شما امکان ارسال پاسخ را ندارید
  • شما نمیتوانید فایل پیوست کنید.
  • شما نمیتوانید پست های خود را ویرایش کنید
  •