Diagnosing a generator problem does require checking many systems and testing of individual parts. Undermount models usually have to be dropped to test and replace many parts. Slide out models are certainly more accessible. Obviously, the cover has to come off and then you have access to most components, however, there are some parts that require the unit to be removed from the mounting base pan.
Usually, if you get surging, the fuel filter or carburetor may be suspect (clogged or dirty, especially if gas has been allowed to use sit there).
Running only when the switch is held down, often indicates a bad voltage regulator.
First, get your exact model number and series and the serial number. Then go on line and get some manuals and read about how your unit functions.
Here is a lengthly post that has some useful links.
A very detailed Trouble Shooting Guide is also available on line from Flight Systems (flightsystems.com). They also make aftermarket control boards for the Onan units that are cheaper than the original unit.