Xây dựng chương trình quản lý và giám sát hệ thống iptv

128 41 0
Xây dựng chương trình quản lý và giám sát hệ thống iptv

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

ĐẠI HỌC QUỐC GIA THÀNH PHỐ HỒ CHÍ MINH TRƯỜNG ĐẠI HỌC BÁCH KHOA PHAN VĂN VINH XÂY DỰNG CHƯƠNG TRÌNH QUẢN LÝ VÀ GIÁM SÁT HỆ THỐNG IPTV Chuyên ngành: Kỹ thuật điện tử LUẬN VĂN THẠC SĨ Tp HCM, tháng 10 năm 2010 CƠNG TRÌNH ĐƯỢC HỒN THÀNH TẠI TRƯỜNG ĐẠI HỌC BÁCH KHOA ĐẠI HỌC QUỐC GIA TP HỒ CHÍ MINH Cán hướng dẫn khoa học: TS NGUYỄN MINH HOÀNG (Ghi rõ họ, tên, học hàm, học vị chữ ký) Cán chấm nhận xét 1: (Ghi rõ họ, tên, học hàm, học vị chữ ký) Cán chấm nhận xét 2: (Ghi rõ họ, tên, học hàm, học vị chữ ký) Luận văn thạc sĩ bảo vệ Trường Đại học Bách Khoa, ĐHQG Tp.HCM ngày tháng năm Thành phần Hội đồng đánh giá luận văn thạc sĩ gồm: (Ghi rõ họ, tên, học hàm, học vị Hội đồng chấm bảo vệ luận văn thạc sĩ) Xác nhận Chủ tịch Hội đồng đánh giá LV Bộ môn quản lý chuyên ngành sau luận văn sửa chữa (nếu có) Chủ tịch Hội đồng đánh giá LV Bộ môn quản lý chuyên ngành TRƯỜNG ĐẠI HỌC BÁCH KHOA PHÒNG ĐÀO TẠO SĐH CỘNG HÒA XÃ HỘI CHỦ NGHĨA VIỆT NAM Độc lập - Tự - Hạnh phúc Tp HCM, ngày tháng năm 2010 NHIỆM VỤ LUẬN VĂN THẠC SĨ Họ tên học viên: PHAN VĂN VINH Phái: Nam Ngày, tháng, năm sinh: 12/08/1984 Nơi sinh: Sông Bé Chuyên ngành: Kỹ thuật điện tử MSHV: 01408391 I- TÊN ĐỀ TÀI: XÂY DỰNG CHƯƠNG TRÌNH QUẢN LÝ VÀ GIÁM SÁT HỆ THỐNG IPTV II- NHIỆM VỤ VÀ NỘI DUNG: Tìm hiểu tổng quan hệ thống IPTV Tìm hiểu giao thức quản lý giám sát hệ thống mạng Tìm hiểu chương trình quản lý giám sát có Xây dựng chương trình quản lý giám sát hệ thống IPTV Nhận xét đánh giá kết thu Kết luận III- NGÀY GIAO NHIỆM VỤ: 15 – 01 – 2010 IV- NGÀY HOÀN THÀNH NHIỆM VỤ: 10 – 10 – 2010 V- CÁN BỘ HƯỚNG DẪN (Ghi rõ học hàm, học vị, họ, tên): …TS NGUYỄN MINH HOÀNG… CÁN BỘ HƯỚNG DẪN (Họ tên chữ ký) CN BỘ MƠN QL CHUN NGÀNH LỜI CẢM ƠN  Tơi xin cảm ơn Quý Thầy Cô trường Đại học Bách khoa Tp.HCM, đặc biệt Thầy Cô thuộc Bộ mơn Viễn thơng, người tận tình giảng dạy truyền đạt cho kiến thức suốt q trình học trường Tơi xin bày tỏ lịng biết ơn sâu sắc đến Thầy TS Nguyễn Minh Hoàng, Thầy dành thời gian quý báu để tận tình hướng dẫn, góp ý giúp đỡ tơi hồn thành luận văn Cuối cùng, tơi xin bày tỏ lịng biết ơn đến gia đình bạn bè động viên, giúp đỡ năm tháng học tập, đặc biệt suốt thời gian thực đề tài Với thời gian ngắn, dù cố gắng không tránh khỏi thiếu sót, tơi xin học hỏi lời dẫn, góp ý Q Thầy Cơ, anh chị bạn! Tp HCM, tháng 10 năm 2010 Học viên thực Phan Văn Vinh TÓM TẮT Hiện nay, dịch vụ IPTV (Internet Protocol Television) ngày chiếm ưu mặt nội dung số lượng người phục vụ, cho thấy ưu điểm hệ truyền hình Đối với nhà cung cấp dịch vụ, sau triển khai, lắp đặt hệ thống thành công cung cấp dịch vụ cho khách hàng, nhiệm vụ quan trọng trì hệ thống ln hoạt động ổn định, kịp thời khắc phục có cố xảy Để thực nhiệm vụ này, nhà cung cấp dịch vụ thường chọn giải pháp mua phần mềm quản lý giám sát từ hãng cung cấp thiết bị với chi phí lớn Phần mềm có nhiều hạn chế như: áp dụng với thiết bị hãng đó, người dùng phải cài đặt phần mềm máy client, phần mềm không hỗ trợ quản lý Web, khơng tương thích với số hệ điều hành (Operating system), giao diện thay đổi, thêm, bớt hay mở rộng tính cần thiết Đề tài “Xây dựng chương trình quản lý giám sát hệ thống IPTV” giải vấn đề Với giao diện quản lý Web-based (dựa Web) thân thiện, người dùng dễ dàng truy cập vào chương trình qua Internet dùng Web-browser (trình duyệt Web) Có tính phù hợp với nhu cầu quản lý giám sát hệ thống IPTV như: giám sát hiệu hệ thống (việc sử dụng CPU, RAM, ổ cứng, băng thơng; có sơ đồ mạng với thông tin kết nối băng thông sử dụng…), giám sát dịch vụ (LiveTV, VoD, HTTP…), chức quản lý STB (Set-top-Box), khách hàng IPTV, chức bảo mật (giám sát user truy nhập, lưu lượng vào/ra…), thống kê trạng thái đối tượng giám sát Chương trình có cảnh báo lỗi qua hệ thống logging, gởi email thông báo cố đến người quản trị Và đặc biệt chương trình dựa vào phần mềm mã nguồn mở (hồn tồn miễn phí) Nagios, Cacti, Ntop, Syslog… cài đặt hệ điều hành Linux (CentOS 5.2) đem lại lợi ích thiết thực cho doanh nghiệp Chương trình có cấu trúc mở, nên hồn tồn hiệu chỉnh giao diện, mở rộng thêm tính (dưới dạng plugin), áp dụng hệ thống mạng khác ABSTRACT Nowadays, IPTV (Internet Protocol Television) service is predominating over its contents as well as the number of people served, showing the advantages of a new broadcasting generation For service providers, after installing system successfully and providing service to customers, there is a need to maintain a stable system, to solve broken-down system as soon as possible To perform this task, service providers often choose to purchase the management and monitoring software from the equipment suppliers at huge cost This software has many limitations such as only applying to such company's equipments, users must install software on their computer, software is not compatible with some operating systems or not support Web management, the GUI (Graphic user interface) cannot be changed nor added, deleted, and expanded necessary features The thesis named "Implementing a program for managing and monitoring IPTV system" can solve the above mentioned problems With friendly web-based user interface, users can easily access to the program via the Internet using Web browser There are features correlating with demand for managing and monitoring IPTV system, e.g monitoring system performance (CPU usage, RAM, hard drive, bandwidth with network map having connecting information and bandwidth usage ), monitoring services (LiveTV, VoD, HTTP ), management feature of STB (Set-top-Box) and IPTV customers, security functions (monitoring user access, incoming and outgoing traffic), providing statistics of monitored objects The system administrator can be alerted via logging system, email notification of problem Especially, this program is based entirely on open-source software (totally for free) such as Nagios, Cacti, ntop, syslog, etc, and also run on Linux operating system (e.g CentOS 5.2) It promises to bring a lot of benefits for companies Since the program has open-architecture, it is possible to modify the interface, to add new features, as well as to implement it into other networks i MỤC LỤC Danh mục hình iv Danh mục bảng v Danh mục từ viết tắt vi Chương MỞ ĐẦU 1.1 Đặt vấn đề 1.2 Đối tượng phạm vi nghiên cứu đề tài 1.3 Nội dung nghiên cứu 1.4 Ý nghĩa đề tài Chương TỔNG QUAN VỀ HỆ THỐNG IPTV 2.1 Giới thiệu IPTV 2.2 Kiến trúc hệ thống IPTV 2.3 IP Multicast 10 2.3.1 Cấu trúc địa IP Multicast 11 2.3.2 Giao thức IGMP 12 2.4 Giao thức RTP/RTSP 15 2.4.1 Giao thức RTP 15 2.4.2 Giao thức RTSP 18 Chương GIAO THỨC QUẢN LÝ MẠNG 20 3.1 Giới thiệu SNMP 20 3.2 SNMPv1 SNMPv2 20 3.2.1 SNMP UDP 20 3.2.2 SNMP Community 21 3.2.3 SMI 22 3.2.4 MIB-II 22 3.2.5 Hoạt động SNMP 24 ii 3.2.6 SNMP trap 27 3.2.7 SNMP Notification 28 3.2.8 SNMP inform/report 28 3.3 SNMPv3 29 3.3.1 SNMPv3 Engine 29 3.3.2 SNMPv3 application 30 3.3.3 USM 31 3.3.4 VACM 33 3.4 RMON 35 Chương TÌM HIỂU CÁC CHƯƠNG TRÌNH QUẢN LÝ VÀ GIÁM SÁT 38 4.1 Giới thiệu 38 4.2 Nagios 42 4.2.1 Host service 44 4.2.2 Plugin 44 4.2.3 Remote excusion 45 4.2.4 Scheduling 46 4.2.5 Notification 50 4.3 Cacti 51 4.3.1 Hoạt động Cacti 51 4.3.2 Cơ RRDTool 52 4.4 NTOP 53 4.5 Syslog-ng 55 Chương XÂY DỰNG CHƯƠNG TRÌNH QUẢN LÝ VÀ GIÁM SÁT IPTV 58 5.1 Yêu cầu chương trình 58 5.2 Xây dựng chương trình 61 5.2.1 Cài đặt Nagios 61 iii 5.2.2 Cài đặt NRPE 64 5.2.3 Cài đặt Cacti 65 5.2.4 Cài đặt Monit 67 5.2.5 Cài đặt NTOP 68 5.3 Xây dựng plugins cho chương trình 69 5.4 Kết thực 82 Chương KẾT LUẬN VÀ HƯỚNG PHÁT TRIỂN 94 6.1 Kết luận 94 6.2 Hướng phát triển đề tài 98 TÀI LIỆU THAM KHẢO 99 PHỤ LỤC 100 iv DANH MỤC HÌNH Hình 2.1: Vị trí IPTV mạng băng rộng Hình 2.2: Cấu trúc IPTV Headend Hình 2.3: Unicast – Broadcast – Multicast 10 Hình 2.4: Sự ánh xạ địa IP Multicast địa Ethernet MAC 12 Hình 2.5: Bản tin truy vấn IGMP router host 15 Hình 2.6: Cấu trúc RTP packet header 17 Hình 2.7: Hoạt động RTSP 19 Hình 3.1: Mơ hình giao tiếp TCP/IP SNMP 21 Hình 3.2: MIB-II subtree 23 Hình 3.3: Hoạt động get request 24 Hình 3.4: Hoạt động getbulk request 26 Hình 3.5: Hoạt động set request 27 Hình 3.6: Hoạt động Trap 27 Hình 3.7: SNMPv3 Entity 30 Hình 3.8: Cấu trúc tin SNMPv3 32 Hình 3.9: Sơ đồ logic VACM 34 Hình 3.10: Cây RMON 36 Hình 4.1: Mơ hình mạng thực tế 38 Hình 4.2: Sắp xếp kiện 47 Hình 4.3: Nagios kiểm tra lần service (với hệ số chèn 3) 49 Hình 5.1: Kiến trúc chương trình giám sát IPTV 60 Hình 5.2: Mơ hình hoạt động NRPE 64 Hình 5.3: Mơ hình hoạt động Monit 68 102 /* called for each local interface over which the multicast */ /* datagrams are to be received */ group.imr_multiaddr.s_addr = inet_addr("226.1.1.1"); group.imr_interface.s_addr = inet_addr("203.106.93.94"); if(setsockopt(sd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *)&group, sizeof(group)) < 0) { perror("Adding multicast group error"); close(sd); exit(1); } else printf("Adding multicast group OK.\n"); /* Read from the socket */ datalen = sizeof(databuf); if(read(sd, databuf, datalen) < 0) { perror("Reading datagram message error"); close(sd); exit(1); } else { printf("Reading datagram message OK.\n"); printf("The message from multicast server is: \"%s\"\n", databuf); } return 0; } A.2 OpenRTSP Open RTSP chương trình dùng để mở nhận liệu media (có thể ghi thành file) phương thức RTSP URL Ví dụ URL bắt đầu với rtsp:// Thực thi chương trình: Cách đơn giản để thực thi chương trình là: openRTSP Cấu trúc chương trình Chương trình sử dụng thư viện “LIVE555 Streaming Media” Chương trình gồm file chính: “openRTSP.cpp” “playCommon.cpp” openRTSP.cpp Một số hàm chính: int main(int argc, char** argv): 103 Là hàm chương trình, nhận tham số đầu vào từ command-line Thực số tác vụ sau: TaskScheduler* scheduler = BasicTaskScheduler::createNew(); Khởi tạo scheduler cho chương trình env = BasicUsageEnvironment::createNew(*scheduler); Khởi tạo mơi trường cho chương trình int portArg; port đường dẫn chương trình Một số đối số chương trình: -4 Xuất định dạng '.mp4' -a Chỉ play định dạng audio specify the static RTP payload format number of the -A audio codec to request from the server ("playSIP" only) -b Thay đổi kích cỡ buffer file xuất -B Thay đổi kích cỡ buffer socket nhập vào -c play tiếp tục specify the MIME subtype of a dynamic RTP -M payload format for the audio codec to request from the server ("playSIP" only) Khoảng thời gian để lưu hay play đoạn audio, -d video -D before exiting set video frame rate (chỉ sử dụng với tham số "-q", "-f 4", or "-i") Prefix với file xuất ra, trường hợp có nhiều -F session Set chiều cao cho đoạn video (sử dụng với tham số "-h q", "-4", or "-i") Xuất định dạng file QuickTime (sử dụng với tham -H số "-q" or "-4") -i Xuất định dạng file '.avi'-format (với 'stdout') Thêm thông tin vào packet bị (sử dụng với tham -l số "-q", "-4", or "-i") -m Xuất frame thành file khác -n Chú ý gói liệu RTP bắt đầu nhận Yêu cầu option command từ server, không gửi -o miêu tả (chỉ với "openRTSP") -O Không yêu cầu option command từ server; "mieu 104 tả" ("openRTSP" only) -p Port lắng nghe client(s) Xuất thống kê 'QOS' luồng liệu(khi -Q chương trình) -q Xuất định dạng file '.mov' (với 'stdout') -r Play liệu RTP, không lưu lại Yêu vầu server khoảng thời gian trước -s truyền liệu assume a simple RTP payload format (skipping over -S a special header of the specified size) Truyền liệu RTP/RT CP qua giao thức TCP, -t qua (thơng thường) UDP (chỉ với"openRTSP") Giống "-t", ngồi trừ sử dụng RTSP-qua giao thức-T HTTP tunneling ("openRTSP" only) -u User name password server yêu cầu -V print less verbose diagnostic output -v Play định dạng video Chiều rộng video(sử dụng với tham số "-q", "-4", -w or "-i") Đồng hóa liệu hình ảnh âm ("-q" or "-y 4") Yêu vầu server scale liệu(nhanh, chậm , hay play -z ngược) playCommon.cpp ourClient = createClient(*env, verbosityLevel, progName); Phương thức tạo mơi trường cho phía client với đối số đầu vào: *env: với dạng trỏ, tạo mơi trường cho phía client verbosityLevel: tính liên tục chương trình, nghĩa chương trình chạy liên tục khoảng thời gian duration khai báo trước progName: tên chương trình ví dụ: openRTSP char* sdpDescription = getSDPDescriptionFromURL(ourClient, url, username, password, proxyServerName, proxyServerPortNum,desiredPortNum); session = MediaSession::createNew(*env, sdpDescription): tạo session (phiên làm việc) cho phía client Trường hợp mở nhiều ứng dụng chạy lúc int socketNum = subsession->rtpSource()->RTPgs()->socketNum(); unsigned curBufferSize = getReceiveBufferSize(*env, socketNum); Gán socket lắng nghe từ phía client để bắt gói tin truyền tới từ server, gán đệm cho lần truyền tập tin phía server 105 if (socketInputBufferSize > || fileSinkBufferSize > curBufferSize) { unsigned newBufferSize = socketInputBufferSize > socketInputBufferSize : fileSinkBufferSize; newBufferSize = setReceiveBufferTo(*env, socketNum, newBufferSize); Nếu giá trị buffer (bộ đệm) nhập vào tồn lớn gán cho đệm cho packet truyền socket if (createReceivers) { if (outputQuickTimeFile) { // Create a "QuickTimeFileSink", to write to 'stdout': qtOut = QuickTimeFileSink::createNew(*env, *session, "stdout", fileSinkBufferSize, movieWidth, movieHeight, movieFPS, packetLossCompensate, syncStreams, generateHintTracks, generateMP4Format); if (qtOut == NULL) { *env startPlaying(sessionAfterPlaying, NULL); } else if (outputAVIFile) { // Create an "AVIFileSink", to write to 'stdout': aviOut = AVIFileSink::createNew(*env, *session, "stdout", fileSinkBufferSize, movieWidth, movieHeight, movieFPS, packetLossCompensate); if (aviOut == NULL) { *env startPlaying(sessionAfterPlaying, NULL); } Đoạn mã nhận tâp tin qua socket lưu lại khởi tạo tập tin tùy theo đối số nhập vào Ở đây, tập tin video nên nhận theo định dạng phổ biến nhất: Mp4 avi Sử dụng lớp viết thư viện: live\liveMedia\QuickTimeFileSink.cpp live\liveMedia\AVIFileSink.cpp 106 Sau nhận stream lưu lại dạng file, đoạn mã sau cho phép ta thực điều char outFileName[1000]; if (singleMedium == NULL) { // Output file name is // "--" static unsigned streamCounter = 0; snprintf(outFileName, sizeof outFileName, "%s%s-%s-%d", fileNamePrefix, subsession->mediumName(), subsession->codecName(), ++streamCounter); } else { sprintf(outFileName, "stdout"); } Còn đoạn code sau ta muốn lưu tập tin dạng file audio dạng video với định dạng H.264 Ở ta sử dụng lớp viết trước để tạo định dạng file này, live\liveMedia\AMRAudioFileSink.cpp live\liveMedia\H264VideoFileSink.cpp FileSink* fileSink; if (strcmp(subsession->mediumName(), "audio") == && (strcmp(subsession->codecName(), "AMR") == || strcmp(subsession->codecName(), "AMR-WB") == 0)) { // For AMR audio streams, we use a special sink that inserts AMR frame hdrs: fileSink = AMRAudioFileSink::createNew(*env, outFileName, fileSinkBufferSize, oneFilePerFrame); } else if (strcmp(subsession->mediumName(), "video") == && (strcmp(subsession->codecName(), "H264") == 0)) { // For H.264 video stream, we use a special sink that insert start_codes: fileSink = H264VideoFileSink::createNew(*env, outFileName, fileSinkBufferSize, oneFilePerFrame); } else { // Normal case: fileSink = FileSink::createNew(*env, outFileName, fileSinkBufferSize, oneFilePerFrame); } B.1 Plugin check_disk Một nhiệm vụ quan trọng việc giám sát hệ thống quản lí hiệu (performance management), bao gồm trạng thái tình trạng sử dụng phần cứng như: CPU, RAM, Hard disk, card mạng (NIC) Plugin check_disk script dùng lệnh có sẵn trong Linux (CentOS) là: df: hiển thị phân vùng hard disk tình trạng thái sử dụng 107 Cho phép người dùng thêm vào hai tham số để đặt ngưỡng cảnh báo dung lượng trống phân vùng Hard disk Warning (cảnh báo) CRITICAL (thông báo khẩn cấp) Kết thực thi plugin check_disk trả cho Nagios gởi mail cảnh báo cho Admin trường hợp cần thiết check_disk #!/bin/bash if [ "$1" == "-h" ]; then echo "Nagios check Disk Utility !!!"; exit 0; fi if [ -n "$1" ]; then WARNING_SIZE=$1; fi if [ -n "$2" ]; then CRITICAL_SIZE=$2; fi if [ -n "$3" ]; then DIR_NAME=$3; fi if [ -n "$4" ]; then SAMPLE_TIME=$4; else SAMPLE_TIME=10; fi # GET DEVICE NAME DEVICE_NAME=`df -h $DIR_NAME | sed -e 's/s6//g' | sed -e 's/s4//g' | sed -e 's/ptcset//g' | sed -e 's/s5//g' | sed -e 's/\/dev//g' | sed -e 's/\/md//g' | sed -e 's/\/dsk\///g' | sed -e 's/\/dbset//g' | sed -e 's/s0//g' | awk {'print $1'} | tail -1` # GET COUNTER VALUES -RESULT=`iostat -nxI | grep " $DEVICE_NAME"` READS=`echo $RESULT | awk '{print $1}'` READS=`echo "scale=0 ; $READS * 1000 / 1" | bc` WRITES=`echo $RESULT | awk '{print $2}'` WRITES=`echo "scale=0 ; $WRITES * 1000 / 1" | bc` BRC=`echo $RESULT | awk '{print $3}'` BRC=`echo "scale=0 ; $BRC * 1000 / 1" | bc` BWC=`echo $RESULT | awk '{print $4}'` BWC=`echo "scale=0 ; $BWC * 1000 / 1" | bc` # GET x SECOND SAMPLE FOR STATS -RESULT=`iostat -nxM $SAMPLE_TIME | grep " $DEVICE_NAME" | tail -1` WSVC_TR=`echo $RESULT | awk '{print $7}'` ASVC_TR=`echo $RESULT | awk '{print $8}'` W_PC=`echo $RESULT | awk '{print $9}'` B_PC=`echo $RESULT | awk '{print $10}'` 108 # - GET DISK SPACE STATS RESULT=`df -hb $DIR_NAME | tail -1` USEDSPACEPER=`echo $RESULT | awk '{print substr($5,1,length($5)-1)}'` FREESPACEPER=$((100-USEDSPACEPER)); TOTALSPACE=`echo $RESULT | awk '{print $2}'` USEDSPACE=`echo $RESULT | awk '{print $3}'` FREESPACE=`echo $RESULT | awk '{print $4}'` MOUNT=`echo $RESULT | awk '{print $1}'` RESULT="$DIR_NAME - total: $TOTALSPACE - used: $USEDSPACE ($USEDSPACEPER%) - free $FREESPACE ($FREESPACEPER%) - Statistics: AvgSvcTime: $ASVC_TR WaitTime: $WSVC_TR Wait: $W_PC% Busy: $B_PC% r/s: $READS w/s: $WRITES kr: $BRC kw: $BWC" if [ -z "$TOTALSPACE" ]; then CRITICAL=`echo Mount Problem!` fi if [ $USEDSPACEPER -ge $CRITICAL_SIZE ]; then CRITICAL=`echo "$CRITICAL Disk Space"` fi if [ $USEDSPACEPER -ge $WARNING_SIZE ]; then WARNING=`echo "$WARNING Disk Space"` fi if [ -n "$CRITICAL" ]; then echo "Critical- $CRITICAL $RESULT"; exit 2; fi if [ -n "$WARNING" ]; then echo "Warning- $WARNING $RESULT"; exit 1; fi echo $RESULT exit 0; B.2 Plugin check_load Plugin check_load script dùng lệnh có sẵn trong Linux (CentOS) là: TOP Lệnh TOP cho phép hiển thị real-time trạng thái hệ thống Nó hiển thị thơng tin tóm lược hệ thống danh sách task quản lí Linux kernel 109 Cho phép người dùng thêm vào hai tham số để đặt ngưỡng cảnh báo trạng thái tải (load) hệ thống Warning (cảnh báo) CRITICAL (thông báo khẩn cấp gởi mail cho Admin) Kết thực thi plugin check_load trả cho Nagios gởi mail cảnh báo cho Admin trường hợp cần thiết check_load #!/bin/bash progname=$0 warn=$1 crit=$2 if [ "$1" != "" -a "$2" != "" ]; then export TERM=xterm load=`top -bn1 | grep load | head -n1 | sed -r 's/\ +//g' | cut -d \: -f | cut -d \, -f | cut d -f 1` level=`top -bn1 | grep load | head -n1 | sed -r 's/\ +//g' | cut -d \: -f | cut -d \, -f 1` if [ "$load" == "" ]; then load=`top -bn1 | grep load | head -n1 | sed -r 's/\ +//g' | cut -d \: -f | cut -d \, -f | cut -d -f 1` level=`top -bn1 | grep load | head -n1 | sed -r 's/\ +//g' | cut -d \: -f | cut -d \, -f 1` fi if [ $load -lt $warn ]; then echo "OK: Current load: $level" exit elif [ $load -eq $warn -o $load -gt $warn -a $load -lt $crit ]; then echo "Warning: Current load: $level" exit elif [ $load -eq $crit -o $load -gt $crit ]; then echo "Critical: Current load: $level" exit else echo "Unknown error" exit fi else echo "Usage: $progname [warn] [crit]" echo " [warn] and [crit] is integer" echo " Example: $progname 2" echo "No options given" exit fi Implementing an IPTV managing and monitoring program Nguyen Minh Hoang1, Phan Van Vinh2 Saigon Institute of ICT (SaigonICT), IT Department, Hung Vuong University, Vietnam, email: nmhoang@saigon-ict.edu.vn Faculty of Electronic Engineering and Telecommunication, HoChiMinh City University of Technology, worked for VTC Multimedia Corp, Vietnam, email: pvvinhbk@gmail.com Abstract - IPTV (Internet Protocol Television) system can deliver television and video on-demand (VoD) content over IP-based network In order to manage, monitor, detect and fix any failures of the system, IPTV operators have to buy a specific management and monitoring software from the suppliers at huge cost with limited functionalities This work implemented a low cost advanced program to monitor, manage and troubleshoot system effectively The implemented program is web-based management software with many useful features, such as monitoring system performance, IPTV services, management feature of STB (Set-top-Box) and IPTV customers, as well as statistic and security functionalities User can be alerted via logging system, email notification of the problems It’s an integrated tool of open-source software such as Nagios, Cacti, Ntop, Syslog, etc As an open-architecture program, it is easy to extent to meet your specific needs, as well as to implement it into other networks I INTRODUCTION IPTV [9] is a new technology of TV broadcasting and VoD service via broadband network as shown in Fig 1, includes several components with specific functions: Integrated Receiver Devices (IRDs) - receive video assets from satellite, video circuits and microwave links Encoder – digitize and compress audio, video and data channels Once the signal is encoded, a compressed video stream is transmitted to the IPTV network Middleware server - manage the provisioning of new subscribers and STB devices, billing, and overall management of video assets VoD server - integrated into IPTV network to stream various types of content such as MPEG-2, VC1, and H.264/AVC across a broadband distribution network DRM (Digital Rights Management)/CA (Conditional Access) system - protect Live/VoD content before delivered STB is required in the customer premises to receive and decrypt the signal Managing and Billing system - This component is very important for any system, used for managing and billing subscriber’s IPTV service Set-Top-Box (STB) - STB used by customer to receive, decrypt and display IPTV content on TV Digital signal H.264 IRDs NMS Billing Analog Signal IP Multicast Stream IP Scrambler Middleware PC EPG CMS DBS Core Switch Content management, EPG Encoder Program Resource VoD server CAS&DRM H.264 STB with secure client IP Unicasting (VOD) IP Multcasting (NVOD) Content Distribution Network Fig 1: IPTV system infrastructure This paper is organized as follows: Section I is the introduction about the scope of this paper, and the description of the architecture and functionalities of the program are discussed in Section II Experiment of the program deployment is shown in Section III Finally, Section IV is conclusion of this work II SYSTEM ARCHITECTURE IP Authorized management An IPTV network is a complex structure that requires a great deal of attention Who can maintain and guarantee the highest quality of service? Failures in the network occur and need to be detected, diagnosed, and repaired as quickly as possible For this purpose, there are several tools (IPTV Manager Pro, Solar Wind, Zenoss…) with following functions: discovery device in the network, configure device, monitor system performance and IPTV channel status, notify issues, logging report However, these tools also have some limitations: difficult for working, user must install client software on his computer, not support Web management, cannot removed nor added necessary features, supplier delivers the software at high cost To solve the above mentioned problem, we implemented an integrated program with monitoring, measurement and management functions all in one system This program is an open-architecture, based on open-source software (totally for free) such as Nagios, Cacti, Ntop, Syslog, PHP/MySQL Besides those built-in features, the program also has more necessary functionalities which support for monitoring and managing IPTV system successfully, include:  Monitor the system performance (CPU, RAM, Hard disk, bandwidth, etc.), uptime of device, IPTV service (Live TV channel, VoD service, etc.)  Manage STB, IPTV subscriber, statistic of number of active STBs or current VoD service connections  Topology map with real-time bandwidth visualization  Discover device in the local network  Basic security: monitor user’s access, incoming and outgoing traffic statistic  Support basic network diagnostic tools like ping, traceroute, nslookup  Setting warning threshold for system performance as well as the monitored objects  Alarm function: logging system, notify admin by email, or alert tone on speaker of computer Based on the measured statistic parameters, users can evaluate and optimize system performance effectively Customer network II.1 Building system infrastructure The IPTV managing and monitoring program is a client/server application with open-architecture, centralized web-based management A main idea to build the program is that based on opensource tools (Nagios, Cacti, and Ntop) with help of fully necessary features from user’s add-ins Nagios [4] is an open-source program, responsible for monitoring performance system and network services with Web-based management User-define feature called plug-in The core of Nagios is a smart scheduler with many user-defined options that allow it execute with high processing performance Cacti [5] is an open-source tool, network monitoring and graphing tool written in PHP/MySQL It uses the RRDTool (Round-robin database tool) engine to store data and generate graphics, and collects periodical data through Net-SNMP (an application suite to implement SNMP—Simple Network Management Protocol) Ntop [12] is a simple, free, portable traffic measurement and monitoring tool Ntop gives you a quick view of your network like which hosts are consuming most of your bandwidth, what are the most used protocols and applications on your network All this information is very useful for network management and planning Fig shows the architecture of IPTV monitoring and management system: Fig 2: Architecture of IPTV monitoring program The core of the architecture is called NMS – Network management system which communicates with Agent via SNMP or SSL to collect all necessary information or execute plug-ins on remote host Admin can access to this program via Web interface or SSH login easily Following is all of modules connected to the core: Setting – allows user to define and manage the monitored objects, set threshold for an alert system Database – stores data collection (use MySQL) from SNMP-capable devices Logger – records all logs of system (use syslog tool) into database for later use This information is useful in debugging the failure system Alarm - checks the pre-defined conditions and sends warning messages (email, alert tone) to users when a condition is matched Topology map – shows quickly an overview of IPTV network topology with real-time bandwidth usage With help of this tool, user can easily detect the failed links in the network STB/IPTV customer – allows user to register and manage STB as well as IPTV subscribers Discover – a tool can help to discover devices in the local network Diagnostic – includes ping, traceroute, nslookup in case user need to debug and diagnostic the network problem II.2 Building plug-ins of the IPTV monitoring system To satisfy the demands of IPTV system monitor and management, besides built-in plug-ins delivered, we need to implement a lot of necessary plug-ins such as check_channel (to monitor status of Live TV channel) and check_vod (to monitor VoD service) a Check_channel plug-in In IPTV system, TV channels are streamed out into Multicast streams with types of compression format such as H.264/AVC, VC-1 and MPEG-4 There are two types of Live TV channel:  SD (Standard Definition): bit rate of 2-4 Mbps  HD (High Definition): 8-10 Mbps bit rate Bit rate of Live TV channel is very low (below 100 kbps) when it is error because of received signal problem or failure of Encoder devices With the characteristic of TV channel, we make a check_channel plug-in to monitor it based on capture tool: it is a tool to send/receive multicast packets (based on IGMPv2 protocol) and record multicast data into a readable media file To request a Live channel, it sends an IGMPv2 Membership Report /Join group message to the network and also sends an IGMPv2 Leave Group when it doesn’t want to receive data anymore We use check_channel plug-in to execute capture tool to request a specific Live TV channel within 10 second: capture multicast traffic of this channel only (based on Live channel’s IP address), and save it to a file with readable format (such as MPEG) for easily playing by media player tools) If the size of this file greater than MB, the TV channel is good; otherwise, it’s fail and send the result to Nagios for user’s alert b Check_VoD plug-in This plug-in is used to monitor VoD service based on openRTSP tool The openRTSP is command-line tool used to open, stream, receive and record media stream that are specified by a RTSP URL The tool will open the given URL (using RTSP's "DESCRIBE" command), retrieve the session's SDP description, and then, for each audio/video sub-session whose RTP payload format it understands, "SETUP" and "PLAY" the sub-session The received data for each sub-session is written into a separate output file with an appropriate filename extension (e.g “.mp3” and “.mpg”) to be able to play it using common media player tools Check_VoD script uses openRTSP tool to play a video content on VoD server within 10 second, save the streaming traffic into a file Similar to check_channel, in this case, VoD service is good if size of this file is greater than MB; otherwise, the VoD service is not running, the result will be sent to Nagios and warning messages also sent to the admin III EXPERIMENT IN A REAL IPTV SYSTEM III.1 Deployment in a real IPTV system A real deployment of IPTV monitoring and managing system is set up in VTC’s IPTV system, one of famous IPTV service providers in Vietnam, with following components: Encoder device from PBI, Envivio; Middleware server of Minerva; VoD server from Toucan; Router/Switch of Juniper, Cisco network III.2 Result in real deployment Network topology map Network topology map (see Fig 3) can be displayed with Netmap feature Link between two nodes is described by a solid line with current incoming/outgoing bandwidth usage visually The color of link let us know percentage of bandwidth usage Netmap provides a good overall picture of the health of a network, easy to identify where the problems occur A statistic function about status of Host/Service check can be displayed with appropriated user-defined time period (last 24 hours or last days, for example) Fig shows that the host is down from 06:30 to 11:54 Fig 6: Statistic report of monitored object Fig 3: IPTV topology map Performance monitoring We can check status of system performance monitoring such as usage of CPU, RAM, HDD and status of IPTV service (Live channel and VoD service) in Nagios tab The state with green color shows that service is good and the red one means that service is fail As we can see, in Fig 4, VoD service and one of Live channel, named HTV4 are fail A notification mail sent to user to alert about critical events With report function, we can see a historical list of alarm report in Fig Those lists can be searched, sorted, and filtered according to many different criteria, such as alarm severity, the type of alarm, the network element (or range of network elements) affected, the time of day when the alarm occurred Fig 7: Report function Fig 4: Performance monitor Event Log: display event of failed objects in Fig This log can be showed by using command-line in monitoring system This report can be filtered to exclude soft events, show only host events or service events or both All report can be imported into Excel spreadsheets saving the report straight out of the HTML frame as nameoffile.xls We can filter only list of current failed services in ‘Monitoring >Problems >Service/Host’ (see Fig 5) Fig 5: List of current failed services Fig 8: Event log Using SNMP functionality, we can monitor performance of server, router/switch in the network and visualize them in graphic display as shown in Fig can detect simple attacks when happened (abnormal traffic, IP address/protocol) Fig 12: Ntop page Fig 9: Performance monitor: memory, CPU, load Interface bandwidth usage can be shown with userdefined time period in Fig 10 We can see pick rate of inbound/outbound interface traffic utilization in the interface traffic graphs Syslogs is a flexible and highly scalable system logging application that is ideal for creating centralized and trusted logging solutions Log messages contain information about the events happening on the hosts (see Fig 13) Monitoring system events is essential for security and system health monitoring reasons Main features of syslogs include: reliable log transfer, secure logging using TLS, database access (MySQL, Oracle), encrypted and timestamped log storage, filter and classify Fig 10: Interface bandwidth usage In Fig 11, User can set threshold of each monitored object for alert such as performance (CPU, RAM, HDD, link bandwidth) in ‘thold’ tab It sends warning messages to user when the condition is matched, critical event happens Fig 13: Syslog tool In Fig 14, shows that device in the local network can be discovered by discover function using SNMP (in discover tab) Fig 11: Threshold setting page Fig 14: Discover device in the network Some valuable information can be shown in Fig 12, ntop page, such as the amount of traffic sent and received from remote hosts, which most of protocols and applications are using Ntop gives you a quick view of what is happening on your network in real-time User Network tools with ping, traceroute, nslookup to troubleshoot network problem easily Fig 17: STB device management Fig 15: Network tools File, directory and process monitoring Monit is a utility for managing and monitoring, processes, files, directories and devices on a Unix system: monit can start a process if it does not run, restart a process if it does not respond and stop a process if it uses to much resources You may use monit to monitor files, directories and devices for changes, such as timestamp changes, checksum changes or size changes In Fig 16, we use monit to monitor service such as http, ssh, mysql, nagios and some important files, directories for changes (httpd.conf, nagios.conf, sshd_config) Customer management: easy to register and manage IPTV subscribers include: select Live channel package, permit VoD access, add STB device for customer, activate/deactivate IPTV service (see Fig 18) Fig 18: IPTV customer management Alert messages This system can warn users when there are errors or unexpected events happening with the IPTV system This allows users to be informed about critical alerts via email messages (in Fig 19), alert tone on speaker of monitoring computer or problem report when login to this program Fig 16: Monit tool IPTV management In webportal page, we can register and manage STB device and IPTV customer effectively Management of Live channel and VoD asset and billing system for customer are also supported Device management, in Fig 17, allows users register new STB device, manage, search, filter list of STB device based on MAC address, name, activate day Fig 19: Alerts via Email messages IV CONCLUSION This paper presents an advanced program, help user to monitor, analyze, visualize and manage IPTV network system easily and effectively Based on this program, the IPTV administrator can be notify the problem as it happened and save much time in troubleshooting the network issues With performance statistic, it also allows users to evaluate and optimize system easily Further work will be considered capability of sending critical alert via SMS message, or network and system security management, help system safety in the enterprise network V REFERENCES [1] Alexander Clemm Ph.D, Network Management Fundamentals, Cisco Press, 2006 [2] Chris Burgess, The Nagios Book, 2005 [3] Daniel Minoli, IP multicast with applications to IPTV and mobile DVB-H, John Wiley & Sons, Inc., 2008 [4] David Josephsen, Building a monitoring infrastructure with Nagios, 1st edition, Pearson Education Inc, 2007 [5] Dinangkur Kundu - S M Ibrahim Lavlu, Cacti 0.8 Network Monitoring, Packt Publishing, 2009 [6] Douglas Mauro - Kevin Schmidt, Essential SNMP, 2nd Edition, O'Reilly, 2005 [7] Joseph D Sloan, Network Troubleshooting Tools, O'Reilly, 2005 [8] Julie C Meloni, Sams Teach Yourself PHP, MySQL™ and Apache in 24 Hours, Sams Publishing, 2002 [9] Gerard O’Driscoll, Next generation IPTV services and technologies, John Wiley & Sons, Inc., 2008 [10] Gilbert Held, Understanding IPTV, Taylor & Francis Group, 2007 [11] Lazaro Issi Cohen and Joseph Issi Cohen, The Web Programmer's Desk Reference, No Starch Press, 2004 [12] M.A.AkonTamon, Ntop network monitoring guide, http://techowto.wordpress.com, 2008 [13] Paul DuBois - Stefan Hinz - Carsten Pedersen, MySQL® Certification Study Guide, Sams Publishing, 2005 [14] Stephen G Kochan - Patrick Wood, Unix Shell Programming, 3rd Edition, Sams Publishing, 2003 LÝ LỊCH TRÍCH NGANG Họ tên: PHAN VĂN VINH Ngày, tháng, năm sinh: 12 – 08 – 1984 Nơi sinh: Sông Bé Địa thường trú: Tân Bình, Bù Nho, Phước Long, Bình Phước Địa liên lạc: 203B1, Huỳnh Văn Chính 2, phường Phú Trung, quận Tân Phú, Tp.HCM QUÁ TRÌNH ĐÀO TẠO  2002 – 2007: Sinh viên ngành Điện tử - Viễn thông, Trường Đại học Bách khoa Tp.HCM, tốt nghiệp loại  2008 – 2010: Học viên Cao học ngành Kỹ thuật – Điện tử, Trường Đại học Bách khoa Tp.HCM Q TRÌNH CƠNG TÁC  Từ 01-2007 đến 07-2009: Kỹ sư Viễn thông Công ty TMA Solution  Từ 07-2009 đến nay: Kỹ sư mạng, viễn thông VTC ... TÀI: XÂY DỰNG CHƯƠNG TRÌNH QUẢN LÝ VÀ GIÁM SÁT HỆ THỐNG IPTV II- NHIỆM VỤ VÀ NỘI DUNG: Tìm hiểu tổng quan hệ thống IPTV Tìm hiểu giao thức quản lý giám sát hệ thống mạng Tìm hiểu chương trình quản. .. cần có giải pháp để quản lý giám sát hệ thống IPTV cách hồn chỉnh Do đó, đề tài ? ?Xây dựng chương trình quản lý giám sát hệ thống IPTV? ?? thực hiện, với mục tiêu đảm bảo hệ thống hoạt động ổn định,... lí giám sát hệ thống (SNMP, RMON) Tìm hiểu chương trình quản lý giám sát hệ thống có, kể phần mềm thương mại (SolarWind) phần mềm mã nguồn mở (Nagios, Cacti) Xây dựng chương trình giám sát quản

Ngày đăng: 15/02/2021, 07:34

Tài liệu cùng người dùng

Tài liệu liên quan