Wireless sensor networks (WSNs) consist of energy limited sensor nodes, which limits the network lifetime. Such a lifetime can be prolonged by employing the emerging technology of wireless energy transfer (WET). In WET systems, the sensor nodes can harvest wireless energy from wireless charger, which can use energy beamforming to improve the efficiency. In this paper, a scenario where dedicated wireless chargers with multiple antennas use energy beamforming to charge sensor nodes is considered. The energy beamforming is coupled with the energy consumption of sensor nodes in terms of data routing, which is one novelty of the paper. The energy beamforming and the data routing are jointly optimized by a non-convex optimization problem. This problem is transformed into a semidefinite optimization problem, for which strong duality is proved, and thus the optimal solution exists. It is shown that the optimal solution of the semi-definite programming problem allows to derive the optimal solution of the original problem. The analytical and numerical results show that optimal energy beamforming gives two times better monitoring performance than that of WET without using energy beamforming.