diff --git a/extras/pandora_update_version.sh b/extras/pandora_update_version.sh index 486dcbb79b..2b77dd8e02 100755 --- a/extras/pandora_update_version.sh +++ b/extras/pandora_update_version.sh @@ -64,7 +64,8 @@ $PANDHOME_ENT/pandora_plugins/Nutanix/pandora_nutanix.pl \ $PANDHOME_ENT/pandora_plugins/MTL/pandora_mtl.pl \ $PANDHOME_ENT/pandora_plugins/Informix/informix.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" # Update version in spec files diff --git a/pandora_plugins/Internet Domains and WHOIS/domain_expiration_date.sh b/pandora_plugins/Internet Domains and WHOIS/domain_expiration_date.sh new file mode 100755 index 0000000000..b2bf8f9c8b --- /dev/null +++ b/pandora_plugins/Internet Domains and WHOIS/domain_expiration_date.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +if [ $# -ne 1 ] +then + echo + echo "Usage: domain_expiration_date.sh " + 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 + diff --git a/pandora_server/lib/PandoraFMS/PluginTools.pm b/pandora_server/lib/PandoraFMS/PluginTools.pm index 0b6b0b39fb..76f1dbf113 100644 --- a/pandora_server/lib/PandoraFMS/PluginTools.pm +++ b/pandora_server/lib/PandoraFMS/PluginTools.pm @@ -9,12 +9,6 @@ package PandoraFMS::PluginTools; # Library Centos package # ------- -------------- # 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_unix_time get_sys_environment + get_current_utime_milis getCurrentUTimeMilis head in_array @@ -100,6 +95,7 @@ sub get_lib_version { ################################################################################ # Get current time (milis) ################################################################################ +sub get_current_utime_milis { return getCurrentUTimeMilis(); } sub getCurrentUTimeMilis { #return trim (`date +"%s%3N"`); # returns 1449681679712 return floor(time*1000); @@ -609,7 +605,11 @@ sub transfer_xml { 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}); + if (empty ($conf->{mode}) ) { print_stderror($conf, "[ERROR] Nor \"mode\" nor \"transfer_mode\" defined in configuration."); return undef; diff --git a/pandora_server/util/plugin/snmp_remote.pl b/pandora_server/util/plugin/snmp_remote.pl index d9113789f2..ef37337556 100755 --- a/pandora_server/util/plugin/snmp_remote.pl +++ b/pandora_server/util/plugin/snmp_remote.pl @@ -206,7 +206,7 @@ if ($module eq "diskuse") { $command_line_parammeters = "-v $version -c $community $host"; } - if ($disk =~ /\\/) { + if ($disk =~ /\\ /) { $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"`; @@ -248,9 +248,11 @@ if ($module eq "process") { $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`; - - print $status; + $status = `snmpwalk $command_line_parammeters 1.3.6.1.2.1.25.4.2.1.2 2>/dev/null`; + + if ($? == 0) { + print (($status =~ m/$process/mi)?1:0); + } } #-----------------------------------------------------------------------