Cách dễ nhất để tạo ra kịch bản này, mới, mạnh mẽ hơn là phần lớn các kịch bản trước và chuyển đổi chúng thành các chức năng. Chúng tôi chỉ đơn giản là có thể chèn các chức năng từ theo sau bởi một tên chức năng và kèm theo các mã trong xoăn niềng răng ví dụ, chức năng test_function {function_code} | Monitoring Processes and Applications 261 Application APIs and SNMP Traps Most enterprise management tools come with application program interfaces APIs for the more common commercial applications however we sometimes must write shell scripts to fill in the gaps. This is where SNMP traps come in. Because the enterprise management tool should support SNMP traps the APIs allow the application to be monitored using the SNMP MIB definitions on both the management server and the client system. When an enterprise management tool supports SNMP traps you can usually write your own shell scripts that can use the tool s MIB and SNMP definitions to get the message out from your own shell scripts. As an example the command shown here utilizes a well-known monitoring tool s SNMP and MIB data to allow a trap to be sent. usr local bin trapclient MON_HOST MIB_NUM TRAP_NUM TRAP_TEXT In the previous command the MON_HOST variable represents the enterprise management workstation. The MIB_NUM variable represents the specific code for the MIB parameter. The TRAP_NUM variable represents the specific trap code to send and the TRAP_TEXT is the text that is sent with the trap. This type of usage varies depending on the monitoring tool that you are using. At any rate there are techniques that allow you to write shell scripts to send traps. The methods vary but the basic syntax remains the same for SNMP. Summary This is one of those chapters where it is useless to write a bunch of shell scripts. I tried to show some of the techniques of monitoring applications and application processes but the details are too varied to cover in a single chapter. I have laid down a specific process that you can utilize to build a very nice tool to monitor your systems and applications. Always start with a ping If the box is unpingable then your first job is to get the machine booted or to call hardware support. In the next steps you have several options including interacting with the application as we did with