Skip to content

Conversation

@shivinder
Copy link

The code for the following files has been changed:

  • check_events.sh
  • check_mailservers.sh
  • check_webhooks.sh

The above files share common logic and the following changes have been made in them all:

  • the dig command has been moved as the first step to improvise the logic. The request has to be made irrespect of the further logic in the script.
  • the output from the dig command has been stored in a memory variable. This reduces 2 disk access requests - one to create and write in it the first time, and the second to compare it with the existing file containing the ip addresses.
  • the diff command has been modified to compare the memory variable with the existing file containing the ip addresses.
  • the existing file containing the IP addresses was being replaced with the new IP addresses each time in the previous version. This means a call to write to disk was being issued each script run. This has been removed and the new file is created only when the IP addresses actually change. This is an improvement.

Reason: By keeping the variable in the memory improves the script execution time. Disk access should be kept to minimum.

The README.md file has been modified to add more details.

PS: I am an ex-PagerDuty employee. Do not have Pull Request permissions on the branch anymore. Choose to create a fork and then merge the code. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant