Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ProcessCmd = &cobra.Command{ Use: "ps", Short: "", Run: func(cmd *cobra.Command, args []string) { info, err := ssm.GetInstanceInformation() if err != nil { log.Fatal().Err(err).Msg("cannot get instance information") } logger := log.With().Str("ManagedId", info.InstanceId).Logger() processes, err := sysmon.ListAllProcesses() if err != nil { log.Fatal().Err(err).Msg("cannot list processes") } inventory := map[string]interface{}{ "SchemaVersion": "1.0", "TypeName": "Custom:ProcessInfo", "CaptureTime": time.Now().UTC().Format("2006-01-02T15:04:05Z"), "Content": processes, } data, err := json.MarshalIndent(inventory, "", " ") if err != nil { logger.Fatal().Err(err).Msg("cannot marshal inventory") } path := filepath.Join(appconfig.DefaultDataStorePath, info.InstanceId, "inventory/custom/ProcessInfo.json") if err := ioutil.WriteFile(path, data, 0644); err != nil { logger.Fatal().Err(err).Msgf("cannot write file: %#v", path) } logger.Info().Msg("process inventory completed successfully") }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.