ThePrez / ServiceCommander-IBMi

Service Commander for IBM i
Apache License 2.0
41 stars 12 forks source link

[FEATURE-REQUEST] Check for QNTC and NFS directories #145

Open Bjarne-La opened 2 years ago

Bjarne-La commented 2 years ago

Currently, there seems to be no support for checking the existence or functionality of QNTC or NFS directories. Since other services might rely on such directories, it may be a good feature to be able to check their liveliness.

To achieve this, a new check alive type would be needed (e.g. "IFS_OBJECT"). The check alive value would be the path to the corresponding IFS object. This way you can also check for IFS objects other than QNCT directories.

If this functionality is already covered by Service Commander, please let me know!

ThePrez commented 2 years ago

Interesting! You're actually referencing corners of the IBM i operating system that I am not very familiar with. Does the state of some service actually cause QNTC/NFS/etc to exist or not exist?

If so, then I agree that part of the liveliness check could include IFS objects.

If it's more the case that "the service can be running, but it's not gonna work if /QNTC isn't there" should maybe be handled specially somehow. Perhaps a different property that itemizes "needed resources." And if a needed resource is missing, then the liveliness status could be denoted as PARTIAL

🤔

ThePrez commented 2 years ago

Even if it's a "needed resource" kind of scenario, maybe it is still simplest to just add that to the checkalive criteria as you suggest. Something like:

check_alive: 8883,IFS_OBJECT:/QNTC/otherserver/home/MYAPP

Or we can assume that an item starting with / is an IFS object:

check_alive: 8883, /QNTC/otherserver/home/MYAPP

¯\(ツ)

Bjarne-La commented 2 years ago

Thank you for your quick reply!

You're totally right, it's more a "the service can be running, but it's not gonna work if /QNTC isn't there" kind of scenario.

Regarding the YAML syntax, I had the exact same thought😁

check_alive: 8883,IFS_OBJECT:/QNTC/otherserver/home/MYAPP check_alive: 8883, /QNTC/otherserver/home/MYAPP

As far as I know, there is no other way to check the functionality of a QNTC/NFS connection than to access a directory or file on your target server, since the connection is only established on access. Unfortunately, access via QNCT is only granted, when the current user of Service Commander has permission to access the target. This means that you have to change the user of the job during runtime or check for the IFS object via SBMJOB, using the correct user. Until now, I was not able to solve this problem.

This also means that the service configuration somehow has to contain the username that should be used for the check. Maybe something like check_alive: 8883,IFS_OBJECT:[USERNAME]@/QNTC/otherserver/home/MYAPP or check_alive: 8883,[USERNAME]@/QNTC/otherserver/home/MYAPP. When no username is defined, the check is made with with the job's user.

A simple check for IFS objects or objects inside the QNTC directory works fine with a simple File(path).exists(), as long as the current user has the permission to do so😃

ThePrez commented 2 years ago

Just commenting to let you know I'm still thinking about this one! It seems a difficult feature to add, but would like to keep it "on the radar."