In Octoprint you need to have the filament sensor plugin loaded. Go to Settings (tool icon) and then choose Plugin Manager. Then you can look through the plugins. I use one called Filament Sensor Reloaded. No disrespect to anyone else but this is considered to be the best one to use.
Once this plugin is loaded it needs to be configured so after restarting OctoPi go to settings again and this time locate and click on Filament Sensor Reloaded in your plugin list (Not Plugin Manager).
For these settings you need to choose the pin you have the sensor wired to on the GPIO pins. For example I plug mine into pin 18 but this is not what you enter. Physical pin 18 on the GPIO is GPIO 24, so 24 is what you enter. This is just an example, use whatever GPIO pin you have the sensor wired to.
Debounce time can be left at 500ms. Switch type is dependent on your switch - you need to know whether it is normally closed or normally open. Board pin mode I set to BCM Mode. Out of filement GCODE depends on what you want to happen. On my CR-10 I set it to M600. This is a pause command and my firmware knows about this and knows to pause print, retract filament and wait until I have loaded the new filament. The control panel gives me options for extruding filement to get it flowing and for unpausing the print. I don't know what firmware you have or whether it has enabled code for the filament sensor so I don't know if this will all be exactly the same for you, but hopefully it will help get you on the right path.
If you have all this working and just need to disable it then just remove the commands in the GCODE section so nothing will happen when the sensor triggers. If you use GCODE to decide the sensor action then uncheck the option to pause print when out of filament. If you don't have specific GCODE to execute then leave this checked but uncheck it if you want to disable the sensor, though I'm not sure why you would want to do that.