There is only answer for measuring petrol level in oil tank, and most measure the height of the petrol in the tank. The level-based monitoring range can be a simple field glass tube mounted on the side of the tank or an electronic level that sends readings over a wireless network. The density of diesel varies with different grades and ambient temperatures. This will have an impact on the level monitoring technique that may need to be adjusted or compensated, depending on whether it is the weight or volume being measured and whether the sensor technology is sensitive to density changes.
For diesel-filled cans, there are sensors that can be connected externally, such as a float that runs up and down the diesel-filled tube connected at the bottom of the tank, or a pressure sensor that is installed in the hole at the bottom of the tank, and the pressure generated by the measurement is applied to the diesel by gravity.