How to use the describe function from pm2

Find comprehensive JavaScript pm2.describe code examples handpicked from public code repositorys.

109
110
111
112
113
114
115
116
117
118
program
  .command('logs')
  .description('Show Raneto Logs')
  .action(() => {
    pm2.connect(() => {
      pm2.describe('raneto', (error, list) => {
        if (error) {
          console.log(`Error getting info: ${error.msg}`);
          process.exit(1);
        } else if (list.length === 0) {
fork icon449
star icon0
watch icon0

80
81
82
83
84
85
86
87
88
89
 * @return {Promise<ProcessDescription>} - Details of process
 */
getProcessDetails() {
    console.trace(`Process ${this.name} - getting process details`);
    return new Promise((resolve, reject) => {
        pm2.describe(this.pm_id, (err, processDescription) => {
            if (err) {
                return reject(err);
            }
            if (processDescription.length !== 1) {
fork icon8
star icon16
watch icon5

+ 29 other calls in file

1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
  pm2.connect(() => {
    pm2.restart("index");
  });
} else if (request.text.toLowerCase() == "!status") {
  pm2.connect(() => {
    pm2.describe("index", (err, description) => {
      var descriptionVal = description[0];
      bot.send(
        `Status: ${descriptionVal.pm2_env.status} - Restarts: ${descriptionVal.pm2_env.restart_time} - Memory: ${descriptionVal.monit.memory} - CPU usage: ${descriptionVal.monit.cpu}%`
      );
fork icon1
star icon0
watch icon2

+ 38 other calls in file

26
27
28
29
30
31
32
33
34
35
36
  });
};


const describeAsync = (process) => {
  return new Promise((resolve, reject) => {
    pm2.describe(process, (err, proc) => {
      if (err) reject(err);
      resolve(proc[0]);
    });
  });
fork icon0
star icon0
watch icon1