To generate a report locally, it is required to have a Salesforce DX Project linked to your Salesforce Org.
An easy way to do/test this can be done by following instructions on this github simple test project.
Once the project is setup, running the following command sfdx force:apex:test:run -c -d . -r json --wait 4 will generate a JSON coverage report test-result-codecoverage.json. See attachment to see the format of such reports.
Allow sonar-apex to import these reports by adding a sonar.apex.coverage.reportPath property to read such files.