ฉันทำงานสคริปต์จะทำการเปลี่ยนแปลงไปเป็น Nagios โปรแกรมเสริมการบริการนิยามโดยใช้ตบ. ฉันต้องการที่จะต่อไปยังท้ายติดต่อชื่อกลุ่มเส้นแต่เพียงสำหรับบางบริการความหมายของคำ. ดังนั้นฉันจะเริ่มต้นกับเรื่องนี้
define service {
use sites-service
host_name my_host
service_description check_reboot_os_updates
check_command check_reboot_os_updates
contact_groups contactgroup1
servicegroups MyGroup
}
define service {
use linux-service
host_name my_host
service_description other_description
check_command other_command
contact_groups contactgroup1
servicegroups MyGroup
}
และฉันต้องการเพิ่มเดียวที่เลือกติดต่อกลุ่มแล้วเราพลาดอะไรไปเนี่ย? ดังนั้นบอกว่าฉันอยากจะเพิ่มการเพิ่มเติมติดต่อกลุ่มที่ระบบลินุกซ์บริการแบบนี้
define service {
use sites-service
host_name my_host
service_description check_reboot_os_updates
check_command check_reboot_os_updates
contact_groups contactgroup1
servicegroups MyGroup
}
define service {
use linux-service
host_name my_host
service_description other_description
check_command other_command
contact_groups contactgroup1, contactgroup2
servicegroups MyGroup
}
มีทางที่ฉันสามารถทำเรื่องนี้โดยใช้ sed หรือภาษาโปรแกรม awklanguage section หรือบางอย่างอื่นอีกมั้ย?