my $audit_auth_log = '/var/log/samba/audit_auth.log';
my $audit_auth_log = '/var/log/samba/json/auth.log';
if (not defined $samba_tool or not defined $pdbedit){
if (not defined $samba_tool or not defined $pdbedit){
print 'ZBX_NOTSUPPORTED';
print 'ZBX_NOTSUPPORTED';
@ -47,7 +47,7 @@ if (defined $ou){
if ($ou !~ m/^(?<RDN>(?<Key>(?:\\[0-9A-Fa-f]{2}|\\\[^=\,\\]|[^=\,\\]+)+)\=(?<Value>(?:\\[0-9A-Fa-f]{2}|\\\[^=\,\\]|[^=\,\\]+)+))(?:\s*\,\s*(?<RDN>(?<Key>(?:\\[0-9A-Fa-f]{2}|\\\[^=\,\\]|[^=\,\\]+)+)\=(?<Value>(?:\\[0-9A-Fa-f]{2}|\\\[^=\,\\]|[^=\,\\]+)+)))*$/){
if ($ou !~ m/^(?<RDN>(?<Key>(?:\\[0-9A-Fa-f]{2}|\\\[^=\,\\]|[^=\,\\]+)+)\=(?<Value>(?:\\[0-9A-Fa-f]{2}|\\\[^=\,\\]|[^=\,\\]+)+))(?:\s*\,\s*(?<RDN>(?<Key>(?:\\[0-9A-Fa-f]{2}|\\\[^=\,\\]|[^=\,\\]+)+)\=(?<Value>(?:\\[0-9A-Fa-f]{2}|\\\[^=\,\\]|[^=\,\\]+)+)))*$/){
die "Invalid OU\n";
die "Invalid OU\n";
}
}
foreach (qx($samba_tool ou listobjects '$ou')){
foreach (qx($samba_tool ou listobjects '$ou' 2>/dev/null)){
die "Error while counting objects of OU $ou\n" if ($? != 0);
die "Error while counting objects of OU $ou\n" if ($? != 0);
chomp;
chomp;
$json->{objects}++;
$json->{objects}++;
@ -116,7 +116,7 @@ if (defined $ou){
}
}
# Now count groups
# Now count groups
foreach (qx($samba_tool group list)){
foreach (qx($samba_tool group list 2>/dev/null)){
$json->{accounts}->{groups}++;
$json->{accounts}->{groups}++;
}
}
@ -124,23 +124,23 @@ if (defined $ou){
# We want just a quick summary, so only output the first line
# We want just a quick summary, so only output the first line
# manual checks will be needed to get the details, but if this field doesn't contains [ALL GOOD],
# manual checks will be needed to get the details, but if this field doesn't contains [ALL GOOD],