Merge branch '1730-missed-enterprise-plugins' into 'develop'

Fixed some default values in PluginTools

See merge request artica/pandorafms!1239
This commit is contained in:
vgilc 2018-01-29 13:37:11 +01:00
commit 2af1b628a8
4 changed files with 36 additions and 11 deletions

View File

@ -64,7 +64,8 @@ $PANDHOME_ENT/pandora_plugins/Nutanix/pandora_nutanix.pl \
$PANDHOME_ENT/pandora_plugins/MTL/pandora_mtl.pl \ $PANDHOME_ENT/pandora_plugins/MTL/pandora_mtl.pl \
$PANDHOME_ENT/pandora_plugins/Informix/informix.pl \ $PANDHOME_ENT/pandora_plugins/Informix/informix.pl \
$PANDHOME_ENT/pandora_plugins/Ruckus/ruckus.pl \ $PANDHOME_ENT/pandora_plugins/Ruckus/ruckus.pl \
$PANDHOME_ENT/pandora_server/util/plugins/vmware-plugin.pl" $PANDHOME_ENT/pandora_plugins/UX/pandora_ux.pl \
$PANDHOME_ENT/pandora_server/util/plugins/vmware-plugin.pl "
PLUGIN_LIB_FILE="$CODEHOME/pandora_server/lib/PandoraFMS/PluginTools.pm" PLUGIN_LIB_FILE="$CODEHOME/pandora_server/lib/PandoraFMS/PluginTools.pm"
# Update version in spec files # Update version in spec files

View File

@ -0,0 +1,22 @@
#!/bin/bash
if [ $# -ne 1 ]
then
echo
echo "Usage: domain_expiration_date.sh <domain_name>"
echo "Returns the number of days to expiration date"
echo
exit
fi
domain=$1
# Calculate days until expiration
expiration=`whois $domain |grep "Expiry Date:"| awk -F"Date:" '{print $2}'|cut -f 1`
expseconds=`date +%s --date="$expiration"`
nowseconds=`date +%s`
((diffseconds=expseconds-nowseconds))
expdays=$((diffseconds/86400))
echo $expdays

View File

@ -9,12 +9,6 @@ package PandoraFMS::PluginTools;
# Library Centos package # Library Centos package
# ------- -------------- # ------- --------------
# LWP::UserAgent perl-libwww-perl # LWP::UserAgent perl-libwww-perl
#
#
#
# Version Date
# a1 17-11-2015
# ** Revision handler in gitlab **
# #
################################################################################ ################################################################################
@ -58,6 +52,7 @@ our @EXPORT = qw(
get_unit get_unit
get_unix_time get_unix_time
get_sys_environment get_sys_environment
get_current_utime_milis
getCurrentUTimeMilis getCurrentUTimeMilis
head head
in_array in_array
@ -100,6 +95,7 @@ sub get_lib_version {
################################################################################ ################################################################################
# Get current time (milis) # Get current time (milis)
################################################################################ ################################################################################
sub get_current_utime_milis { return getCurrentUTimeMilis(); }
sub getCurrentUTimeMilis { sub getCurrentUTimeMilis {
#return trim (`date +"%s%3N"`); # returns 1449681679712 #return trim (`date +"%s%3N"`); # returns 1449681679712
return floor(time*1000); return floor(time*1000);
@ -609,7 +605,11 @@ sub transfer_xml {
close (FD); close (FD);
# Reassign default values if not present
$conf->{tentacle_client} = "tentacle_client" if empty($conf->{tentacle_client});
$conf->{tentacle_port} = "44121" if empty($conf->{tentacle_port});
$conf->{mode} = $conf->{transfer_mode} if empty($conf->{mode}); $conf->{mode} = $conf->{transfer_mode} if empty($conf->{mode});
if (empty ($conf->{mode}) ) { if (empty ($conf->{mode}) ) {
print_stderror($conf, "[ERROR] Nor \"mode\" nor \"transfer_mode\" defined in configuration."); print_stderror($conf, "[ERROR] Nor \"mode\" nor \"transfer_mode\" defined in configuration.");
return undef; return undef;

View File

@ -206,7 +206,7 @@ if ($module eq "diskuse") {
$command_line_parammeters = "-v $version -c $community $host"; $command_line_parammeters = "-v $version -c $community $host";
} }
if ($disk =~ /\\/) { if ($disk =~ /\\ /) {
$disk =~ s/\\/\\\\/g; $disk =~ s/\\/\\\\/g;
} }
my $diskid = `snmpwalk -r 2 -On $command_line_parammeters .1.3.6.1.2.1.25.2.3.1.3 | grep -F '$disk' | head -1 | gawk '{print \$1}' | gawk -F "." '{print \$13}' | tr -d "\r"`; my $diskid = `snmpwalk -r 2 -On $command_line_parammeters .1.3.6.1.2.1.25.2.3.1.3 | grep -F '$disk' | head -1 | gawk '{print \$1}' | gawk -F "." '{print \$13}' | tr -d "\r"`;
@ -248,9 +248,11 @@ if ($module eq "process") {
$command_line_parammeters = "-v $version -c $community $host"; $command_line_parammeters = "-v $version -c $community $host";
} }
$status = `snmpwalk $command_line_parammeters 1.3.6.1.2.1.25.4.2.1.2 | grep "$process" | head -1 | wc -l`; $status = `snmpwalk $command_line_parammeters 1.3.6.1.2.1.25.4.2.1.2 2>/dev/null`;
print $status; if ($? == 0) {
print (($status =~ m/$process/mi)?1:0);
}
} }
#----------------------------------------------------------------------- #-----------------------------------------------------------------------