Decstasy / ovh-nagios-service-expiry-check

Nagios check for service expiry on OVH, SoYouStart, Kimsufi Domains, VPS, Dedicated Servers and Private Clouds
GNU General Public License v3.0
4 stars 3 forks source link

Could not get ExpirationDate #2

Closed jamespo closed 6 years ago

jamespo commented 6 years ago

I'm getting this error now, the script worked perfectly for me previously:

Could not get ExpirationDate in function get_exp_date. sys_query output: {errorCode:QUERY_TIME_OUT,httpCode:400 Bad Request,message:Query out of time}

I also tried updating to the latest version in git, but no luck.

Decstasy commented 6 years ago

The query is signed with a sha1 checksum which also includes a timestamp in seconds since 1970-01-01 00:00:00 UTC. Please check if your local servertime has an offset to the API time.

user@monitoring-server~ % date -u +'%s'; echo $(curl -s "https://eu.api.ovh.com/1.0/auth/time")
1515157881
1515157880

If it has a greater difference, you should check your NTP synchronization respectively your Host -> VM timesync.

Alternatively you can swap the comment on line 95 with line 96 - but I would not recommend that.

--- check_ovh_service_expiry.sh 2018-01-05 15:05:44.646123045 +0100
+++ check_ovh_service_expiry_new.sh     2018-01-05 15:06:22.953497858 +0100
@@ -92,8 +92,8 @@
         fi

         # Timestamp
-        ts="$(date -u +'%s')"
-        #ts="$(curl -s $api/auth/time)"
+        #ts="$(date -u +'%s')"
+        ts="$(curl -s $api/auth/time)"

         method="$1"
         query="$api$2"

Please keep me updated.

jamespo commented 6 years ago

that fixed it, ntp daemon had died & time had drifted. Thanks!