> Can we check whether the scrape was successful or not?
up == 1
Unfortunately,
timestamp(up == 1)
doesn't work as you might hope; it returns the current time (the instant that the query was made for), not the time of the last successful scrape.
You can do:
timestamp(up) unless up == 0
but then you'll only get the timestamp if the server is currently up, and nothing if it is down.
You can use a subquery, which scans the expression over a time range - but I already explained that to you a few weeks ago:
max_over_time((time() * up)[24h:5m])
Or I think this will work too:
max_over_time((timestamp(up == 1))[24h:5m])
Both of these give an approximation. The subquery as shown evaluates the expression at 5 minute intervals over the last 24 hours; so the timestamp you get is rounded up to the next 5 minute step.