Diamond roller profile grinding is one of the key technologies for manufacturing diamond rollers. Currently, diamond grinding wheels are commonly used for precision profile grinding of diamond rollers. The surface contour Pv value of the diamond roller is an important indicator for assessing the profile grinding process. In current machining inspections, workers often need to stop the machine, remove the roller, and place it on a contour gauge for measurement, which significantly increases the time and cost of roller production. Therefore, this paper proposes an online detection method based on wavelet packet coefficients and random forest for the vibration signals generated during the longitudinal grinding and trimming process of diamond rollers on a five-axis machining center. The accuracy of the proposed method in state recognition is 92%, indicating its practical application value.