Spray the plants that are prone to pests with this mixture. It can be used for household and garden plants. (Tip - the onion trimmings can also be mixed with garlic.)
Onions are a natural insect repellent because of their antibacterial sulphide components - the thing responsible for their odour. The outer layers which are usually thrown away are the richest layers.
Bear in mind that you need to use raw onions, not cooked onions for this 'home brew' pest killer.
The onion bits left over from this brew can be buried around the plants in your garden that are prone to e.g. aphids, spiders and other pests.
Consider introducing beneficial bugs into your garden. This will help improve your plants as well as act as a natural deterrent to the peskier insects. See also Chilli Garden Pest Control Spray.