Question

How can I retrive the usage of drupal by API?

How can I retrive the usage of drupal by API?

I didn’t find related API.

That mean, I can’t get the usage by API?

Subscribe
Share

the usage is cpu usage, disk i/o, mem usage, bandwidth


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

/**

  • Custom content function.
  • Set beginning and end dates, retrieve posts from database
  • saved in that time period.
  • @return
  • A result set of the targeted posts. */ function current_posts_contents(){ //Get today’s date. $today = getdate(); //Calculate the date a week ago. $start_time = mktime(0, 0, 0,$today[‘mon’],($today[‘mday’] - 7), $today[‘year’]); //Get all posts from one week ago to the present. $end_time = time();

//Use Database API to retrieve current posts. $query = db_select(‘node’, ‘n’) ->fields(‘n’, array(‘nid’, ‘title’, ‘created’)) ->condition(‘status’, 1) //Published. ->condition(‘created’, array($start_time, $end_time), ‘BETWEEN’) ->orderBy(‘created’, ‘DESC’) //Most recent first. ->execute(); return $query;
} (Remember not to include the closing ?> in your code.)