Sensor for monitoring a medium, comprising at least one electromagnetic radiation source and one detector for electromagnetic radiation, wherein the medium is in the beam path between the electromagnetic radiation source and the detector, as at least one one-dimensional sensor having photodiodes for the refracted electromagnetic radiation, and a spectrum that changes when the medium is changed can be detected, and wherein - a first part of the housing is a cup-shaped single-piece shaped part consisting of a material that is transparent to the radiation, - the electromagnetic radiation source, the detector and mirrors that deflect the radiation from the electromagnetic radiation source twice in sequence are arranged in the first part such that the electromagnetic radiation source and the detector are placed one adjacent to the other, - the electromagnetic radiation source is radiation source that emits radiation of certain wavelengths, - the first part has, for the medium, a recess or a cut-out, which has two planes and wall regions that are arranged at an angle to one another and are transparent to the electromagnetic radiation, such that said wall regions and the medium on the wall regions are a prism that refracts the electromagnetic radiation, - a second part of the housing is a cover such that a self-contained sensor is produced, - the detector consists of photodiodes arranged in a row or in a matrix, - the electromagnetic radiation source and the detector are connected to a data-processing system such that radiation of different wavelengths is refracted in sequence in the prism, which is formed by the wall regions and the medium on the wall regions, and resultant spectra can be detected and evaluated, and - the data-processing system is a data-processing system that determines, in each case, the location of the electromagnetic radiation of a certain wavelength that has reached the detector. - a first part of the housing is a cup-shaped single-piece shaped part consisting of a material that is transparent to the radiation, - the electromagnetic radiation source, the detector and mirrors that deflect the radiation from the electromagnetic radiation source twice in sequence are arranged in the first part such that the electromagnetic radiation source and the detector are placed one adjacent to the other, - the electromagnetic radiation source is radiation source that emits radiation of certain wavelengths, - the first part has, for the medium, a recess or a cut-out, which has two planes and wall regions that are arranged at an angle to one another and are transparent to the electromagnetic radiation, such that said wall regions and the medium on the wall regions are a prism that refracts the electromagnetic radiation, - a second part of the housing is a cover such that a self-contained sensor is produced, - the detector consists of photodiodes arranged in a row or in a matrix, - the electromagnetic radiation source and the detector are connected to a data-processing system such that radiation of different wavelengths is refracted in sequence in the prism, which is formed by the wall regions and the medium on the wall regions, and resultant spectra can be detected and evaluated, and - the data-processing system is a data-processing system that determines, in each case, the location of the electromagnetic radiation of a certain wavelength that has reached the detector.