Skip to content

Instantly share code, notes, and snippets.

View mohierf's full-sized avatar

Frédéric MOHIER mohierf

  • Valence, France
View GitHub Profile
var date = new Date();
var daysToDeletion = 120;
var deletionDate = new Date(date.setDate(date.getDate() - daysToDeletion));
printjson(deletionDate);
var db = db.getSiblingDB('alignak-backend')
db.getMongo().setSlaveOk();
// logcheckresult and/or history are candidates to deletion
@mohierf
mohierf / Count commits
Created April 11, 2017 16:25
Count commits for Alignak project
from github3 import login
from pprint import pprint
import operator
user, password = 'mohierf', 'my_password'
commits_count = 0
g = login(user, password=password)
organization = 'alignak-monitoring'
@mohierf
mohierf / services_duplicate_foreach
Created March 2, 2017 11:23
Using the duplicate_foreach property of a service definition
**Service definition duplicate_foreach**
This is used to generate serveral service with only one service declaration.
Alignak understands this statement as : “Create a service for each key in the variable”.
Usually, this statement come with a “$KEY$” string in the service_description (to have a different name) and
in the check_command (you also want a different check).
Moreover, one or several variables can be associated to each key.
Then, values can be used in the service definition with $VALUE$ or $VALUEn$ macros.
# If you wish to know if the currently Alignak installed packages are up-to-date, you can use this command:
pip list --outdated | grep alignak
# To get the list of outdated packages as a pip requirements list:
pip list --outdated --format columns | grep alignak | awk '{printf "%s==%s\n", $1, $3}' > alignak-update.txt
# And then update your installed packages
pip install -r alignak-update.txt