• Halloween is coming! To celebrate the occasion, we dusted off a couple of old skins, and even created a brand new one (Pixel).
    To get into the festive spirit, install the Skins extension.
  • The new Python extension is now available. It allows customers to deploy and manage WSGI-based Python applications on their websites directly from Plesk.
  • The Plesk Mobile apps for iOS and Android and the Plesk Mobile Center extension have been deprecated, and are no longer available for new installations. In Plesk Obsidian 18.0.84, the Plesk Mobile Center extension will be removed from servers during the upgrade, and the Plesk Mobile apps will lose their server management features.
  • The Social Login extension has been deprecated and will be removed in Plesk Obsidian 18.0.84. After that, it will no longer be possible to log in to Plesk with a Google, Facebook, GitHub account, or with a passkey. Plesk usernames and passwords, as well as logging in with a WebPros Account, are not affected.

Question Global Event Parameters for Event Handlers

pleskuser67553

Regular Pleskian
Server operating system version
AlmaLinux 8.10
Plesk version and microupdate number
18.0.63 Update #4
Hello,

I have read this Event Parameters Passed by Event Handlers but I'd like to be able to pass the IP address that triggered the Event. Are there any global parameters that are always passed by Event Handlers? If so, what are they or how would I discover them?

For additional context, it's for a simple script I have to notify when a user is logged in but I want to know the IP address too please Resolved - Event Manager - Plesk user logged in not firing The IP address is revealed in Tools & Settings > Log Browser > Action Log, so I would hope it can be accessed by the Event Handler too.
 
I don't think the login IP address isn't available as a environment variable for this particular event. (Would be nice if it was). If you want to be sure you can dump all available environment variables into a file with a script like this:
Bash:
#!/usr/bin/env bash

env > /tmp/params # Or any other location

Unfortunately the "Plesk user logged in" event probably isn't of much use for your particular use case. The data shown in the Action Log is stored in the PSA database log_actions table. Sadly it's difficult to fetch any additional data based on the event paramater (contact name). What you could consider doing however, is to query the database table and just return the most resent logged cp_user_login action.

I am not sure if that actually does gets you the data you need. Because the event might get triggered before the login data gets stored to the action log (so you might end up with data from an previous login action). But this might be worth testing. It's the only thing I can think off that comes close to what you're trying to accomplish.

Hope this helps.
 
Back
Top