So, I'm not sure if I posted this here previous or not, but I have a nifty little dumper CustomEventHandler I wrote that logs all cPanel API calls made to the error_log. This means that you can see what parameters it was called with which is very handy if you need information on how API1/API2 calls are made (for theme development, etc).
This will only print returned data for API2 calls, API1 calls print data rather than return so it is rather difficult to do this.
Installation:
wget sdk.cpanel.net/utils/CustomEventHandler-Dumper.tar.gz
tar vzxf CustomEventHandler-Dumper.tar.gz
cp CustomEventHandler-Dumper/CustomEventHandler.pm /usr/local/cpanel/Cpanel
cp CustomEventHandler-Dumper/Dumper.pm /usr/local/cpanel/perl/Data
tail -f /usr/local/cpanel/logs/error_log
and hit something in the interface.
NOTE: this shold never by run on a production server, thigns like password of new email/ftp/whatever accounts will be logged to the error_log with this enabled
NOTE: if you wish to filter to look for calls within a specific module, please check out the commented line within the event function of CustomEventHandler.pm
When you hit an API call in cPanel (which you will several times for every page):
statsbar:stat
$apiv = 2
$type = post
-----
$cfgref
$VAR1 = {
'rowcounter' => 'mainstats',
'infinitylang' => 'true',
'display' => 'diskusage|bandwidthusage'
};
-----
$dataref
$VAR1 = [
{
'percent10' => 0,
'normalized' => 1,
'rowtype' => 'even',
'percent20' => 0,
'item' => 'Monthly Bandwidth Transfer',
'zeroisunlimited' => 1,
'name' => 'bandwidthusage',
'_maxed' => 1,
'_count' => 0,
'units' => 'MB',
'percent' => 0,
'_max' => 'unlimited',
'count' => 0,
'max' => '∞ MB',
'percent5' => 0,
'langkey' => 'INDXBandwidth',
'module' => 'Stats',
'feature' => 'bandwidth',
'id' => 'bandwidthusage'
},
{
'percent10' => 0,
'normalized' => 1,
'percent5' => 0,
'rowtype' => 'odd',
'percent20' => 0,
'item' => 'Disk Space Usage',
'zeroisunlimited' => 1,
'name' => 'diskusage',
'langkey' => 'INDXDiskUsage',
'_maxed' => 0,
'_count' => '1.32',
'units' => 'MB',
'module' => 'Quota',
'_max' => 1000,
'percent' => 0,
'count' => '1.32',
'max' => '1000 MB',
'id' => 'diskusage'
}
];
This will only print returned data for API2 calls, API1 calls print data rather than return so it is rather difficult to do this.
Installation:
wget sdk.cpanel.net/utils/CustomEventHandler-Dumper.tar.gz
tar vzxf CustomEventHandler-Dumper.tar.gz
cp CustomEventHandler-Dumper/CustomEventHandler.pm /usr/local/cpanel/Cpanel
cp CustomEventHandler-Dumper/Dumper.pm /usr/local/cpanel/perl/Data
tail -f /usr/local/cpanel/logs/error_log
and hit something in the interface.
NOTE: this shold never by run on a production server, thigns like password of new email/ftp/whatever accounts will be logged to the error_log with this enabled
NOTE: if you wish to filter to look for calls within a specific module, please check out the commented line within the event function of CustomEventHandler.pm
When you hit an API call in cPanel (which you will several times for every page):
statsbar:stat
$apiv = 2
$type = post
-----
$cfgref
$VAR1 = {
'rowcounter' => 'mainstats',
'infinitylang' => 'true',
'display' => 'diskusage|bandwidthusage'
};
-----
$dataref
$VAR1 = [
{
'percent10' => 0,
'normalized' => 1,
'rowtype' => 'even',
'percent20' => 0,
'item' => 'Monthly Bandwidth Transfer',
'zeroisunlimited' => 1,
'name' => 'bandwidthusage',
'_maxed' => 1,
'_count' => 0,
'units' => 'MB',
'percent' => 0,
'_max' => 'unlimited',
'count' => 0,
'max' => '∞ MB',
'percent5' => 0,
'langkey' => 'INDXBandwidth',
'module' => 'Stats',
'feature' => 'bandwidth',
'id' => 'bandwidthusage'
},
{
'percent10' => 0,
'normalized' => 1,
'percent5' => 0,
'rowtype' => 'odd',
'percent20' => 0,
'item' => 'Disk Space Usage',
'zeroisunlimited' => 1,
'name' => 'diskusage',
'langkey' => 'INDXDiskUsage',
'_maxed' => 0,
'_count' => '1.32',
'units' => 'MB',
'module' => 'Quota',
'_max' => 1000,
'percent' => 0,
'count' => '1.32',
'max' => '1000 MB',
'id' => 'diskusage'
}
];
Last edited: