Add InfrastructureAgent files to .gitignore and update daemon management logic in Index.ts

This commit is contained in:
Simon Larsen 2024-04-09 12:38:56 +01:00
parent f8eaeb52a1
commit 2e7ea183e6
No known key found for this signature in database
GPG Key ID: AB45983AA9C81CDE
4 changed files with 30 additions and 4 deletions

7
.gitignore vendored
View File

@ -102,4 +102,9 @@ Examples/otel-dotnet/obj/*
InfrastructureAgent/sea-prep.blob
InfrastructureAgent/InfrastructureAgent
InfrastructureAgent/build/*
InfrastructureAgent/build/*
InfrastructureAgent/err.log
InfrastructureAgent/out.log
InfrastructureAgent/daemon.pid

View File

@ -52,8 +52,8 @@ const returnValue:
demandOption: false,
});
},
async (y: any) => {
const argv: ArgumentType = y.argv as ArgumentType;
async (y: yargs.ArgumentsCamelCase) => {
const argv: ArgumentType = y as ArgumentType;
// add secrt key and oneuptime url
@ -146,6 +146,15 @@ const returnValue:
'Show status of daemon',
() => {},
() => {
// check if daemon.pid file exists
const doesFileExist: boolean = fs.existsSync('./daemon.pid');
if (!doesFileExist) {
Logger.info('OneUptime Infrastructure Agent is not running');
return;
}
const pid: string | number = fs
.readFileSync('./daemon.pid', 'utf-8')
.trim();

View File

@ -75,7 +75,7 @@ export default class MonitorInfrastructure {
};
Logger.info('Server Monitor Response');
Logger.info(JSON.stringify(serverMonitorResponse));
Logger.info(JSON.stringify(serverMonitorResponse, null, 2));
// now we send this data back to server.

View File

@ -22,6 +22,18 @@ Once its up and running you should see the metrics on the OneUptime Dashboard.
oneuptime-infrastructure-agent stop
```
## Check the status of the agent
```
oneuptime-infrastructure-agent status
```
## Logs
```
oneuptime-infrastructure-agent logs
```
## Uninstalling the agent
```