chandler_bing

Registered
Dec 15, 2009
3
0
51
Hi,

I have two queries.

1]

I have following snippet in /usr/local/cpanel/Cpanel/CustomEventHandler.pm file, which should log all events to a temp file.

Code:
sub event {
    my ( $apiv, $type, $module, $event, $cfgref, $dataref ) = @_;

        my $logger = Cpanel::Logger->new({ alternate_logfile => "/tmp/event.log"  });
        $logger->info("$apiv, $type, $module, $event");
        return 1;

}
It logs all activities performed in cpanel interface (port 2083) but it does not log any activity performed in whm interface (port 2087). Why is it ?

2]

My another query is, do we not have API call for each and every action we perform with WHM? I am trying to find an api call for WHM Main --> Server Configuration --> Tweak Settings --> PHP, but it looks like there is no API available for this. And I guess there must be many more actions for which there is no API.

Regards,
 

cPanelDavidN

Well-Known Member
Staff member
Dec 17, 2009
571
3
68
Houston, TX
cPanel Access Level
Root Administrator
Hi chandler_bing,

2]
All of cPanel's actions have API calls. WHM, however, does not. WHM does not expose an internal API for programmatic use. There is a remote API that you can use, but even then, only a fraction of WHM's functionality is exposed at this time.

The item that you mention does not have an remote API call; it is only available through the WHM UI. In theory, if you know the exact key/value pairs are, you *could* manually alter /var/cpanel/cpanel.config and run '/usr/local/cpanel/whostmgr/bin/whostmgr2 --updatetweaksettings'. However, I don't advise this. There are many subtleties of the cpanel.config file (as well as tweak settings) and it is not designed to be manually edited.

1]
The CustomEventHandler system (as well as the function hook system) is only triggered by cPanel API calls. WHM actions almost never go through this system, but instead have their own internal route/code that performs the action.

Currently we are developing a cPanel & WHM feature set called the Universal Hook System that will provide various points within cPanel and WHM for hooking that will probably do what you ultimately desire (concerning the log thing). Unfortunately, I do not have an solid ETA, but it should be available in development builds in the coming months. We will announce it on the Integration Blog as well in future changelogs

Best Regards,
-DavidN