A wireless sensor network (WSN) consists of sensor nodes and wireless communication. Sensor nodes usually have the features such as tiny size, low cost, low power consumption. They are used for environmental monitoring and transmit sensing data (temperature, humidity, pressure and so on) to sink through wireless networking. To protect sensing data's confidentiality and integrity has presented an intrusion detection system called patrol intrusion detection system (PIDS), which designate a fraction of sensor nodes as roaming patrol nodes to detect malicious sensor nodes. However, those patrol nodes' battery energy will consume rapidly and thus makes the whole WSN to have reduced lifetime. In this paper, the system will collect ambient data and utilize a revised artificial bee colony algorithm to find a low power consumption path for transmitting attack feature packets in PIDS in order to extend the lifetime of a WSN.