getting SELinux boolean value
Summary: Justin Dietz is encountering issues retrieving the SELinux Boolean value in a scripted datasource due to their primary expertise being in Windows and PowerShell rather than Linux and Groovy. Although they can successfully obtain the desired information using SSH and telnet on the server, replicating this in a scripted datasource has been challenging. They mention that SSH is configured on the Linux servers and all collectors are Windows servers, seeking advice on how to proceed.
I mostly deal with windows and powershell so I am having issues getting this SELinux Boolen value since it A. is linux and B. seems I'll need to figure out groovy.
Our Linux admin does have SSH configured for LM to use on the Linux servers.
If I open telnet and SSH to the server and run:
getsebool httpd_can_network_relay
I get the response I'm looking for.
But I can't seem to get that to work in a scripted datasource. If anyone has any hints to get me towards a solution, I would really appreciate it.
Also, all of our collectors are Windows servers if that matters.
Larsen Orchard
·7 months agoWhenever I create a new module, I almost always clone an existing module that's kinda close, then change the portions that are applicable to what I want to do. For this one, I'd use the "Linux_SSH_Uptime" module because it's super simple. I think you'd only need to change the last line in the "Collection" groovy script from this:
print remote.exec('echo -n "Uptime:"; cat /proc/uptime')to this:
def command_output = remote.exec('/usr/sbin/getsebool httpd_can_network_relay') def result = command_output.contains('on') ? 0 : 1 println "SELinuxStatus:${result}"From there, simply remove the cloned datapoints and create a new simple one that collects the content the script writes to the standard output.