Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add helper functions for converting common Nagios date/time formats? #185

Open
atc0005 opened this issue Jan 26, 2023 · 1 comment
Open
Assignees
Labels
enhancement New feature or request question Further information is requested
Milestone

Comments

@atc0005
Copy link
Owner

atc0005 commented Jan 26, 2023

While reading https://www.devopsschool.com/tutorial/nagios/nagios-faq.html I found this:

Q. When Does Nagios Check For External Commands?

Ans: At regular intervals specified by the command_check_interval option in the main configuration file
Immediately after event handlers are executed. This is in addition to the regular cycle of external command checks and is done to provide immediate action if an event handler submits commands to Nagios.
External commands that are written to the command file have the following format
[time] command_id;command_arguments
where time is the time (in time_t format) that the external application submitted the external command to the command file. The values for the command_id and command_arguments arguments will depend on what command is being submitted to Nagios.

and this specific tidbit:

External commands that are written to the command file have the following format
[time] command_id;command_arguments
where time is the time (in time_t format)

which reminded me of this CLI "recipe" (where example1 in the example is the hostname):

$ grep -i example1 /usr/local/nagios/var/nagios.log | perl -pe 's/(\d+)/localtime($1)/e'

It would be useful to provide a helper for converting the time_t format to other commonly used formats.

@atc0005 atc0005 added enhancement New feature or request question Further information is requested labels Jan 26, 2023
@atc0005 atc0005 self-assigned this Jan 26, 2023
@atc0005 atc0005 added this to the Future milestone Jan 27, 2023
@atc0005
Copy link
Owner Author

atc0005 commented Jun 16, 2023

While attempting to create a scratch Go file I found this stubbed out:

package main

import (
        "fmt"
        "time"
)

func main() {
        t := time.Unix(1663514401, 0)
        fmt.Println(t)
}

Noting it here for a reminder of where to start looking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant